forked from orta/ARAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARAnalytics.podspec
144 lines (119 loc) · 7.5 KB
/
ARAnalytics.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
Pod::Spec.new do |s|
s.name = 'ARAnalytics'
s.version = '2.7.4.2'
s.license = {:type => 'MIT', :file => 'LICENSE' }
s.summary = 'Use multiple major analytics platforms with one clean API.'
s.homepage = 'https://github.com/Labgoo/ARAnalytics'
s.authors = { 'orta' => '[email protected]', 'Daniel Haight' => "[email protected]" }
s.source = { :git => 'https://github.com/Labgoo/ARAnalytics.git', :tag => s.version.to_s }
s.ios.deployment_target = "6.0"
s.osx.deployment_target = "10.7"
s.social_media_url = "https://twitter.com/orta"
s.requires_arc = true
s.summary = 'Using subspecs you can define your analytics provider with the same API on iOS and OS X.'
# s.description is at the bottom as it is partially generated.
mixpanel = { :spec_name => "Mixpanel", :dependency => "Mixpanel" }
localytics = { :spec_name => "Localytics", :dependency => "Localytics-iOS-Client" }
flurry = { :spec_name => "Flurry", :dependency => "FlurrySDK" }
google = { :spec_name => "GoogleAnalytics", :dependency => "GoogleAnalytics", :has_extension => true }
kissmetrics = { :spec_name => "KISSmetrics", :dependency => "KISSmetrics" }
crittercism = { :spec_name => "Crittercism", :dependency => "CrittercismSDK" }
countly = { :spec_name => "Countly", :dependency => "Countly" }
bugsnag = { :spec_name => "Bugsnag", :dependency => "Bugsnag" }
helpshift = { :spec_name => "Helpshift", :dependency => "Helpshift" }
tapstream = { :spec_name => "Tapstream", :dependency => "Tapstream" }
newRelic = { :spec_name => "NewRelic", :dependency => "NewRelicAgent" }
amplitude = { :spec_name => "Amplitude", :dependency => "Amplitude-iOS" }
hockeyApp = { :spec_name => "HockeyApp", :dependency => "HockeySDK" }
parseAnalytics = { :spec_name => "ParseAnalytics", :dependency => "Parse-iOS-SDK" }
heap = { :spec_name => "HeapAnalytics", :dependency => "Heap" }
chartbeat = { :spec_name => "Chartbeat", :dependency => "Chartbeat", :has_extension => true }
appsee = { :spec_name => "Appsee", :dependency => "Appsee", :has_extension => true }
appsflyer = { :spec_name => "Appsflyer", :dependency => "AppsFlyerFramework" }
umeng = { :spec_name => "UMengAnalytics", :dependency => "UMengAnalytics" }
librato = { :spec_name => "Librato" }
crashlytics = { :spec_name => "Crashlytics" }
intercom = { :spec_name => "Intercom", :dependency => "Intercom", :has_extension => true }
kissmetrics_mac = { :spec_name => "KISSmetricsOSX", :dependency => "KISSmetrics", :osx => true, :provider => "KISSmetrics" }
# countly_mac = { :spec_name => "CountlyOSX", :dependency => "Countly", :osx => true, :provider => "Countly" }
mixpanel_mac = { :spec_name => "MixpanelOSX", :dependency => "Mixpanel-OSX-Community", :osx => true, :provider => "Mixpanel"}
all_analytics = [mixpanel, localytics, flurry, google, kissmetrics, crittercism, crashlytics, bugsnag, countly, helpshift,kissmetrics_mac, mixpanel_mac, tapstream, newRelic, amplitude, hockeyApp, parseAnalytics, heap, chartbeat, appsee, appsflyer, umeng, librato, intercom]
# To make the pod spec API cleaner, subspecs are "iOS/KISSmetrics"
s.subspec "CoreMac" do |ss|
ss.source_files = ['*.{h,m}', 'Providers/ARAnalyticalProvider.{h,m}', 'Providers/ARAnalyticsProviders.h']
ss.exclude_files = ['ARDSL.{h,m}']
ss.platform = :osx
end
s.subspec "CoreIOS" do |ss|
ss.source_files = ['*.{h,m}', 'Providers/ARAnalyticalProvider.{h,m}', 'Providers/ARAnalyticsProviders.h']
ss.exclude_files = ['ARDSL.{h,m}']
ss.private_header_files = 'ARNavigationControllerDelegateProxy.h'
ss.ios.deployment_target = '7.0'
end
s.subspec "DSL" do |ss|
ss.source_files = ['*.{h,m}', 'ARDSL.{h,m}', 'Providers/ARAnalyticalProvider.{h,m}', 'Providers/ARAnalyticsProviders.h']
ss.dependency 'Aspects', '~> 1.3.1'
end
# for the description
all_ios_names = []
all_osx_names = []
# make specs for each analytics
all_analytics.each do |analytics_spec|
s.subspec analytics_spec[:spec_name] do |ss|
providername = analytics_spec[:provider]? analytics_spec[:provider] : analytics_spec[:spec_name]
# Each subspec adds a compiler flag saying that the spec was included
ss.prefix_header_contents = "#define AR_#{providername.upcase}_EXISTS 1"
sources = ["Providers/#{providername}Provider.{h,m}"]
# It there's a category adding extra class methods to ARAnalytics
if analytics_spec[:has_extension]
sources << "Extensions/*+#{analytics_spec[:spec_name]}.{h,m}"
end
# only add the files for the osx / iOS version
if analytics_spec[:osx]
ss.osx.source_files = sources
ss.dependency 'ARAnalytics/CoreMac'
ss.platform = :osx
all_osx_names << providername
else
ss.ios.source_files = sources
ss.dependency 'ARAnalytics/CoreIOS'
ss.platform = :ios
all_ios_names << providername
end
# If there's a podspec dependency include it
Array(analytics_spec[:dependency]).each do |dep|
ss.dependency dep
end
end
end
# If both HockeyApp and Crittercism are included there will be a build failure as they both import the same library (PLCrashReporter).
# We create two subspecs which contain all the subspecs possible, including HockeyApp or Crittercism in each.
# Setting one of these as default_subspec allows us to install all libraries possible (if no subspecs are defined) without causing a build failure.
# User can finetune by specifying subspecs if they wish to include any subset of analytics as normal.
# create an array of clashing subspecs.
clashing_subspecs = [hockeyApp, crittercism]
# cycle through clashing subspecs, removing all but the the one we want to form non_clashing array
clashing_subspecs.each do |keep_subspec|
non_clash = all_analytics
clashing_subspecs.each do |clashing|
if clashing != keep_subspec then non_clash.delete(clashing) end
end
# now for each group of non_clashing subspecs, create a subspec which has these as dependancies.
s.subspec "no_clash_#{keep_subspec[:spec_name]}" do |ss|
non_clash.each do |analytics_spec|
if analytics_spec[:osx]
ss.osx.dependency "ARAnalytics/#{analytics_spec[:spec_name]}"
else
ss.ios.dependency "ARAnalytics/#{analytics_spec[:spec_name]}"
end
end
end
end
# set default subspec no_clash_NAME where NAME is the subspec we want to use.
# This will give us all possible subspecs that do not clash with NAME.
s.default_subspec = 'no_clash_HockeyApp'
# I always forget to keep the description up to date as provider support is added and removed, thus automation.
ios_spec_names = all_ios_names[0...-1].join(", ") + " and " + all_ios_names[-1]
osx_spec_names = all_osx_names[0...-1].join(", ") + " and " + all_osx_names[-1]
s.description = "ARAnalytics is a analytics abstraction library offering a sane API for tracking events and user data. It currently supports on iOS: #{ ios_spec_names }. And for OS X: #{ osx_spec_names }. It does this by using CocoaPods subspecs to let you decide which libraries you'd like to use. You are free to also use the official API for any provider too. Also, comes with an amazing DSL to clear up your methods."
end