cocoapods 0.5.1 → 0.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGELOG.md +229 -2
  2. data/README.md +50 -20
  3. data/bin/pod +3 -2
  4. data/lib/cocoapods.rb +23 -9
  5. data/lib/cocoapods/command.rb +71 -30
  6. data/lib/cocoapods/command/error_report.rb +102 -0
  7. data/lib/cocoapods/command/install.rb +27 -19
  8. data/lib/cocoapods/command/list.rb +51 -8
  9. data/lib/cocoapods/command/presenter.rb +61 -0
  10. data/lib/cocoapods/command/presenter/cocoa_pod.rb +123 -0
  11. data/lib/cocoapods/command/push.rb +102 -0
  12. data/lib/cocoapods/command/repo.rb +70 -14
  13. data/lib/cocoapods/command/search.rb +7 -10
  14. data/lib/cocoapods/command/setup.rb +76 -15
  15. data/lib/cocoapods/command/spec.rb +581 -97
  16. data/lib/cocoapods/config.rb +23 -26
  17. data/lib/cocoapods/dependency.rb +86 -40
  18. data/lib/cocoapods/downloader.rb +30 -18
  19. data/lib/cocoapods/downloader/git.rb +125 -15
  20. data/lib/cocoapods/downloader/http.rb +73 -0
  21. data/lib/cocoapods/downloader/mercurial.rb +3 -9
  22. data/lib/cocoapods/downloader/subversion.rb +3 -9
  23. data/lib/cocoapods/executable.rb +26 -3
  24. data/lib/cocoapods/generator/acknowledgements.rb +37 -0
  25. data/lib/cocoapods/generator/acknowledgements/markdown.rb +38 -0
  26. data/lib/cocoapods/generator/acknowledgements/plist.rb +63 -0
  27. data/lib/cocoapods/generator/copy_resources_script.rb +8 -4
  28. data/lib/cocoapods/generator/documentation.rb +99 -0
  29. data/lib/cocoapods/generator/dummy_source.rb +14 -0
  30. data/lib/cocoapods/installer.rb +140 -109
  31. data/lib/cocoapods/installer/target_installer.rb +78 -83
  32. data/lib/cocoapods/installer/user_project_integrator.rb +162 -0
  33. data/lib/cocoapods/local_pod.rb +240 -0
  34. data/lib/cocoapods/platform.rb +41 -18
  35. data/lib/cocoapods/podfile.rb +234 -21
  36. data/lib/cocoapods/project.rb +67 -0
  37. data/lib/cocoapods/resolver.rb +62 -32
  38. data/lib/cocoapods/sandbox.rb +63 -0
  39. data/lib/cocoapods/source.rb +42 -20
  40. data/lib/cocoapods/specification.rb +294 -271
  41. data/lib/cocoapods/specification/set.rb +10 -28
  42. data/lib/cocoapods/specification/statistics.rb +112 -0
  43. metadata +124 -11
  44. data/lib/cocoapods/xcodeproj_pods.rb +0 -111
@@ -1,22 +1,6 @@
1
1
  module Pod
2
2
  class Specification
3
3
  class Set
4
- def self.sets
5
- @sets ||= {}
6
- end
7
-
8
- def self.by_specification_name(name)
9
- sets[name]
10
- end
11
-
12
- # This keeps an identity map of sets so that you always get the same Set
13
- # instance for the same pod directory.
14
- def self.by_pod_dir(pod_dir)
15
- set = new(pod_dir)
16
- sets[set.name] ||= set
17
- sets[set.name]
18
- end
19
-
20
4
  attr_reader :pod_dir
21
5
 
22
6
  def initialize(pod_dir)
@@ -25,6 +9,9 @@ module Pod
25
9
  end
26
10
 
27
11
  def required_by(specification)
12
+ # Skip subspecs because the can't require a different version of the top level parent
13
+ return if !specification.podfile? && specification.top_level_parent.name == name
14
+
28
15
  dependency = specification.dependency_by_top_level_spec_name(name)
29
16
  # TODO we don’t actually do anything in our Version subclass. Maybe we should just remove that.
