cocoapods-core 0.36.1 → 0.36.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-core/dependency.rb +2 -1
- data/lib/cocoapods-core/gem_version.rb +1 -1
- data/lib/cocoapods-core/podfile.rb +1 -1
- data/lib/cocoapods-core/specification.rb +1 -1
- data/lib/cocoapods-core/standard_error.rb +30 -9
- data/lib/cocoapods-core/vendor.rb +1 -1
- data/lib/cocoapods-core/vendor/requirement.rb +129 -50
- data/lib/cocoapods-core/vendor/version.rb +178 -154
- data/lib/cocoapods-core/version.rb +5 -1
- metadata +23 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24a08556f451a7342ca4cb8e548c95132f67c681
|
4
|
+
data.tar.gz: 2a29f49d2609e75130d3416c781a6afdecd4f572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87a763366caa4d3beb4631c605c6918819ec752a1091e3e08d880dd8464cf7af9dddf361f24c452c307ed0d7caa523c499971c911d4705115aad3f1dea3d7aa
|
7
|
+
data.tar.gz: e883638172fe09c0fd2b964d33d26678c2f239e03cdc435d5e58893737de799bba049f27223d8743452054f4ed27b477e266ce0c893b12d0ad04c38f876b8cf5
|
@@ -69,7 +69,8 @@ module Pod
|
|
69
69
|
#
|
70
70
|
def initialize(name = nil, *requirements)
|
71
71
|
if requirements.last.is_a?(Hash)
|
72
|
-
|
72
|
+
external_source = requirements.pop.select { |_, v| !v.nil? }
|
73
|
+
@external_source = external_source unless external_source.empty?
|
73
74
|
unless requirements.empty?
|
74
75
|
raise Informative, 'A dependency with an external source may not ' \
|
75
76
|
"specify version requirements (#{name})."
|
@@ -255,7 +255,7 @@ module Pod
|
|
255
255
|
# rubocop:enable Eval
|
256
256
|
rescue => e
|
257
257
|
message = "Invalid `#{path.basename}` file: #{e.message}"
|
258
|
-
raise DSLError.new(message, path, e.backtrace)
|
258
|
+
raise DSLError.new(message, path, e.backtrace, string)
|
259
259
|
end
|
260
260
|
end
|
261
261
|
podfile
|
@@ -25,10 +25,20 @@ module Pod
|
|
25
25
|
# @param [Exception] backtrace @see backtrace
|
26
26
|
# @param [String] dsl_path @see dsl_path
|
27
27
|
#
|
28
|
-
def initialize(description, dsl_path, backtrace)
|
28
|
+
def initialize(description, dsl_path, backtrace, contents = nil)
|
29
29
|
@description = description
|
30
30
|
@dsl_path = dsl_path
|
31
31
|
@backtrace = backtrace
|
32
|
+
@contents = contents
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String] the contents of the DSL that cause the exception to
|
36
|
+
# be raised.
|
37
|
+
#
|
38
|
+
def contents
|
39
|
+
@contents ||= begin
|
40
|
+
dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
# The message of the exception reports the content of podspec for the
|
@@ -50,21 +60,24 @@ module Pod
|
|
50
60
|
# @return [String] the message of the exception.
|
51
61
|
#
|
52
62
|
def message
|
53
|
-
|
63
|
+
@message ||= begin
|
64
|
+
trace_line, description = parse_line_number_from_description
|
65
|
+
|
54
66
|
m = "\n[!] "
|
55
67
|
m << description
|
56
68
|
m << ". Updating CocoaPods might fix the issue.\n"
|
57
69
|
m = m.red if m.respond_to?(:red)
|
58
70
|
|
59
|
-
return m unless backtrace && dsl_path &&
|
71
|
+
return m unless backtrace && dsl_path && contents
|
60
72
|
|
61
|
-
trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) }
|
73
|
+
trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line
|
62
74
|
return m unless trace_line
|
63
75
|
line_numer = trace_line.split(':')[1].to_i - 1
|
64
76
|
return m unless line_numer
|
65
|
-
|
77
|
+
|
78
|
+
lines = contents.lines
|
66
79
|
indent = ' # '
|
67
|
-
indicator = indent.
|
80
|
+
indicator = indent.gsub('#', '>')
|
68
81
|
first_line = (line_numer.zero?)
|
69
82
|
last_line = (line_numer == (lines.count - 1))
|
70
83
|
|
@@ -76,10 +89,18 @@ module Pod
|
|
76
89
|
m << "#{indent}#{ lines[line_numer + 1] }" unless last_line
|
77
90
|
m << "\n" unless m.end_with?("\n")
|
78
91
|
m << "#{indent}-------------------------------------------\n"
|
79
|
-
m << ''
|
80
|
-
@message = m
|
81
92
|
end
|
82
|
-
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def parse_line_number_from_description
|
98
|
+
description = self.description
|
99
|
+
if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
|
100
|
+
trace_line = Regexp.last_match[1]
|
101
|
+
description = description.sub(/#{Regexp.quote trace_line}:\s*/, '')
|
102
|
+
end
|
103
|
+
[trace_line, description]
|
83
104
|
end
|
84
105
|
end
|
85
106
|
end
|
@@ -9,7 +9,7 @@ module Pod
|
|
9
9
|
#
|
10
10
|
# E.g. https://github.com/CocoaPods/CocoaPods/issues/398
|
11
11
|
#
|
12
|
-
# The following classes are copied from RubyGems `
|
12
|
+
# The following classes are copied from RubyGems `v2.4.6`. The changes
|
13
13
|
# performed to the source files are the following:
|
14
14
|
#
|
15
15
|
# - Namespaced in `Pod::Vendor`
|
@@ -1,35 +1,49 @@
|
|
1
1
|
module Pod::Vendor
|
2
2
|
|
3
3
|
# require "rubygems/version"
|
4
|
+
# require "rubygems/deprecate"
|
5
|
+
|
6
|
+
# If we're being loaded after yaml was already required, then
|
7
|
+
# load our yaml + workarounds now.
|
8
|
+
# Gem.load_yaml if defined? ::YAML
|
4
9
|
|
5
10
|
##
|
6
11
|
# A Requirement is a set of one or more version restrictions. It supports a
|
7
12
|
# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
# [op, number] pair, and we call the list of requirements something else?
|
12
|
-
# Since a Requirement is held by a Dependency, maybe this should be made
|
13
|
-
# singular and the list aspect should be pulled up into Dependency?
|
14
|
-
|
15
|
-
# require "rubygems/version"
|
16
|
-
# require "rubygems/deprecate"
|
13
|
+
#
|
14
|
+
# See Gem::Version for a description on how versions and requirements work
|
15
|
+
# together in RubyGems.
|
17
16
|
|
18
17
|
class Gem::Requirement
|
19
|
-
include Comparable
|
20
|
-
|
21
18
|
OPS = { #:nodoc:
|
22
19
|
"=" => lambda { |v, r| v == r },
|
23
20
|
"!=" => lambda { |v, r| v != r },
|
24
|
-
">" => lambda { |v, r| v >
|
25
|
-
"<" => lambda { |v, r| v <
|
21
|
+
">" => lambda { |v, r| v > r },
|
22
|
+
"<" => lambda { |v, r| v < r },
|
26
23
|
">=" => lambda { |v, r| v >= r },
|
27
24
|
"<=" => lambda { |v, r| v <= r },
|
28
25
|
"~>" => lambda { |v, r| v >= r && v.release < r.bump }
|
29
26
|
}
|
30
27
|
|
28
|
+
SOURCE_SET_REQUIREMENT = Struct.new(:for_lockfile).new "!" # :nodoc:
|
29
|
+
|
31
30
|
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
|
32
|
-
|
31
|
+
PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
|
32
|
+
|
33
|
+
##
|
34
|
+
# A regular expression that matches a requirement
|
35
|
+
|
36
|
+
PATTERN = /\A#{PATTERN_RAW}\z/
|
37
|
+
|
38
|
+
##
|
39
|
+
# The default requirement matches any version
|
40
|
+
|
41
|
+
DefaultRequirement = [">=", Gem::Version.new(0)]
|
42
|
+
|
43
|
+
##
|
44
|
+
# Raised when a bad requirement is encountered
|
45
|
+
|
46
|
+
class BadRequirementError < ArgumentError; end
|
33
47
|
|
34
48
|
##
|
35
49
|
# Factory method to create a Gem::Requirement object. Input may be
|
@@ -38,12 +52,14 @@ module Pod::Vendor
|
|
38
52
|
# If the input is "weird", the default version requirement is
|
39
53
|
# returned.
|
40
54
|
|
41
|
-
def self.create
|
55
|
+
def self.create input
|
42
56
|
case input
|
43
57
|
when Gem::Requirement then
|
44
58
|
input
|
45
59
|
when Gem::Version, Array then
|
46
60
|
new input
|
61
|
+
when '!' then
|
62
|
+
source_set
|
47
63
|
else
|
48
64
|
if input.respond_to? :to_str then
|
49
65
|
new [input.to_str]
|
@@ -55,15 +71,18 @@ module Pod::Vendor
|
|
55
71
|
|
56
72
|
##
|
57
73
|
# A default "version requirement" can surely _only_ be '>= 0'.
|
58
|
-
#--
|
59
|
-
# This comment once said:
|
60
|
-
#
|
61
|
-
# "A default "version requirement" can surely _only_ be '> 0'."
|
62
74
|
|
63
75
|
def self.default
|
64
76
|
new '>= 0'
|
65
77
|
end
|
66
78
|
|
79
|
+
###
|
80
|
+
# A source set requirement, used for Gemfiles and lockfiles
|
81
|
+
|
82
|
+
def self.source_set # :nodoc:
|
83
|
+
SOURCE_SET_REQUIREMENT
|
84
|
+
end
|
85
|
+
|
67
86
|
##
|
68
87
|
# Parse +obj+, returning an <tt>[op, version]</tt> pair. +obj+ can
|
69
88
|
# be a String or a Gem::Version.
|
@@ -76,14 +95,18 @@ module Pod::Vendor
|
|
76
95
|
# parse("1.0") # => ["=", "1.0"]
|
77
96
|
# parse(Gem::Version.new("1.0")) # => ["=, "1.0"]
|
78
97
|
|
79
|
-
def self.parse
|
98
|
+
def self.parse obj
|
80
99
|
return ["=", obj] if Gem::Version === obj
|
81
100
|
|
82
101
|
unless PATTERN =~ obj.to_s
|
83
|
-
raise
|
102
|
+
raise BadRequirementError, "Illformed requirement [#{obj.inspect}]"
|
84
103
|
end
|
85
104
|
|
86
|
-
|
105
|
+
if $1 == ">=" && $2 == "0"
|
106
|
+
DefaultRequirement
|
107
|
+
else
|
108
|
+
[$1 || "=", Gem::Version.new($2)]
|
109
|
+
end
|
87
110
|
end
|
88
111
|
|
89
112
|
##
|
@@ -98,18 +121,62 @@ module Pod::Vendor
|
|
98
121
|
# requirements are ignored. An empty set of +requirements+ is the
|
99
122
|
# same as <tt>">= 0"</tt>.
|
100
123
|
|
101
|
-
def initialize
|
124
|
+
def initialize *requirements
|
102
125
|
requirements = requirements.flatten
|
103
126
|
requirements.compact!
|
104
127
|
requirements.uniq!
|
105
128
|
|
106
|
-
|
107
|
-
|
108
|
-
|
129
|
+
if requirements.empty?
|
130
|
+
@requirements = [DefaultRequirement]
|
131
|
+
else
|
132
|
+
@requirements = requirements.map! { |r| self.class.parse r }
|
133
|
+
end
|
109
134
|
end
|
110
135
|
|
136
|
+
##
|
137
|
+
# Concatenates the +new+ requirements onto this requirement.
|
138
|
+
|
139
|
+
def concat new
|
140
|
+
new = new.flatten
|
141
|
+
new.compact!
|
142
|
+
new.uniq!
|
143
|
+
new = new.map { |r| self.class.parse r }
|
144
|
+
|
145
|
+
@requirements.concat new
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Formats this requirement for use in a Gem::RequestSet::Lockfile.
|
150
|
+
|
151
|
+
def for_lockfile # :nodoc:
|
152
|
+
return if [DefaultRequirement] == @requirements
|
153
|
+
|
154
|
+
list = requirements.sort_by { |_, version|
|
155
|
+
version
|
156
|
+
}.map { |op, version|
|
157
|
+
"#{op} #{version}"
|
158
|
+
}.uniq
|
159
|
+
|
160
|
+
" (#{list.join ', '})"
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# true if this gem has no requirements.
|
165
|
+
|
111
166
|
def none?
|
112
|
-
@
|
167
|
+
if @requirements.size == 1
|
168
|
+
@requirements[0] == DefaultRequirement
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# true if the requirement is for only an exact version
|
176
|
+
|
177
|
+
def exact?
|
178
|
+
return false unless @requirements.size == 1
|
179
|
+
@requirements[0][0] == "="
|
113
180
|
end
|
114
181
|
|
115
182
|
def as_list # :nodoc:
|
@@ -117,7 +184,7 @@ module Pod::Vendor
|
|
117
184
|
end
|
118
185
|
|
119
186
|
def hash # :nodoc:
|
120
|
-
requirements.hash
|
187
|
+
requirements.sort.hash
|
121
188
|
end
|
122
189
|
|
123
190
|
def marshal_dump # :nodoc:
|
@@ -126,7 +193,7 @@ module Pod::Vendor
|
|
126
193
|
[@requirements]
|
127
194
|
end
|
128
195
|
|
129
|
-
def marshal_load
|
196
|
+
def marshal_load array # :nodoc:
|
130
197
|
@requirements = array[0]
|
131
198
|
|
132
199
|
fix_syck_default_key_in_requirements
|
@@ -134,36 +201,51 @@ module Pod::Vendor
|
|
134
201
|
|
135
202
|
def yaml_initialize(tag, vals) # :nodoc:
|
136
203
|
vals.each do |ivar, val|
|
137
|
-
|
138
|
-
|
204
|
+
instance_variable_set "@#{ivar}", val
|
205
|
+
end
|
139
206
|
|
207
|
+
Gem.load_yaml
|
140
208
|
fix_syck_default_key_in_requirements
|
141
209
|
end
|
142
210
|
|
143
|
-
def init_with
|
211
|
+
def init_with coder # :nodoc:
|
144
212
|
yaml_initialize coder.tag, coder.map
|
145
213
|
end
|
146
214
|
|
215
|
+
def to_yaml_properties # :nodoc:
|
216
|
+
["@requirements"]
|
217
|
+
end
|
218
|
+
|
219
|
+
def encode_with coder # :nodoc:
|
220
|
+
coder.add 'requirements', @requirements
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# A requirement is a prerelease if any of the versions inside of it
|
225
|
+
# are prereleases
|
226
|
+
|
147
227
|
def prerelease?
|
148
228
|
requirements.any? { |r| r.last.prerelease? }
|
149
229
|
end
|
150
230
|
|
151
|
-
def pretty_print
|
231
|
+
def pretty_print q # :nodoc:
|
152
232
|
q.group 1, 'Gem::Requirement.new(', ')' do
|
153
|
-
|
154
|
-
|
233
|
+
q.pp as_list
|
234
|
+
end
|
155
235
|
end
|
156
236
|
|
157
237
|
##
|
158
238
|
# True if +version+ satisfies this Requirement.
|
159
239
|
|
160
|
-
def satisfied_by?
|
240
|
+
def satisfied_by? version
|
241
|
+
raise ArgumentError, "Need a Gem::Version: #{version.inspect}" unless
|
242
|
+
Gem::Version === version
|
161
243
|
# #28965: syck has a bug with unquoted '=' YAML.loading as YAML::DefaultKey
|
162
244
|
requirements.all? { |op, rv| (OPS[op] || OPS["="]).call version, rv }
|
163
245
|
end
|
164
246
|
|
165
|
-
|
166
|
-
|
247
|
+
alias :=== :satisfied_by?
|
248
|
+
alias :=~ :satisfied_by?
|
167
249
|
|
168
250
|
##
|
169
251
|
# True if the requirement will not always match the latest version.
|
@@ -171,20 +253,20 @@ module Pod::Vendor
|
|
171
253
|
def specific?
|
172
254
|
return true if @requirements.length > 1 # GIGO, > 1, > 2 is silly
|
173
255
|
|
174
|
-
not %w
|
256
|
+
not %w[> >=].include? @requirements.first.first # grab the operator
|
175
257
|
end
|
176
258
|
|
177
259
|
def to_s # :nodoc:
|
178
260
|
as_list.join ", "
|
179
261
|
end
|
180
262
|
|
181
|
-
def
|
182
|
-
to_s
|
263
|
+
def == other # :nodoc:
|
264
|
+
Gem::Requirement === other and to_s == other.to_s
|
183
265
|
end
|
184
266
|
|
185
267
|
private
|
186
268
|
|
187
|
-
def fix_syck_default_key_in_requirements
|
269
|
+
def fix_syck_default_key_in_requirements # :nodoc:
|
188
270
|
Gem.load_yaml
|
189
271
|
|
190
272
|
# Fixup the Syck DefaultKey bug
|
@@ -196,13 +278,10 @@ module Pod::Vendor
|
|
196
278
|
end
|
197
279
|
end
|
198
280
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
# 2.0.
|
203
|
-
|
204
|
-
# ::Gem::Version::Requirement = ::Gem::Requirement
|
205
|
-
Gem::Version::Requirement = Gem::Requirement
|
206
|
-
# :startdoc:
|
281
|
+
class Gem::Version
|
282
|
+
# This is needed for compatibility with older yaml
|
283
|
+
# gemspecs.
|
207
284
|
|
285
|
+
Requirement = Gem::Requirement # :nodoc:
|
286
|
+
end
|
208
287
|
end
|
@@ -24,6 +24,11 @@ module Pod::Vendor
|
|
24
24
|
# 3. 1.0.a.2
|
25
25
|
# 4. 0.9
|
26
26
|
#
|
27
|
+
# If you want to specify a version restriction that includes both prereleases
|
28
|
+
# and regular releases of the 1.x series this is the best way:
|
29
|
+
#
|
30
|
+
# s.add_dependency 'example', '>= 1.0.0.a', '< 2.0.0'
|
31
|
+
#
|
27
32
|
# == How Software Changes
|
28
33
|
#
|
29
34
|
# Users expect to be able to specify a version constraint that gives them
|
@@ -83,8 +88,8 @@ module Pod::Vendor
|
|
83
88
|
#
|
84
89
|
# * Any "public" release of a gem should have a different version. Normally
|
85
90
|
# that means incrementing the build number. This means a developer can
|
86
|
-
# generate builds all day long
|
87
|
-
#
|
91
|
+
# generate builds all day long, but as soon as they make a public release,
|
92
|
+
# the version must be updated.
|
88
93
|
#
|
89
94
|
# === Examples
|
90
95
|
#
|
@@ -101,26 +106,25 @@ module Pod::Vendor
|
|
101
106
|
# Version 1.1.1:: Fixed a bug in the linked list implementation.
|
102
107
|
# Version 1.1.2:: Fixed a bug introduced in the last fix.
|
103
108
|
#
|
104
|
-
# Client A needs a stack with basic push/pop capability.
|
105
|
-
# original interface (no <tt>top</tt>), so
|
106
|
-
# like:
|
109
|
+
# Client A needs a stack with basic push/pop capability. They write to the
|
110
|
+
# original interface (no <tt>top</tt>), so their version constraint looks like:
|
107
111
|
#
|
108
112
|
# gem 'stack', '~> 0.0'
|
109
113
|
#
|
110
114
|
# Essentially, any version is OK with Client A. An incompatible change to
|
111
|
-
# the library will cause
|
112
|
-
# call Client A optimistic).
|
115
|
+
# the library will cause them grief, but they are willing to take the chance
|
116
|
+
# (we call Client A optimistic).
|
113
117
|
#
|
114
|
-
# Client B is just like Client A except for two things: (1)
|
115
|
-
# <tt>depth</tt> method and (2)
|
116
|
-
# incompatibilities, so
|
118
|
+
# Client B is just like Client A except for two things: (1) They use the
|
119
|
+
# <tt>depth</tt> method and (2) they are worried about future
|
120
|
+
# incompatibilities, so they write their version constraint like this:
|
117
121
|
#
|
118
122
|
# gem 'stack', '~> 0.1'
|
119
123
|
#
|
120
124
|
# The <tt>depth</tt> method was introduced in version 0.1.0, so that version
|
121
125
|
# or anything later is fine, as long as the version stays below version 1.0
|
122
126
|
# where incompatibilities are introduced. We call Client B pessimistic
|
123
|
-
# because
|
127
|
+
# because they are worried about incompatible future changes (it is OK to be
|
124
128
|
# pessimistic!).
|
125
129
|
#
|
126
130
|
# == Preventing Version Catastrophe:
|
@@ -131,8 +135,8 @@ module Pod::Vendor
|
|
131
135
|
# specify your dependency as ">= 2.0.0" then, you're good, right? What
|
132
136
|
# happens if fnord 3.0 comes out and it isn't backwards compatible
|
133
137
|
# with 2.y.z? Your stuff will break as a result of using ">=". The
|
134
|
-
# better route is to specify your dependency with an "
|
135
|
-
# specifier. They're a tad confusing, so here is how the dependency
|
138
|
+
# better route is to specify your dependency with an "approximate" version
|
139
|
+
# specifier ("~>"). They're a tad confusing, so here is how the dependency
|
136
140
|
# specifiers work:
|
137
141
|
#
|
138
142
|
# Specification From ... To (exclusive)
|
@@ -141,196 +145,216 @@ module Pod::Vendor
|
|
141
145
|
# "~> 3.0.0" 3.0.0 ... 3.1
|
142
146
|
# "~> 3.5" 3.5 ... 4.0
|
143
147
|
# "~> 3.5.0" 3.5.0 ... 3.6
|
148
|
+
# "~> 3" 3.0 ... 4.0
|
149
|
+
#
|
150
|
+
# For the last example, single-digit versions are automatically extended with
|
151
|
+
# a zero to give a sensible result.
|
144
152
|
|
145
|
-
|
146
|
-
|
147
|
-
autoload :Requirement, 'rubygems/requirement'
|
153
|
+
class Gem::Version
|
154
|
+
autoload :Requirement, 'rubygems/requirement'
|
148
155
|
|
149
|
-
|
156
|
+
include Comparable
|
150
157
|
|
151
|
-
|
152
|
-
|
158
|
+
VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
|
159
|
+
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
|
153
160
|
|
154
|
-
|
155
|
-
|
161
|
+
##
|
162
|
+
# A string representation of this Version.
|
156
163
|
|
157
|
-
|
158
|
-
|
164
|
+
def version
|
165
|
+
@version.dup
|
166
|
+
end
|
159
167
|
|
160
|
-
|
161
|
-
# True if the +version+ string matches RubyGems' requirements.
|
168
|
+
alias to_s version
|
162
169
|
|
163
|
-
|
164
|
-
|
165
|
-
|
170
|
+
##
|
171
|
+
# True if the +version+ string matches RubyGems' requirements.
|
172
|
+
|
173
|
+
def self.correct? version
|
174
|
+
version.to_s =~ ANCHORED_VERSION_PATTERN
|
175
|
+
end
|
166
176
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
177
|
+
##
|
178
|
+
# Factory method to create a Version object. Input may be a Version
|
179
|
+
# or a String. Intended to simplify client code.
|
180
|
+
#
|
181
|
+
# ver1 = Version.create('1.3.17') # -> (Version object)
|
182
|
+
# ver2 = Version.create(ver1) # -> (ver1)
|
183
|
+
# ver3 = Version.create(nil) # -> nil
|
184
|
+
|
185
|
+
def self.create input
|
186
|
+
if self === input then # check yourself before you wreck yourself
|
187
|
+
input
|
188
|
+
elsif input.nil? then
|
189
|
+
nil
|
190
|
+
else
|
191
|
+
new input
|
183
192
|
end
|
193
|
+
end
|
184
194
|
|
185
|
-
|
186
|
-
# Constructs a Version from the +version+ string. A version string is a
|
187
|
-
# series of digits or ASCII letters separated by dots.
|
195
|
+
@@all = {}
|
188
196
|
|
189
|
-
|
190
|
-
|
191
|
-
raise ArgumentError, "Malformed version number string #{version}"
|
192
|
-
end
|
197
|
+
def self.new version # :nodoc:
|
198
|
+
return super unless Gem::Version == self
|
193
199
|
|
194
|
-
|
195
|
-
|
196
|
-
end
|
200
|
+
@@all[version] ||= super
|
201
|
+
end
|
197
202
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
#
|
202
|
-
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
|
203
|
+
##
|
204
|
+
# Constructs a Version from the +version+ string. A version string is a
|
205
|
+
# series of digits or ASCII letters separated by dots.
|
203
206
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
segments.pop if segments.size > 1
|
207
|
+
def initialize version
|
208
|
+
raise ArgumentError, "Malformed version number string #{version}" unless
|
209
|
+
self.class.correct?(version)
|
208
210
|
|
209
|
-
|
210
|
-
|
211
|
-
|
211
|
+
@version = version.to_s.strip.gsub("-",".pre.")
|
212
|
+
@segments = nil
|
213
|
+
end
|
212
214
|
|
213
|
-
|
214
|
-
|
215
|
-
|
215
|
+
##
|
216
|
+
# Return a new version object where the next to the last revision
|
217
|
+
# number is one greater (e.g., 5.3.1 => 5.4).
|
218
|
+
#
|
219
|
+
# Pre-release (alpha) parts, e.g, 5.3.1.b.2 => 5.4, are ignored.
|
216
220
|
|
217
|
-
|
218
|
-
|
219
|
-
|
221
|
+
def bump
|
222
|
+
segments = self.segments.dup
|
223
|
+
segments.pop while segments.any? { |s| String === s }
|
224
|
+
segments.pop if segments.size > 1
|
220
225
|
|
221
|
-
|
222
|
-
|
223
|
-
|
226
|
+
segments[-1] = segments[-1].succ
|
227
|
+
self.class.new segments.join(".")
|
228
|
+
end
|
224
229
|
|
225
|
-
|
226
|
-
|
227
|
-
|
230
|
+
##
|
231
|
+
# A Version is only eql? to another version if it's specified to the
|
232
|
+
# same precision. Version "1.0" is not the same as version "1".
|
228
233
|
|
229
|
-
|
230
|
-
|
231
|
-
|
234
|
+
def eql? other
|
235
|
+
self.class === other and @version == other.version
|
236
|
+
end
|
232
237
|
|
233
|
-
|
234
|
-
|
235
|
-
|
238
|
+
def hash # :nodoc:
|
239
|
+
@hash ||= segments.hash
|
240
|
+
end
|
236
241
|
|
237
|
-
|
238
|
-
|
239
|
-
|
242
|
+
def init_with coder # :nodoc:
|
243
|
+
yaml_initialize coder.tag, coder.map
|
244
|
+
end
|
240
245
|
|
241
|
-
|
242
|
-
#
|
243
|
-
|
246
|
+
def inspect # :nodoc:
|
247
|
+
"#<#{self.class} #{version.inspect}>"
|
248
|
+
end
|
244
249
|
|
245
|
-
|
246
|
-
|
247
|
-
|
250
|
+
##
|
251
|
+
# Dump only the raw version string, not the complete object. It's a
|
252
|
+
# string for backwards (RubyGems 1.3.5 and earlier) compatibility.
|
248
253
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
@hash = nil
|
253
|
-
end
|
254
|
+
def marshal_dump
|
255
|
+
[version]
|
256
|
+
end
|
254
257
|
|
255
|
-
|
256
|
-
|
258
|
+
##
|
259
|
+
# Load custom marshal format. It's a string for backwards (RubyGems
|
260
|
+
# 1.3.5 and earlier) compatibility.
|
257
261
|
|
258
|
-
|
259
|
-
|
260
|
-
|
262
|
+
def marshal_load array
|
263
|
+
initialize array[0]
|
264
|
+
end
|
261
265
|
|
262
|
-
|
263
|
-
|
264
|
-
|
266
|
+
def yaml_initialize(tag, map) # :nodoc:
|
267
|
+
@version = map['version']
|
268
|
+
@segments = nil
|
269
|
+
@hash = nil
|
270
|
+
end
|
265
271
|
|
266
|
-
|
267
|
-
|
268
|
-
|
272
|
+
def to_yaml_properties # :nodoc:
|
273
|
+
["@version"]
|
274
|
+
end
|
269
275
|
|
270
|
-
|
271
|
-
|
276
|
+
def encode_with coder # :nodoc:
|
277
|
+
coder.add 'version', @version
|
278
|
+
end
|
272
279
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
280
|
+
##
|
281
|
+
# A version is considered a prerelease if it contains a letter.
|
282
|
+
|
283
|
+
def prerelease?
|
284
|
+
@prerelease ||= !!(@version =~ /[a-zA-Z]/)
|
285
|
+
end
|
277
286
|
|
278
|
-
|
287
|
+
def pretty_print q # :nodoc:
|
288
|
+
q.text "Gem::Version.new(#{version.inspect})"
|
289
|
+
end
|
279
290
|
|
280
|
-
|
281
|
-
|
291
|
+
##
|
292
|
+
# The release for this version (e.g. 1.2.0.a -> 1.2.0).
|
293
|
+
# Non-prerelease versions return themselves.
|
282
294
|
|
283
|
-
|
284
|
-
|
285
|
-
end
|
286
|
-
end
|
295
|
+
def release
|
296
|
+
return self unless prerelease?
|
287
297
|
|
288
|
-
|
289
|
-
|
298
|
+
segments = self.segments.dup
|
299
|
+
segments.pop while segments.any? { |s| String === s }
|
300
|
+
self.class.new segments.join('.')
|
301
|
+
end
|
290
302
|
|
291
|
-
|
292
|
-
segments = self.segments.dup
|
303
|
+
def segments # :nodoc:
|
293
304
|
|
294
|
-
|
295
|
-
|
296
|
-
segments.push 0 while segments.size < 2
|
305
|
+
# segments is lazy so it can pick up version values that come from
|
306
|
+
# old marshaled versions, which don't go through marshal_load.
|
297
307
|
|
298
|
-
|
308
|
+
@segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
|
309
|
+
/^\d+$/ =~ s ? s.to_i : s
|
299
310
|
end
|
311
|
+
end
|
312
|
+
|
313
|
+
##
|
314
|
+
# A recommended version for use with a ~> Requirement.
|
300
315
|
|
301
|
-
|
302
|
-
|
303
|
-
# other version is larger, the same, or smaller than this
|
304
|
-
# one. Attempts to compare to something that's not a
|
305
|
-
# <tt>Gem::Version</tt> return +nil+.
|
316
|
+
def approximate_recommendation
|
317
|
+
segments = self.segments.dup
|
306
318
|
|
307
|
-
|
308
|
-
|
309
|
-
|
319
|
+
segments.pop while segments.any? { |s| String === s }
|
320
|
+
segments.pop while segments.size > 2
|
321
|
+
segments.push 0 while segments.size < 2
|
310
322
|
|
311
|
-
|
312
|
-
|
323
|
+
"~> #{segments.join(".")}"
|
324
|
+
end
|
313
325
|
|
314
|
-
|
315
|
-
|
316
|
-
|
326
|
+
##
|
327
|
+
# Compares this version with +other+ returning -1, 0, or 1 if the
|
328
|
+
# other version is larger, the same, or smaller than this
|
329
|
+
# one. Attempts to compare to something that's not a
|
330
|
+
# <tt>Gem::Version</tt> return +nil+.
|
317
331
|
|
318
|
-
|
332
|
+
def <=> other
|
333
|
+
return unless Gem::Version === other
|
334
|
+
return 0 if @version == other.version
|
319
335
|
|
320
|
-
|
321
|
-
|
322
|
-
i += 1
|
336
|
+
lhsegments = segments
|
337
|
+
rhsegments = other.segments
|
323
338
|
|
324
|
-
|
325
|
-
|
326
|
-
|
339
|
+
lhsize = lhsegments.size
|
340
|
+
rhsize = rhsegments.size
|
341
|
+
limit = (lhsize > rhsize ? lhsize : rhsize) - 1
|
327
342
|
|
328
|
-
|
329
|
-
end
|
343
|
+
i = 0
|
330
344
|
|
331
|
-
|
345
|
+
while i <= limit
|
346
|
+
lhs, rhs = lhsegments[i] || 0, rhsegments[i] || 0
|
347
|
+
i += 1
|
348
|
+
|
349
|
+
next if lhs == rhs
|
350
|
+
return -1 if String === lhs && Numeric === rhs
|
351
|
+
return 1 if Numeric === lhs && String === rhs
|
352
|
+
|
353
|
+
return lhs <=> rhs
|
332
354
|
end
|
333
|
-
end
|
334
355
|
|
356
|
+
return 0
|
357
|
+
end
|
335
358
|
end
|
359
|
+
|
336
360
|
end
|
@@ -57,7 +57,11 @@ module Pod
|
|
57
57
|
version = Regexp.last_match[2]
|
58
58
|
@head = true
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
|
+
raise ArgumentError, "Malformed version number string #{version}" unless
|
62
|
+
self.class.correct?(version)
|
63
|
+
|
64
|
+
@version = version.to_s.strip
|
61
65
|
end
|
62
66
|
|
63
67
|
# An instance that represents version 0.
|
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.36.
|
4
|
+
version: 0.36.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,62 +9,62 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 3.2.15
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 3.2.15
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: nap
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: 0.8.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - ~>
|
39
|
+
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.8.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: fuzzy_match
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: 2.0.4
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - ~>
|
53
|
+
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 2.0.4
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: bacon
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '1.1'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.1'
|
70
70
|
description: |-
|
@@ -78,6 +78,9 @@ executables: []
|
|
78
78
|
extensions: []
|
79
79
|
extra_rdoc_files: []
|
80
80
|
files:
|
81
|
+
- LICENSE
|
82
|
+
- README.md
|
83
|
+
- lib/cocoapods-core.rb
|
81
84
|
- lib/cocoapods-core/core_ui.rb
|
82
85
|
- lib/cocoapods-core/dependency.rb
|
83
86
|
- lib/cocoapods-core/gem_version.rb
|
@@ -86,37 +89,34 @@ files:
|
|
86
89
|
- lib/cocoapods-core/lockfile.rb
|
87
90
|
- lib/cocoapods-core/metrics.rb
|
88
91
|
- lib/cocoapods-core/platform.rb
|
92
|
+
- lib/cocoapods-core/podfile.rb
|
89
93
|
- lib/cocoapods-core/podfile/dsl.rb
|
90
94
|
- lib/cocoapods-core/podfile/target_definition.rb
|
91
|
-
- lib/cocoapods-core/podfile.rb
|
92
95
|
- lib/cocoapods-core/requirement.rb
|
96
|
+
- lib/cocoapods-core/source.rb
|
93
97
|
- lib/cocoapods-core/source/acceptor.rb
|
94
98
|
- lib/cocoapods-core/source/aggregate.rb
|
95
99
|
- lib/cocoapods-core/source/health_reporter.rb
|
96
|
-
- lib/cocoapods-core/
|
100
|
+
- lib/cocoapods-core/specification.rb
|
97
101
|
- lib/cocoapods-core/specification/consumer.rb
|
102
|
+
- lib/cocoapods-core/specification/dsl.rb
|
98
103
|
- lib/cocoapods-core/specification/dsl/attribute.rb
|
99
104
|
- lib/cocoapods-core/specification/dsl/attribute_support.rb
|
100
105
|
- lib/cocoapods-core/specification/dsl/deprecations.rb
|
101
106
|
- lib/cocoapods-core/specification/dsl/platform_proxy.rb
|
102
|
-
- lib/cocoapods-core/specification/dsl.rb
|
103
107
|
- lib/cocoapods-core/specification/json.rb
|
108
|
+
- lib/cocoapods-core/specification/linter.rb
|
104
109
|
- lib/cocoapods-core/specification/linter/analyzer.rb
|
105
110
|
- lib/cocoapods-core/specification/linter/result.rb
|
106
|
-
- lib/cocoapods-core/specification/linter.rb
|
107
111
|
- lib/cocoapods-core/specification/root_attribute_accessors.rb
|
108
|
-
- lib/cocoapods-core/specification/set/presenter.rb
|
109
112
|
- lib/cocoapods-core/specification/set.rb
|
110
|
-
- lib/cocoapods-core/specification.rb
|
113
|
+
- lib/cocoapods-core/specification/set/presenter.rb
|
111
114
|
- lib/cocoapods-core/standard_error.rb
|
115
|
+
- lib/cocoapods-core/vendor.rb
|
112
116
|
- lib/cocoapods-core/vendor/requirement.rb
|
113
117
|
- lib/cocoapods-core/vendor/version.rb
|
114
|
-
- lib/cocoapods-core/vendor.rb
|
115
118
|
- lib/cocoapods-core/version.rb
|
116
119
|
- lib/cocoapods-core/yaml_helper.rb
|
117
|
-
- lib/cocoapods-core.rb
|
118
|
-
- README.md
|
119
|
-
- LICENSE
|
120
120
|
homepage: https://github.com/CocoaPods/CocoaPods
|
121
121
|
licenses:
|
122
122
|
- MIT
|
@@ -127,17 +127,17 @@ require_paths:
|
|
127
127
|
- lib
|
128
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 2.0.0
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.4.6
|
141
141
|
signing_key:
|
142
142
|
specification_version: 3
|
143
143
|
summary: The models of CocoaPods
|