cocoapods-stats 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 26919a926eb771c4c5ee969d8336a2834dd5b4f3
4
+ data.tar.gz: 4e65a1a6f9b669fe9f411d11a368b8341b8e9f62
5
+ SHA512:
6
+ metadata.gz: 4cc409e721eb1fb64bdfdfc13dc76480b5008c04b0f97fe325c917071d5bd1a369c8626d74763291b36dbe1499512907d70a495dde7d3f9d49fdaeab35b3ecb6
7
+ data.tar.gz: 84d7b53c2e06e1759c7f57a3b82eaa88cb8174fac501d310cc7dc41215a96a4529741bef9760c54607eb650377963d0be4a5647c3c09bea20719c395c94de618
data/.gitignore ADDED
@@ -0,0 +1,38 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
4
+ *.gem
5
+ *.rbc
6
+ /.config
7
+ /coverage/
8
+ /InstalledFiles
9
+ /pkg/
10
+ /spec/reports/
11
+ /test/tmp/
12
+ /test/version_tmp/
13
+ /tmp/
14
+
15
+ ## Specific to RubyMotion:
16
+ .dat*
17
+ .repl_history
18
+ build/
19
+
20
+ ## Documentation cache and generated files:
21
+ /.yardoc/
22
+ /_yardoc/
23
+ /doc/
24
+ /rdoc/
25
+
26
+ ## Environment normalisation:
27
+ /.bundle/
28
+ /vendor/bundle
29
+ /lib/bundler/man/
30
+
31
+ # for a library or gem, you might want to ignore these files since the code is
32
+ # intended to run in multiple environments; otherwise, check them in:
33
+ # Gemfile.lock
34
+ # .ruby-version
35
+ # .ruby-gemset
36
+
37
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
38
+ .rvmrc
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ inherit_from:
2
+ - .rubocop_cocoapods.yml
3
+
4
+ Metrics/LineLength:
5
+ Max: 100
@@ -0,0 +1,116 @@
1
+ AllCops:
2
+ Include:
3
+ - ./Rakefile
4
+ - ./Gemfile
5
+ - ./*.gemspec
6
+ Exclude:
7
+ - ./spec/fixtures/**/*
8
+
9
+ # At the moment not ready to be used
10
+ # https://github.com/bbatsov/rubocop/issues/947
11
+ Documentation:
12
+ Enabled: false
13
+
14
+ #- CocoaPods -----------------------------------------------------------------#
15
+
16
+ # We adopted raise instead of fail.
17
+ SignalException:
18
+ EnforcedStyle: only_raise
19
+
20
+ # They are idiomatic
21
+ AssignmentInCondition:
22
+ Enabled: false
23
+
24
+ # Allow backticks
25
+ AsciiComments:
26
+ Enabled: false
27
+
28
+ # Indentation clarifies logic branches in implementations
29
+ IfUnlessModifier:
30
+ Enabled: false
31
+
32
+ # No enforced convention here.
33
+ SingleLineBlockParams:
34
+ Enabled: false
35
+
36
+ # We only add the comment when needed.
37
+ Encoding:
38
+ Enabled: false
39
+
40
+ # Having these make it easier to *not* forget to add one when adding a new
41
+ # value and you can simply copy the previous line.
42
+ TrailingComma:
43
+ EnforcedStyleForMultiline: comma
44
+
45
+ Style/MultilineOperationIndentation:
46
+ EnforcedStyle: indented
47
+
48
+ # Clashes with CLAide Command#validate!
49
+ GuardClause:
50
+ Enabled: false
51
+
52
+ # Not always desirable: lib/claide/command/plugins_helper.rb:12:15
53
+ Next:
54
+ Enabled: false
55
+
56
+ # Arbitrary max lengths for classes simply do not work and enabling this will
57
+ # lead to a never ending stream of annoyance and changes.
58
+ Metrics/ClassLength:
59
+ Enabled: false
60
+
61
+ # Arbitrary max lengths for methods simply do not work and enabling this will
62
+ # lead to a never ending stream of annoyance and changes.
63
+ Metrics/MethodLength:
64
+ Enabled: false
65
+
66
+ # No enforced convention here.
67
+ Metrics/BlockNesting:
68
+ Enabled: false
69
+
70
+ # It will be obvious which code is complex, Rubocop should only lint simple
71
+ # rules for us.
72
+ Metrics/AbcSize:
73
+ Enabled: false
74
+
75
+ # It will be obvious which code is complex, Rubocop should only lint simple
76
+ # rules for us.
77
+ Metrics/CyclomaticComplexity:
78
+ Enabled: false
79
+
80
+ #- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
81
+
82
+ HashSyntax:
83
+ EnforcedStyle: hash_rockets
84
+
85
+ Lambda:
86
+ Enabled: false
87
+
88
+ DotPosition:
89
+ EnforcedStyle: trailing
90
+
91
+ EachWithObject:
92
+ Enabled: false
93
+
94
+ Style/SpecialGlobalVars:
95
+ Enabled: false
96
+
97
+ #- CocoaPods specs -----------------------------------------------------------#
98
+
99
+ # Allow for `should.match /regexp/`.
100
+ AmbiguousRegexpLiteral:
101
+ Exclude:
102
+ - spec/**/*
103
+
104
+ # Allow `object.should == object` syntax.
105
+ Void:
106
+ Exclude:
107
+ - spec/**/*
108
+
109
+ ClassAndModuleChildren:
110
+ Exclude:
111
+ - spec/**/*
112
+
113
+ UselessComparison:
114
+ Exclude:
115
+ - spec/**/*
116
+
data/.travis.yml ADDED
@@ -0,0 +1,22 @@
1
+ # Sets Travis to run the Ruby specs on OS X machines to be as close as possible
2
+ # to the user environment.
3
+ #
4
+ language: objective-c
5
+
6
+ cache: bundler
7
+ rvm:
8
+ # OS X 10.9.5-10.10.0 (2.0.0-p481)
9
+ - system
10
+ # OS X 10.9.3-10.9.4
11
+ - 2.0.0-p451
12
+ # OS X 10.9.0-10.9.2
13
+ # TODO currently unavailable: https://github.com/travis-ci/travis-ci/issues/2918
14
+ # - 2.0.0-p247
15
+ - 2.1
16
+
17
+ before_install:
18
+ # There is a bug in travis. When using system ruby, bundler is not installed
19
+ # and causes the default install action to fail.
20
+ - sudo gem install bundler
21
+
22
+ script: bundle exec rake spec
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ #CocoaPods Stats CHANGELOG
2
+
3
+ ## 0.5.0
4
+
5
+ * Initial implementation of stats uploading.
6
+ [Orta](https://github.com/orta)
7
+
8
+ * Refactor of Orta's initial implementation
9
+ [Segiddins](https://github.com/segiddins)
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cocoapods-stats.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'cocoapods'
8
+
9
+ gem 'bacon'
10
+ gem 'mocha-on-bacon'
11
+
12
+ gem 'rubocop'
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,91 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ cocoapods-stats (0.5.0)
5
+ nap (~> 0.8)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.1)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ ast (2.0.0)
17
+ astrolabe (1.3.0)
18
+ parser (>= 2.2.0.pre.3, < 3.0)
19
+ bacon (1.2.0)
20
+ claide (0.8.1)
21
+ cocoapods (0.37.2)
22
+ activesupport (>= 3.2.15)
23
+ claide (~> 0.8.1)
24
+ cocoapods-core (= 0.37.2)
25
+ cocoapods-downloader (~> 0.9.0)
26
+ cocoapods-plugins (~> 0.4.2)
27
+ cocoapods-trunk (~> 0.6.1)
28
+ cocoapods-try (~> 0.4.5)
29
+ colored (~> 1.2)
30
+ escape (~> 0.0.4)
31
+ molinillo (~> 0.2.3)
32
+ nap (~> 0.8)
33
+ xcodeproj (~> 0.24.2)
34
+ cocoapods-core (0.37.2)
35
+ activesupport (>= 3.2.15)
36
+ fuzzy_match (~> 2.0.4)
37
+ nap (~> 0.8.0)
38
+ cocoapods-downloader (0.9.0)
39
+ cocoapods-plugins (0.4.2)
40
+ nap
41
+ cocoapods-trunk (0.6.1)
42
+ nap (>= 0.8)
43
+ netrc (= 0.7.8)
44
+ cocoapods-try (0.4.5)
45
+ colored (1.2)
46
+ escape (0.0.4)
47
+ fuzzy_match (2.0.4)
48
+ i18n (0.7.0)
49
+ json (1.8.3)
50
+ metaclass (0.0.4)
51
+ minitest (5.7.0)
52
+ mocha (1.1.0)
53
+ metaclass (~> 0.0.1)
54
+ mocha-on-bacon (0.2.2)
55
+ mocha (>= 0.13.0)
56
+ molinillo (0.2.3)
57
+ nap (0.8.0)
58
+ netrc (0.7.8)
59
+ parser (2.2.2.2)
60
+ ast (>= 1.1, < 3.0)
61
+ powerpack (0.1.1)
62
+ rainbow (2.0.0)
63
+ rake (10.4.2)
64
+ rubocop (0.31.0)
65
+ astrolabe (~> 1.3)
66
+ parser (>= 2.2.2.1, < 3.0)
67
+ powerpack (~> 0.1)
68
+ rainbow (>= 1.99.1, < 3.0)
69
+ ruby-progressbar (~> 1.4)
70
+ ruby-progressbar (1.7.5)
71
+ thread_safe (0.3.5)
72
+ tzinfo (1.2.2)
73
+ thread_safe (~> 0.1)
74
+ xcodeproj (0.24.2)
75
+ activesupport (>= 3)
76
+ colored (~> 1.2)
77
+
78
+ PLATFORMS
79
+ ruby
80
+
81
+ DEPENDENCIES
82
+ bacon
83
+ bundler (~> 1.3)
84
+ cocoapods
85
+ cocoapods-stats!
86
+ mocha-on-bacon
87
+ rake (~> 10.0)
88
+ rubocop
89
+
90
+ BUNDLED WITH
91
+ 1.10.4
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Orta Therox <orta.therox@gmail.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # cocoapods-stats
2
+
3
+ A description of cocoapods-stats.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-stats
8
+
9
+ ## Usage
10
+
11
+ $ pod spec stats POD_NAME
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ begin
2
+
3
+ require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
5
+
6
+ def specs(dir)
7
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
8
+ end
9
+
10
+ desc 'Runs all the specs'
11
+ task :spec do
12
+ sh "bundle exec bacon #{specs('**')}"
13
+ Rake::Task['rubocop'].invoke
14
+ end
15
+
16
+ require 'rubocop/rake_task'
17
+ RuboCop::RakeTask.new
18
+
19
+ task default: :spec
20
+
21
+ rescue LoadError, NameError
22
+ $stderr.puts "\033[0;31m" \
23
+ '[!] Some Rake tasks haven been disabled because the environment ' \
24
+ 'couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
25
+ "\e[0m"
26
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods_stats/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-stats'
8
+ spec.version = CocoapodsStats::VERSION
9
+ spec.authors = ['Orta Therox', 'Samuel Giddins']
10
+ spec.email = ['orta.therox@gmail.com', 'segiddins@segiddins.me']
11
+ spec.description = 'Uploads statistics for Pod Analytics.'
12
+ spec.summary = 'Uploads installation version data to ' \
13
+ 'stats.cocoapods.org to provide per-Pod analytics.'
14
+ spec.homepage = 'https://github.com/cocoapods/cocoapods-stats'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_runtime_dependency 'nap', '~> 0.8'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ end
@@ -0,0 +1,45 @@
1
+ module CocoaPodsStats
2
+ class SpecsRepoValidator
3
+ def validates?(source)
4
+ source && source.url.end_with?('CocoaPods/Specs.git')
5
+ end
6
+ end
7
+
8
+ class OptOutValidator
9
+ def validates?
10
+ ENV['COCOAPODS_DISABLE_STATS'].nil?
11
+ end
12
+ end
13
+
14
+ Pod::HooksManager.register('cocoapods-stats', :post_install) do |context, _|
15
+ require 'set'
16
+ require 'cocoapods'
17
+ require 'cocoapods_stats/target_mapper'
18
+ require 'cocoapods_stats/sender'
19
+
20
+ validator = OptOutValidator.new
21
+ break unless validator.validates?
22
+
23
+ master_source = Pod::SourcesManager.master.first
24
+ validator = SpecsRepoValidator.new
25
+ break unless validator.validates?(master_source)
26
+
27
+ Pod::UI.titled_section 'Sending stats' do
28
+ master_pods = Set.new(master_source.pods)
29
+
30
+ mapper = TargetMapper.new
31
+ targets = mapper.pods_from_project(context, master_pods)
32
+
33
+ # Logs out for now:
34
+ targets.flat_map { |t| t[:pods] }.uniq.sort_by { |p| p[:name] }.each do |pod|
35
+ Pod::UI.message "#{pod[:name]}, #{pod[:version]}", '- '
36
+ end
37
+
38
+ is_pod_try = defined?(Pod::Command::Try::TRY_TMP_DIR) &&
39
+ context.sandbox_root.start_with?(Pod::Command::Try::TRY_TMP_DIR.to_s)
40
+
41
+ # Send the analytics stuff up
42
+ Sender.new.send(targets, :pod_try => is_pod_try)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods_stats/gem_version'
@@ -0,0 +1,3 @@
1
+ module CocoapodsStats
2
+ VERSION = '0.5.0'
3
+ end
@@ -0,0 +1,22 @@
1
+ require 'rest'
2
+
3
+ module CocoaPodsStats
4
+ class Sender
5
+ API_URL = 'https://stats.cocoapods.org/api/v1/install'
6
+
7
+ def send(targets, pod_try: false)
8
+ REST.post(
9
+ API_URL,
10
+ {
11
+ :targets => targets,
12
+ :cocoapods_version => Pod::VERSION,
13
+ :pod_try => pod_try,
14
+ }.to_json,
15
+ 'Accept' => 'application/json',
16
+ 'Content-Type' => 'application/json',
17
+ )
18
+ rescue REST::Error => e
19
+ Pod::UI.message "Failed to send stats:\n\n#{e}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,39 @@
1
+ require 'digest'
2
+ require 'xcodeproj'
3
+
4
+ module CocoaPodsStats
5
+ class TargetMapper
6
+ # Loop though all targets in the pod
7
+ # generate a collection of hashes
8
+ def pods_from_project(context, master_pods)
9
+ context.umbrella_targets.flat_map do |target|
10
+ root_specs = target.specs.map(&:root).uniq
11
+
12
+ # As it's hard to look up the source of a pod, we
13
+ # can check if the pod exists in the master specs repo though
14
+
15
+ pods = root_specs.
16
+ select { |spec| master_pods.include?(spec.name) }.
17
+ map { |spec| { :name => spec.name, :version => spec.version.to_s } }
18
+
19
+ # These UUIDs come from the Xcode project
20
+ # http://danwright.info/blog/2010/10/xcode-pbxproject-files-3/
21
+
22
+ project = Xcodeproj::Project.open(target.user_project_path)
23
+
24
+ target.user_target_uuids.map do |uuid|
25
+ project_target = project.objects_by_uuid[uuid]
26
+
27
+ # Send in a digested'd UUID anyway, a second layer
28
+ # of misdirection can't hurt
29
+ {
30
+ :uuid => Digest::SHA256.hexdigest(uuid),
31
+ :type => project_target.product_type,
32
+ :pods => pods,
33
+ :platform => project_target.platform_name,
34
+ }
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe CocoaPodsStats::OptOutValidator do
4
+ describe 'validates' do
5
+ it 'returns no when there is an env var' do
6
+ ENV['COCOAPODS_DISABLE_STATS'] = 'true'
7
+
8
+ subject = CocoaPodsStats::OptOutValidator.new
9
+ subject.should.not.validates
10
+ end
11
+
12
+ it 'returns yes when given a master repo that is cocoapods/specs' do
13
+ ENV['COCOAPODS_DISABLE_STATS'] = nil
14
+
15
+ subject = CocoaPodsStats::OptOutValidator.new
16
+ subject.should.validates
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,45 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $LOAD_PATH.unshift((ROOT + 'lib').to_s)
4
+ $LOAD_PATH.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'bacon'
8
+ require 'mocha-on-bacon'
9
+ require 'cocoapods'
10
+
11
+ require 'cocoapods_plugin'
12
+
13
+ #-----------------------------------------------------------------------------#
14
+
15
+ module Pod
16
+ # Disable the wrapping so the output is deterministic in the tests.
17
+ #
18
+ UI.disable_wrap = true
19
+
20
+ # Redirects the messages to an internal store.
21
+ #
22
+ module UI
23
+ @output = ''
24
+ @warnings = ''
25
+
26
+ class << self
27
+ attr_accessor :output
28
+ attr_accessor :warnings
29
+
30
+ def puts(message = '')
31
+ @output << "#{message}\n"
32
+ end
33
+
34
+ def warn(message = '', _actions = [])
35
+ @warnings << "#{message}\n"
36
+ end
37
+
38
+ def print(message)
39
+ @output << message
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ #-----------------------------------------------------------------------------#
@@ -0,0 +1,73 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ require 'cocoapods_stats/target_mapper'
3
+
4
+ describe CocoaPodsStats::TargetMapper do
5
+ describe 'pods_from_project' do
6
+ before do
7
+ project_target = mock
8
+ project_target.stubs(:product_type).returns('testing')
9
+ project_target.stubs(:platform_name).returns('test platform')
10
+
11
+ project = mock
12
+ project.stubs(:objects_by_uuid).returns('111222333' => project_target)
13
+ Xcodeproj::Project.stubs(:open).returns(project)
14
+ end
15
+
16
+ it 'returns expected data' do
17
+ master_pods = Set.new(['ORStackView'])
18
+
19
+ spec = Pod::Specification.new
20
+ spec.name = 'ORStackView'
21
+ spec.version = '1.1.1'
22
+
23
+ target = mock
24
+ target.stubs(:specs).returns([spec])
25
+ target.stubs(:user_target_uuids).returns(['111222333'])
26
+ target.stubs(:user_project_path).returns('/foo/bar')
27
+
28
+ context = mock
29
+ context.stubs(:umbrella_targets).returns([target])
30
+
31
+ mapper = CocoaPodsStats::TargetMapper.new
32
+ pods = mapper.pods_from_project(context, master_pods)
33
+
34
+ pods.should == [
35
+ {
36
+ :uuid => 'da5511d2baa83c2e753852f1f2fba11003ed0c46c96820c7589b243a8ddb787a',
37
+ :type => 'testing',
38
+ :pods => [
39
+ { :name => 'ORStackView', :version => '1.1.1' },
40
+ ],
41
+ :platform => 'test platform',
42
+ }]
43
+ end
44
+
45
+ it 'returns no pods if it cannot find them in the master_pods set' do
46
+ master_pods = Set.new([''])
47
+
48
+ spec = Pod::Specification.new
49
+ spec.name = 'ORStackView'
50
+ spec.version = '1.1.1'
51
+
52
+ target = mock
53
+ target.stubs(:specs).returns([spec])
54
+ target.stubs(:user_target_uuids).returns(['111222333'])
55
+ target.stubs(:user_project_path).returns('/foo/bar')
56
+
57
+ context = mock
58
+ context.stubs(:umbrella_targets).returns([target])
59
+
60
+ mapper = CocoaPodsStats::TargetMapper.new
61
+ pods = mapper.pods_from_project(context, master_pods)
62
+
63
+ pods.should == [
64
+ {
65
+ :uuid => 'da5511d2baa83c2e753852f1f2fba11003ed0c46c96820c7589b243a8ddb787a',
66
+ :type => 'testing',
67
+ :pods => [],
68
+ :platform => 'test platform',
69
+ },
70
+ ]
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe CocoaPodsStats::SpecsRepoValidator do
4
+ describe 'validates' do
5
+ it 'returns no when given a nil' do
6
+ subject = CocoaPodsStats::SpecsRepoValidator.new
7
+ subject.should.not.validates?(nil)
8
+ end
9
+
10
+ it 'returns no when given a master repo that is not cocoapods/specs' do
11
+ sources = mock
12
+ sources.stubs(:url).returns('CocoaPods/NotSpecs.git')
13
+
14
+ subject = CocoaPodsStats::SpecsRepoValidator.new
15
+ subject.should.not.validates?(sources)
16
+ end
17
+
18
+ it 'returns yes when given a master repo that is cocoapods/specs' do
19
+ sources = mock
20
+ sources.stubs(:url).returns('CocoaPods/Specs.git')
21
+
22
+ subject = CocoaPodsStats::SpecsRepoValidator.new
23
+ subject.should.validates?(sources)
24
+ end
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-stats
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Orta Therox
8
+ - Samuel Giddins
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-06-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nap
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '0.8'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '0.8'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.3'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ description: Uploads statistics for Pod Analytics.
57
+ email:
58
+ - orta.therox@gmail.com
59
+ - segiddins@segiddins.me
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - ".rubocop.yml"
66
+ - ".rubocop_cocoapods.yml"
67
+ - ".travis.yml"
68
+ - CHANGELOG.md
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - cocoapods-stats.gemspec
76
+ - lib/cocoapods_plugin.rb
77
+ - lib/cocoapods_stats.rb
78
+ - lib/cocoapods_stats/gem_version.rb
79
+ - lib/cocoapods_stats/sender.rb
80
+ - lib/cocoapods_stats/target_mapper.rb
81
+ - spec/env_validator_spec.rb
82
+ - spec/spec_helper.rb
83
+ - spec/target_mapper_spec.rb
84
+ - spec/validator_spec.rb
85
+ homepage: https://github.com/cocoapods/cocoapods-stats
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.2.2
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Uploads installation version data to stats.cocoapods.org to provide per-Pod
109
+ analytics.
110
+ test_files:
111
+ - spec/env_validator_spec.rb
112
+ - spec/spec_helper.rb
113
+ - spec/target_mapper_spec.rb
114
+ - spec/validator_spec.rb