Permalink
Browse files

added ARAnalytics 1.0

  • Loading branch information...
1 parent 632b82c commit bdcffd2f411af59dd51c34e3173e5a82ed5dbb27 @orta orta committed Dec 30, 2012
Showing with 79 additions and 0 deletions.
  1. +79 −0 ARAnalytics/1.0/ARAnalytics.podspec
@@ -0,0 +1,79 @@
+Pod::Spec.new do |s|
+ s.name = 'ARAnalytics'
+ s.version = '1.0'
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
+ s.summary = 'Use multiple Analytics Platforms with one API.'
+ s.homepage = 'http://github.com/orta/ARAnalytics'
+ s.author = { 'orta' => 'orta.therox@gmail.com' }
+ s.source = { :git => 'https://github.com/orta/ARAnalytics.git', :tag => "1.0" }
+ s.description = 'Using subspecs you can define your analytics provider with the same API. Requires Cocoapods 0.16.'
+ s.platform = :ios
+ s.source_files = '*.{h,m}'
+
+ testflight_sdk = { spec_name: "TestFlight", dependency: "TestFlightSDK", import_file: "TestFlight" }
+ mixpanel = { spec_name: "Mixpanel", dependency: "Mixpanel", import_file: "Mixpanel" }
+ localytics = { spec_name: "Localytics", dependency: "Localytics", import_file: "LocalyticsSession" }
+ flurry = { spec_name: "Flurry", dependency: "FlurrySDK", import_file: "Flurry" }
+ google = { spec_name: "GoogleAnalytics", dependency: "GoogleAnalytics-iOS-SDK", import_file: "GAI" }
+ kissmetrics = { spec_name: "KISSmetrics", dependency: "KISSmetrics", import_file: "KISSMetricsAPI" }
+ crittercism = { spec_name: "Crittercism", dependency: "CrittercismSDK", import_file: "Crittercism" }
+
+# I think we want hockeyapp, not hockey kit.
+# hockey_kit = { spec_name: "HockeyKit", dependency: "HockeyKit", import_file: "BWGlobal" }
+
+ crashlytics = { spec_name: "Crashlytics" }
+
+
+ $all_analytics = [testflight_sdk, mixpanel, localytics, flurry, google, kissmetrics, crittercism, crashlytics]
+
+ # make specs for each analytics
+ $all_analytics.each do |analytics_spec|
+ s.subspec analytics_spec[:spec_name] do |ss|
+
+ ss.source_files = '*.{h,m}'
+ if analytics_spec[:dependency]
+ ss.dependency analytics_spec[:dependency]
+ end
+
+ end
+ end
+
+ def s.pre_install(pod, target_definition)
+ # match subspecs in podfile
+ deps = target_definition.dependencies.map(&:name)
+ deps = deps.select { |d| d.include? 'ARAnalytics/' }
+
+ if deps.count == 0
+ puts "\nYou haven't included any Analytics packages in the podfile. So you'll get them all."
+ puts "The current options are #{ $all_analytics.map{ |item| item.values[0] }.join(", ") }"
+ deps = $all_analytics.map{ |item| "ARAnalytics/" + item.values[0] }
+ end
+
+ headers = []
+ deps.each do |dep|
+ # ARAnalytics/TestFlight => TestFlight
+ import_name = dep.split('/')[1]
+
+ if import_name == "Crashlytics"
+ puts "\nCrashlytics isn't on cocoapods yet and so must be installed manually. It will still work with ARAnalytics though."
+ end
+
+ # grab the import_file from the analytics above
+ $all_analytics.each do |original_spec|
+ if original_spec[:spec_name] == import_name
+ if original_spec[:import_file]
+ headers << %|#import "#{ original_spec[:import_file] }.h" \n#define AR_#{ import_name.upcase }_EXISTS 1 \n|
+ else
+ headers << %|#define AR_#{ import_name.upcase }_EXISTS 1 \n|
+ end
+ end
+ end
+
+ end
+
+ File.open( config.project_pods_root + 'ARAnalytics/ARAnalytics+GeneratedHeader.h', "w+" ) do |file|
+ file.puts headers * "\n"
+ end
+ end
+
+end

8 comments on commit bdcffd2

Contributor

travisjeffery replied Dec 30, 2012

FYI, this commit is failing on Travis-CI with Ruby 1.8.7 https://travis-ci.org/CocoaPods/Specs/builds/3883778

Member

keith replied Dec 30, 2012

It's a Travis issue.

107/home/travis/.rvm/gems/ruby-1.8.7-p371/gems/cocoapods-0.16.0/lib/cocoapods/source.rb:197:in 'dirs': [!] No spec repos found in '/home/travis/.cocoapods'. To fetch the 'master' repo run: $ pod setup (Pod::Informative)
Owner

alloy replied Dec 30, 2012

@keithbsmiley @travisjeffery @orta Actually, this is a Ruby < 1.9 issue. The key: value hash syntax should not be used, instead use key => value.

Member

keith replied Dec 31, 2012

Oh interesting! Good to know.

Owner

orta replied Dec 31, 2012

good spot!

Owner

orta replied Dec 31, 2012

Fixed

Owner

alloy replied Dec 31, 2012

Thanks guys, inbox was getting flooded with error reports from our feed/twitter service :)

Owner

orta replied Dec 31, 2012

I had missed one, all good now.

Screen Shot 2012-12-31 at 11 55 49

Please sign in to comment.