30
17
  unless @required_by.empty? || dependency.requirement.satisfied_by?(Gem::Version.new(required_version.to_s))
@@ -37,16 +24,16 @@ module Pod
37
24
  @required_by << specification
38
25
  end
39
26
 
27
+ def specification_by_name(name)
28
+ specification.top_level_parent.subspec_by_name(name)
29
+ end
30
+
40
31
  def dependency
41
32
  @required_by.inject(Dependency.new(name)) do |previous, spec|
42
33
  previous.merge(spec.dependency_by_top_level_spec_name(name).to_top_level_spec_dependency)
43
34
  end
44
35
  end
45
36
 
46
- def only_part_of_other_pod?
47
- @required_by.all? { |spec| spec.dependency_by_top_level_spec_name(name).only_part_of_other_pod? }
48
- end
49
-
50
37
  def name
51
38
  @pod_dir.basename.to_s
52
39
  end
@@ -56,7 +43,7 @@ module Pod
56
43
  end
57
44
 
58
45
  def specification
59
- @specification ||= Specification.from_file(specification_path).tap { |spec| spec.defined_in_set = self }
46
+ @specification ||= Specification.from_file(specification_path)
60
47
  end
61
48
 
62
49
  # Return the first version that matches the current dependency.
@@ -70,7 +57,7 @@ module Pod
70
57
  end
71
58
 
72
59
  def to_s
73
- "#<#{self.class.name} for `#{name}' with required version `#{required_version}'>"
60
+ "#<#{self.class.name} for `#{name}' with required version `#{required_version}' at `#{@pod_dir}'>"
74
61
  end
75
62
  alias_method :inspect, :to_s
76
63
 
@@ -86,12 +73,11 @@ module Pod
86
73
  class External < Set
87
74
  def initialize(specification)
88
75
  @specification = specification
89
- @specification.defined_in_set = self
90
76
  @required_by = []
91
77
  end
92
78
 
93
79
  def name
94
- @specification.name
80
+ @specification.top_level_parent.name
95
81
  end
96
82
 
97
83
  def ==(other)
@@ -105,10 +91,6 @@ module Pod
105
91
  @specification = before
106
92
  end
107
93
 
108
- def only_part_of_other_pod?
109
- false
110
- end
111
-
112
94
  def specification_path
113
95
  raise "specification_path"
114
96
  end
