cocoapods-core 0.17.0.rc2 → 0.17.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/lockfile.rb +6 -0
- data/lib/cocoapods-core/podfile/target_definition.rb +65 -16
- data/lib/cocoapods-core/podfile.rb +5 -4
- data/lib/cocoapods-core/source.rb +17 -3
- data/lib/cocoapods-core/specification/consumer.rb +7 -1
- data/lib/cocoapods-core/specification/set.rb +53 -10
- data/lib/cocoapods-core/specification.rb +1 -1
- data/lib/cocoapods-core.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fe88a6f9588e89807e637665aaa1e67f6c1b1dc
|
4
|
+
data.tar.gz: 87c2e36c0d9f900e0b812a5fa2d31f5d8c5e8aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274290c605f8e34c8dd2aebaa8e5cf3b87ae49f53c0e8a922ee475d65e7e65091d4d064fc54d53e6a57b5aef6f9382722ffc586f01ea45201f5bd090e48894df
|
7
|
+
data.tar.gz: 908d53de3c53997e9e2d249a06104888468469f32144880cfb188387aab1a51cfdfcc1939e65ee67b181bb61376df3cc0a9e8f12082399516fdd5b0ebb4697c0
|
@@ -53,6 +53,12 @@ module Pod
|
|
53
53
|
#
|
54
54
|
attr_accessor :defined_in_file
|
55
55
|
|
56
|
+
# @return [Bool] Whether the Podfiles are equal.
|
57
|
+
#
|
58
|
+
def ==(other)
|
59
|
+
other && self.to_hash == other.to_hash
|
60
|
+
end
|
61
|
+
|
56
62
|
# @return [String] a string representation suitable for UI output.
|
57
63
|
#
|
58
64
|
def to_s
|
@@ -10,10 +10,6 @@ module Pod
|
|
10
10
|
#
|
11
11
|
class TargetDefinition
|
12
12
|
|
13
|
-
# @return [String, Symbol] the name of the target definition.
|
14
|
-
#
|
15
|
-
attr_reader :name
|
16
|
-
|
17
13
|
# @return [TargetDefinition, Podfile] the parent target definition or the
|
18
14
|
# Podfile if the receiver is root.
|
19
15
|
#
|
@@ -28,12 +24,14 @@ module Pod
|
|
28
24
|
# @option options [Bool] :exclusive
|
29
25
|
# @see exclusive?
|
30
26
|
#
|
31
|
-
def initialize(name, parent, internal_hash =
|
32
|
-
@
|
27
|
+
def initialize(name, parent, internal_hash = nil)
|
28
|
+
@internal_hash = internal_hash || {}
|
33
29
|
@parent = parent
|
34
|
-
@internal_hash = internal_hash
|
35
30
|
@children = []
|
36
31
|
|
32
|
+
unless internal_hash
|
33
|
+
self.name = name
|
34
|
+
end
|
37
35
|
if parent.is_a?(TargetDefinition)
|
38
36
|
parent.children << self
|
39
37
|
end
|
@@ -98,7 +96,7 @@ module Pod
|
|
98
96
|
# name.
|
99
97
|
#
|
100
98
|
def label
|
101
|
-
if root? && name ==
|
99
|
+
if root? && name == "Pods"
|
102
100
|
"Pods"
|
103
101
|
elsif exclusive? || parent.nil?
|
104
102
|
"Pods-#{name}"
|
@@ -125,6 +123,27 @@ module Pod
|
|
125
123
|
|
126
124
|
# @!group Attributes
|
127
125
|
|
126
|
+
# @return [String] the path of the project this target definition should
|
127
|
+
# link with.
|
128
|
+
#
|
129
|
+
def name
|
130
|
+
get_hash_value('name')
|
131
|
+
end
|
132
|
+
|
133
|
+
# Sets the path of the user project this target definition should link
|
134
|
+
# with.
|
135
|
+
#
|
136
|
+
# @param [String] path
|
137
|
+
# The path of the project.
|
138
|
+
#
|
139
|
+
# @return [void]
|
140
|
+
#
|
141
|
+
def name=(name)
|
142
|
+
set_hash_value('name', name)
|
143
|
+
end
|
144
|
+
|
145
|
+
#--------------------------------------#
|
146
|
+
|
128
147
|
# Returns whether the target definition should inherit the dependencies
|
129
148
|
# of the parent.
|
130
149
|
#
|
@@ -156,11 +175,12 @@ module Pod
|
|
156
175
|
|
157
176
|
#--------------------------------------#
|
158
177
|
|
159
|
-
# @return [Array<String>]
|
178
|
+
# @return [Array<String>] The list of the names of the Xcode targets with
|
160
179
|
# which this target definition should be linked with.
|
161
180
|
#
|
162
181
|
def link_with
|
163
|
-
get_hash_value('link_with')
|
182
|
+
value = get_hash_value('link_with')
|
183
|
+
value unless value.nil? || value.empty?
|
164
184
|
end
|
165
185
|
|
166
186
|
# Sets the client targets that should be integrated by this definition.
|
@@ -176,6 +196,33 @@ module Pod
|
|
176
196
|
|
177
197
|
#--------------------------------------#
|
178
198
|
|
199
|
+
# Returns whether the target definition should link with the first target
|
200
|
+
# of the project.
|
201
|
+
#
|
202
|
+
# @note This option is ignored if {link_with} is set.
|
203
|
+
#
|
204
|
+
# @return [Bool] whether is exclusive.
|
205
|
+
#
|
206
|
+
def link_with_first_target?
|
207
|
+
get_hash_value('link_with_first_target') unless link_with
|
208
|
+
end
|
209
|
+
|
210
|
+
# Sets whether the target definition should link with the first target of
|
211
|
+
# the project.
|
212
|
+
#
|
213
|
+
# @note This option is ignored if {link_with} is set.
|
214
|
+
#
|
215
|
+
# @param [Bool] flag
|
216
|
+
# Whether the definition should link with the first target.
|
217
|
+
#
|
218
|
+
# @return [void]
|
219
|
+
#
|
220
|
+
def link_with_first_target=(flag)
|
221
|
+
set_hash_value('link_with_first_target', flag)
|
222
|
+
end
|
223
|
+
|
224
|
+
#--------------------------------------#
|
225
|
+
|
179
226
|
# @return [String] the path of the project this target definition should
|
180
227
|
# link with.
|
181
228
|
#
|
@@ -357,10 +404,12 @@ module Pod
|
|
357
404
|
# target definition.
|
358
405
|
#
|
359
406
|
HASH_KEYS = [
|
407
|
+
'name',
|
360
408
|
'platform',
|
361
409
|
'podspecs',
|
362
410
|
'exclusive',
|
363
411
|
'link_with',
|
412
|
+
'link_with_first_target',
|
364
413
|
'inhibit_all_warnings',
|
365
414
|
'user_project_path',
|
366
415
|
'build_configurations',
|
@@ -373,7 +422,7 @@ module Pod
|
|
373
422
|
def to_hash
|
374
423
|
hash = internal_hash.dup
|
375
424
|
unless children.empty?
|
376
|
-
hash['children'] =
|
425
|
+
hash['children'] = children.map(&:to_hash)
|
377
426
|
end
|
378
427
|
hash
|
379
428
|
end
|
@@ -385,12 +434,12 @@ module Pod
|
|
385
434
|
#
|
386
435
|
# @return [TargetDefinition] the new target definition
|
387
436
|
#
|
388
|
-
def self.from_hash(
|
437
|
+
def self.from_hash(hash, parent)
|
389
438
|
internal_hash = hash.dup
|
390
|
-
children_hashes = internal_hash.delete('children') ||
|
391
|
-
definition = TargetDefinition.new(
|
392
|
-
children_hashes.each do |
|
393
|
-
TargetDefinition.from_hash(
|
439
|
+
children_hashes = internal_hash.delete('children') || []
|
440
|
+
definition = TargetDefinition.new(nil, parent, internal_hash)
|
441
|
+
children_hashes.each do |child_hash|
|
442
|
+
TargetDefinition.from_hash(child_hash, definition)
|
394
443
|
end
|
395
444
|
definition
|
396
445
|
end
|
@@ -46,7 +46,8 @@ module Pod
|
|
46
46
|
self.defined_in_file = defined_in_file
|
47
47
|
@internal_hash = internal_hash
|
48
48
|
if block
|
49
|
-
default_target_def = TargetDefinition.new(
|
49
|
+
default_target_def = TargetDefinition.new("Pods", self)
|
50
|
+
default_target_def.link_with_first_target = true
|
50
51
|
@root_target_definitions = [default_target_def]
|
51
52
|
@current_target_definition = default_target_def
|
52
53
|
instance_eval(&block)
|
@@ -182,7 +183,7 @@ module Pod
|
|
182
183
|
#
|
183
184
|
def to_hash
|
184
185
|
hash = {}
|
185
|
-
hash['target_definitions'] =
|
186
|
+
hash['target_definitions'] = root_target_definitions.map(&:to_hash)
|
186
187
|
hash.merge!(internal_hash)
|
187
188
|
hash
|
188
189
|
end
|
@@ -262,8 +263,8 @@ module Pod
|
|
262
263
|
internal_hash = hash.dup
|
263
264
|
target_definitions = internal_hash.delete('target_definitions') || []
|
264
265
|
podfile = Podfile.new(path,internal_hash)
|
265
|
-
target_definitions.each do |
|
266
|
-
definition = TargetDefinition.from_hash(
|
266
|
+
target_definitions.each do |definition_hash|
|
267
|
+
definition = TargetDefinition.from_hash(definition_hash, podfile)
|
267
268
|
podfile.root_target_definitions << definition
|
268
269
|
end
|
269
270
|
podfile
|
@@ -44,7 +44,7 @@ module Pod
|
|
44
44
|
name <=> other.name
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
#-------------------------------------------------------------------------#
|
48
48
|
|
49
49
|
# @!group Queering the source
|
50
50
|
|
@@ -79,19 +79,33 @@ module Pod
|
|
79
79
|
|
80
80
|
# @return [Specification] the specification for a given version of Pod.
|
81
81
|
#
|
82
|
+
# @param @see specification_path
|
83
|
+
#
|
84
|
+
def specification(name, version)
|
85
|
+
Specification.from_file(specification_path(name, version))
|
86
|
+
end
|
87
|
+
|
88
|
+
# Returns the path of the specification with the given name and version.
|
89
|
+
#
|
82
90
|
# @param [String] name
|
83
91
|
# the name of the Pod.
|
84
92
|
#
|
85
93
|
# @param [Version,String] version
|
86
94
|
# the version for the specification.
|
87
95
|
#
|
88
|
-
|
96
|
+
# @return [Pathname] The path of the specification.
|
97
|
+
#
|
98
|
+
def specification_path(name, version)
|
89
99
|
path = repo + name + version.to_s
|
90
100
|
specification_path = path + "#{name}.podspec.yaml"
|
91
101
|
unless specification_path.exist?
|
92
102
|
specification_path = path + "#{name}.podspec"
|
93
103
|
end
|
94
|
-
|
104
|
+
unless specification_path.exist?
|
105
|
+
raise StandardError, "Unable to find the specification #{name} " \
|
106
|
+
"(#{version}) in the #{name} source."
|
107
|
+
end
|
108
|
+
specification_path
|
95
109
|
end
|
96
110
|
|
97
111
|
# @return [Array<Specification>] all the specifications contained by the
|
@@ -144,7 +144,13 @@ module Pod
|
|
144
144
|
def dependencies
|
145
145
|
value = value_for_attribute(:dependencies)
|
146
146
|
value.map do |name, requirements|
|
147
|
-
|
147
|
+
if Array(requirements).all?{ |req| req.is_a?(String) }
|
148
|
+
Dependency.new(name, requirements)
|
149
|
+
else
|
150
|
+
raise Informative, "Unsupported parameters for `#{name}` " \
|
151
|
+
"dependency `#{requirements.to_s}` in #{spec}.\n" \
|
152
|
+
"Specifications don't support external sources"
|
153
|
+
end
|
148
154
|
end
|
149
155
|
end
|
150
156
|
|
@@ -54,7 +54,8 @@ module Pod
|
|
54
54
|
# @raise If the versions requirement of the dependency are not
|
55
55
|
# compatible with the previously stored dependencies.
|
56
56
|
#
|
57
|
-
# @todo This should simply return a boolean. Is
|
57
|
+
# @todo This should simply return a boolean. Is CocoaPods that should
|
58
|
+
# raise.
|
58
59
|
#
|
59
60
|
# @return [void]
|
60
61
|
#
|
@@ -84,13 +85,16 @@ module Pod
|
|
84
85
|
# used to disambiguate.
|
85
86
|
#
|
86
87
|
def specification
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
88
|
+
@specification ||= Specification.from_file(specification_path_for_version(required_version))
|
89
|
+
end
|
90
|
+
|
91
|
+
def specification_path_for_version(version)
|
92
|
+
sources = []
|
93
|
+
versions_by_source.each do |source, source_versions|
|
94
|
+
sources << source if source_versions.include?(required_version)
|
92
95
|
end
|
93
|
-
|
96
|
+
source = sources.sort_by(&:name).first
|
97
|
+
source.specification_path(name, required_version)
|
94
98
|
end
|
95
99
|
|
96
100
|
# @return [Version] the highest version that satisfies the stored
|
@@ -99,8 +103,12 @@ module Pod
|
|
99
103
|
# @todo This should simply return nil. CocoaPods should raise instead.
|
100
104
|
#
|
101
105
|
def required_version
|
102
|
-
versions.find { |v| dependency.match?(name, v) }
|
103
|
-
|
106
|
+
version = versions.find { |v| dependency.match?(name, v) }
|
107
|
+
unless version
|
108
|
+
raise StandardError, "Required version (#{dependency}) not found " \
|
109
|
+
"for `#{name}`.\nAvailable versions: #{versions.join(', ')}"
|
110
|
+
end
|
111
|
+
version
|
104
112
|
end
|
105
113
|
|
106
114
|
# @return [Array<Version>] all the available versions for the Pod, sorted
|
@@ -110,6 +118,18 @@ module Pod
|
|
110
118
|
versions_by_source.values.flatten.uniq.sort.reverse
|
111
119
|
end
|
112
120
|
|
121
|
+
# @return [Version] The highest version known of the specification.
|
122
|
+
#
|
123
|
+
def highest_version
|
124
|
+
versions.first
|
125
|
+
end
|
126
|
+
|
127
|
+
# @return [Pathname] The path of the highest version.
|
128
|
+
#
|
129
|
+
def highest_version_spec_path
|
130
|
+
specification_path_for_version(highest_version)
|
131
|
+
end
|
132
|
+
|
113
133
|
# @return [Hash{Source => Version}] all the available versions for the
|
114
134
|
# Pod grouped by source.
|
115
135
|
#
|
@@ -130,7 +150,30 @@ module Pod
|
|
130
150
|
end
|
131
151
|
alias_method :inspect, :to_s
|
132
152
|
|
133
|
-
|
153
|
+
# Returns a hash representation of the set composed by dumb data types.
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
#
|
157
|
+
# "name" => "CocoaLumberjack",
|
158
|
+
# "versions" => { "master" => [ "1.6", "1.3.3"] },
|
159
|
+
# "highest_version" => "1.6",
|
160
|
+
# "highest_version_spec" => 'REPO/CocoaLumberjack/1.6/CocoaLumberjack.podspec'
|
161
|
+
#
|
162
|
+
# @return [Hash] The hash representation.
|
163
|
+
#
|
164
|
+
def to_hash
|
165
|
+
versions = versions_by_source.inject({}) do |memo, (source, version)|
|
166
|
+
memo[source.name] = version.map(&:to_s); memo
|
167
|
+
end
|
168
|
+
{
|
169
|
+
'name' => name,
|
170
|
+
'versions' => versions,
|
171
|
+
'highest_version' => highest_version.to_s,
|
172
|
+
'highest_version_spec' => highest_version_spec_path.to_s
|
173
|
+
}
|
174
|
+
end
|
175
|
+
|
176
|
+
#-----------------------------------------------------------------------#
|
134
177
|
|
135
178
|
# The Set::External class handles Pods from external sources. Pods from
|
136
179
|
# external sources don't use the {Source} and are initialized by a given
|
data/lib/cocoapods-core.rb
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
module Pod
|
4
4
|
require 'cocoapods-core/gem_version'
|
5
5
|
|
6
|
+
# Indicates a runtime error **not** caused by a bug.
|
7
|
+
#
|
8
|
+
class PlainInformative < StandardError; end
|
9
|
+
|
10
|
+
# Indicates an user error.
|
11
|
+
#
|
12
|
+
class Informative < PlainInformative; end
|
13
|
+
|
6
14
|
require 'pathname'
|
7
15
|
require 'cocoapods-core/vendor'
|
8
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.17.0.
|
4
|
+
version: 0.17.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|