@@ -0,0 +1,112 @@
1
+ require 'yaml'
2
+
3
+ # This is to make sure Faraday doesn't warn the user about the `system_timer` gem missing.
4
+ old_warn, $-w = $-w, nil
5
+ begin
6
+ require 'faraday'
7
+ ensure
8
+ $-w = old_warn
9
+ end
10
+ require 'octokit'
11
+
12
+ module Pod
13
+ class Specification
14
+ class Statistics
15
+
16
+ def self.instance
17
+ @instance ||= new
18
+ end
19
+
20
+ def self.instance=(instance)
21
+ @instance = instance
22
+ end
23
+
24
+ attr_accessor :cache_file, :cache_expiration
25
+
26
+ def initialize
27
+ @cache_file = Config.instance.repos_dir + 'statistics.yml'
28
+ @cache_expiration = 60 * 60 * 24 * 3
29
+ end
30
+
31
+ def creation_date(set)
32
+ compute_creation_date(set)
33
+ end
34
+
35
+ def creation_dates(sets)
36
+ dates = {}
37
+ sets.each { |set| dates[set.name] = compute_creation_date(set, false) }
38
+ save_cache
39
+ dates
40
+ end
41
+
42
+ def github_watchers(set)
43
+ github_stats_if_needed(set)
44
+ get_value(set, :gh_watchers)
45
+ end
46
+
47
+ def github_forks(set)
48
+ github_stats_if_needed(set)
49
+ get_value(set, :gh_forks)
50
+ end
51
+
52
+ def github_pushed_at(set)
53
+ github_stats_if_needed(set)
54
+ get_value(set, :pushed_at)
55
+ end
56
+
57
+ private
58
+
59
+ def cache
60
+ @cache ||= cache_file && cache_file.exist? ? YAML::load(cache_file.read) : {}
61
+ end
62
+
63
+ def get_value(set, key)
64
+ if cache[set.name] && cache[set.name][key]
65
+ cache[set.name][key]
66
+ end
67
+ end
68
+
69
+ def set_value(set, key, value)
70
+ cache[set.name] ||= {}
71
+ cache[set.name][key] = value
72
+ end
73
+
74
+ def save_cache
75
+ File.open(cache_file, 'w') { |f| f.write(YAML::dump(cache)) } if cache_file
76
+ end
77
+
78
+ def compute_creation_date(set, save = true)
79
+ date = get_value(set, :creation_date)
80
+ unless date
81
+ Dir.chdir(set.pod_dir.dirname) do
82
+ date = Time.at(`git log --first-parent --format=%ct #{set.name}`.split("\n").last.to_i)
83
+ end
84
+ set_value(set, :creation_date, date)
85
+ end
86
+ save_cache if save
87
+ date
88
+ end
89
+
90
+ def github_stats_if_needed(set)
91
+ return if get_value(set, :gh_date) && get_value(set, :gh_date) > Time.now - cache_expiration
92
+ spec = set.specification
93
+ url = spec.source.reject {|k,_| k == :commit || k == :tag }.values.first
94
+ repo_id = url[/github.com\/([^\/\.]*\/[^\/\.]*)\.*/, 1]
95
+ return unless repo_id
96
+
97
+ begin
98
+ repo = Octokit.repo(repo_id)
99
+ rescue
100
+ return
101
+ end
102
+
103
+ cache[set.name] ||= {}
104
+ set_value(set, :gh_watchers, repo['watchers'])
105
+ set_value(set, :gh_forks, repo['forks'])
106
+ set_value(set, :pushed_at, repo['pushed_at'])
107
+ set_value(set, :gh_date, Time.now)
108
+ save_cache
109
+ end
110
+ end
111
+ end
112
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 1
9
- version: 0.5.1
7
+ - 6
8
+ - 0
9
+ - rc1
10
+ version: 0.6.0.rc1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Eloy Duran
@@ -14,11 +15,11 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2012-02-22 00:00:00 +01:00
18
+ date: 2012-05-31 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: xcodeproj
22
+ name: faraday
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  requirements:
@@ -26,15 +27,113 @@ dependencies:
26
27
  - !ruby/object:Gem::Version
27
28
  segments:
28
29
  - 0
30
+ - 8
29
31
  - 1
30
- - 0
31
- version: 0.1.0
32
+ version: 0.8.1
32
33
  type: :runtime
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
35
- name: bacon
36
+ name: octokit
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 3
45
+ - 0
46
+ version: 1.3.0
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: colored
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 1
58
+ - 2
59
+ version: "1.2"
60
+ type: :runtime
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: escape
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
71
+ - 0
72
+ - 4
73
+ version: 0.0.4
74
+ type: :runtime
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: json
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 1
85
+ - 7
86
+ - 3
87
+ version: 1.7.3
88
+ type: :runtime
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
91
+ name: open4
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ segments:
98
+ - 1
99
+ - 3
100
+ - 0
101
+ version: 1.3.0
102
+ type: :runtime
103
+ version_requirements: *id006
104
+ - !ruby/object:Gem::Dependency
105
+ name: rake
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
113
+ - 9
114
+ - 0
115
+ version: 0.9.0
116
+ type: :runtime
117
+ version_requirements: *id007
118
+ - !ruby/object:Gem::Dependency
119
+ name: xcodeproj
120
+ prerelease: false
121
+ requirement: &id008 !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ segments:
126
+ - 0
127
+ - 2
128
+ - 0
129
+ - rc1
130
+ version: 0.2.0.rc1
131
+ type: :runtime
132
+ version_requirements: *id008
133
+ - !ruby/object:Gem::Dependency
134
+ name: bacon
135
+ prerelease: false
136
+ requirement: &id009 !ruby/object:Gem::Requirement
38
137
  requirements:
39
138
  - - ~>
40
139
  - !ruby/object:Gem::Version
@@ -43,7 +142,7 @@ dependencies:
43
142
  - 1
44
143
  version: "1.1"
45
144
  type: :development
46
- version_requirements: *id002
145
+ version_requirements: *id009
47
146
  description: |-
48
147
  CocoaPods manages library dependencies for your Xcode project.
49
148
 
@@ -58,8 +157,12 @@ extensions: []
58
157
  extra_rdoc_files: []
59
158
 
60
159
  files:
160
+ - lib/cocoapods/command/error_report.rb
61
161
  - lib/cocoapods/command/install.rb
62
162
  - lib/cocoapods/command/list.rb
163
+ - lib/cocoapods/command/presenter/cocoa_pod.rb
164
+ - lib/cocoapods/command/presenter.rb
165
+ - lib/cocoapods/command/push.rb
63
166
  - lib/cocoapods/command/repo.rb
64
167
  - lib/cocoapods/command/search.rb
65
168
  - lib/cocoapods/command/setup.rb
@@ -68,23 +171,33 @@ files:
68
171
  - lib/cocoapods/config.rb
69
172
  - lib/cocoapods/dependency.rb
70
173
  - lib/cocoapods/downloader/git.rb
174
+ - lib/cocoapods/downloader/http.rb
71
175
  - lib/cocoapods/downloader/mercurial.rb
72
176
  - lib/cocoapods/downloader/subversion.rb
73
177
  - lib/cocoapods/downloader.rb
74
178
  - lib/cocoapods/executable.rb
75
179
  - lib/cocoapods/file_list.rb
180
+ - lib/cocoapods/generator/acknowledgements/markdown.rb
181
+ - lib/cocoapods/generator/acknowledgements/plist.rb
182
+ - lib/cocoapods/generator/acknowledgements.rb
76
183
  - lib/cocoapods/generator/bridge_support.rb
77
184
  - lib/cocoapods/generator/copy_resources_script.rb
185
+ - lib/cocoapods/generator/documentation.rb
186
+ - lib/cocoapods/generator/dummy_source.rb
78
187
  - lib/cocoapods/installer/target_installer.rb
188
+ - lib/cocoapods/installer/user_project_integrator.rb
79
189
  - lib/cocoapods/installer.rb
190
+ - lib/cocoapods/local_pod.rb
80
191
  - lib/cocoapods/platform.rb
81
192
  - lib/cocoapods/podfile.rb
193
+ - lib/cocoapods/project.rb
82
194
  - lib/cocoapods/resolver.rb
195
+ - lib/cocoapods/sandbox.rb
83
196
  - lib/cocoapods/source.rb
84
197
  - lib/cocoapods/specification/set.rb
198
+ - lib/cocoapods/specification/statistics.rb
85
199
  - lib/cocoapods/specification.rb
86
200
  - lib/cocoapods/version.rb
87
- - lib/cocoapods/xcodeproj_pods.rb
88
201
  - lib/cocoapods.rb
89
202
  - bin/pod
90
203
  - README.md
@@ -1,111 +0,0 @@
1
- require 'xcodeproj/project'
2
-
3
- module Xcodeproj
4
- class Project
5
- # Shortcut access to the `Pods' PBXGroup.
6
- def pods
7
- groups.find { |g| g.name == 'Pods' } || groups.new({ 'name' => 'Pods' })
8
- end
9
-
10
- # Adds a group as child to the `Pods' group.
11
- def add_pod_group(name)
12
- pods.groups.new('name' => name)
13
- end
14
-
15
- # Shortcut access to build configurations
16
- def build_configurations
17
- objects[root_object.attributes['buildConfigurationList']].buildConfigurations
18
- end
19
-
20
- def build_configuration(name)
21
- build_configurations.find { |c| c.name == name }
22
- end
23
-
24
- class PBXCopyFilesBuildPhase
25
- def self.new_pod_dir(project, pod_name, path)
26
- new(project, nil, {
27
- "dstPath" => "Pods/#{path}",
28
- "name" => "Copy #{pod_name} Public Headers",
29
- })
30
- end
31
- end
32
-
33
- def self.for_platform(platform)
34
- project = Xcodeproj::Project.new
35
- project.main_group << project.groups.new({ 'name' => 'Pods' })
36
- framework = project.add_system_framework(platform == :ios ? 'Foundation' : 'Cocoa')
37
- framework.group = project.groups.new({ 'name' => 'Frameworks' })
38
- project.main_group << framework.group
39
- products = project.groups.new({ 'name' => 'Products' })
40
- project.main_group << products
41
- project.root_object.products = products
42
-
43
- project.root_object.attributes['buildConfigurationList'] = project.objects.add(Xcodeproj::Project::XCConfigurationList, {
44
- 'defaultConfigurationIsVisible' => '0',
45
- 'defaultConfigurationName' => 'Release',
46
- 'buildConfigurations' => [
47
- project.objects.add(Xcodeproj::Project::XCBuildConfiguration, {
48
- 'name' => 'Debug',
49
- 'buildSettings' => build_settings(platform, :debug)
50
- }),
51
- project.objects.add(Xcodeproj::Project::XCBuildConfiguration, {
52
- 'name' => 'Release',
53
- 'buildSettings' => build_settings(platform, :release)
54
- })
55
- ].map(&:uuid)
56
- }).uuid
57
- project
58
- end
59
-
60
- private
61
-
62
- COMMON_BUILD_SETTINGS = {
63
- :all => {
64
- 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
65
- 'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
66
- 'INSTALL_PATH' => "$(BUILT_PRODUCTS_DIR)",
67
- 'GCC_WARN_ABOUT_MISSING_PROTOTYPES' => 'YES',
68
- 'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
69
- 'GCC_WARN_UNUSED_VARIABLE' => 'YES',
70
- 'OTHER_LDFLAGS' => ''
71
- },
72
- :debug => {
73
- 'GCC_DYNAMIC_NO_PIC' => 'NO',
74
- 'GCC_PREPROCESSOR_DEFINITIONS' => ["DEBUG=1", "$(inherited)"],
75
- 'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
76
- 'GCC_OPTIMIZATION_LEVEL' => '0'
77
- },
78
- :ios => {
79
- 'ARCHS' => "$(ARCHS_STANDARD_32_BIT)",
80
- 'GCC_VERSION' => 'com.apple.compilers.llvmgcc42',
81
- 'IPHONEOS_DEPLOYMENT_TARGET' => '4.3',
82
- 'PUBLIC_HEADERS_FOLDER_PATH' => "$(TARGET_NAME)",
83
- 'SDKROOT' => 'iphoneos'
84
- },
85
- :osx => {
86
- 'ARCHS' => "$(ARCHS_STANDARD_64_BIT)",
87
- 'GCC_ENABLE_OBJC_EXCEPTIONS' => 'YES',
88
- 'GCC_WARN_64_TO_32_BIT_CONVERSION' => 'YES',
89
- 'GCC_VERSION' => 'com.apple.compilers.llvm.clang.1_0',
90
- 'MACOSX_DEPLOYMENT_TARGET' => '10.7',
91
- 'SDKROOT' => 'macosx'
92
- }
93
- }
94
-
95
- def self.build_settings(platform, scheme)
96
- settings = COMMON_BUILD_SETTINGS[:all].merge(COMMON_BUILD_SETTINGS[platform.name])
97
- settings['COPY_PHASE_STRIP'] = scheme == :debug ? 'NO' : 'YES'
98
- if platform.requires_legacy_ios_archs?
99
- settings['ARCHS'] = "armv6 armv7"
100
- end
101
- if scheme == :debug
102
- settings.merge!(COMMON_BUILD_SETTINGS[:debug])
103
- settings['ONLY_ACTIVE_ARCH'] = 'YES' if platform == :osx
104
- else
105
- settings['VALIDATE_PRODUCT'] = 'YES' if platform == :ios
106
- settings['DEBUG_INFORMATION_FORMAT'] = "dwarf-with-dsym" if platform == :osx
107
- end
108
- settings
109
- end
110
- end
111
- end