solve 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/LICENSE +1 -1
- data/README.md +3 -6
- data/lib/solve.rb +1 -1
- data/lib/solve/artifact.rb +1 -1
- data/lib/solve/constraint.rb +36 -22
- data/lib/solve/demand.rb +1 -1
- data/lib/solve/dependency.rb +1 -1
- data/lib/solve/errors.rb +1 -1
- data/lib/solve/gem_version.rb +1 -1
- data/lib/solve/graph.rb +1 -1
- data/lib/solve/solver.rb +3 -2
- data/lib/solve/solver/constraint_row.rb +2 -2
- data/lib/solve/solver/constraint_table.rb +2 -2
- data/lib/solve/solver/variable_row.rb +2 -2
- data/lib/solve/solver/variable_table.rb +2 -2
- data/lib/solve/version.rb +10 -4
- data/solve.gemspec +2 -2
- data/spec/unit/solve/constraint_spec.rb +194 -20
- data/spec/unit/solve/version_spec.rb +12 -0
- metadata +8 -8
- data/.rbenv-version +0 -2
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p392
|
data/LICENSE
CHANGED
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
187
187
|
identification within third-party archives.
|
188
188
|
|
189
|
-
Copyright
|
189
|
+
Copyright 2012-2013 Riot Games
|
190
190
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
192
192
|
you may not use this file except in compliance with the License.
|
data/README.md
CHANGED
@@ -39,9 +39,6 @@ And now solve the graph with some demands
|
|
39
39
|
|
40
40
|
## Authors
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
## Contributors
|
46
|
-
|
47
|
-
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg))
|
42
|
+
* [Jamie Winsor](https://github.com/reset) (<reset@riotgames.com>)
|
43
|
+
* [Andrew Garson](andrewGarson) (<agarson@riotgames.com>)
|
44
|
+
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](http://twitter.com/thibaudgg))
|
data/lib/solve.rb
CHANGED
data/lib/solve/artifact.rb
CHANGED
data/lib/solve/constraint.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Solve
|
2
|
-
# @author Jamie Winsor <
|
2
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
3
3
|
# @author Thibaud Guillaume-Gentil <thibaud@thibaud.me>
|
4
4
|
class Constraint
|
5
5
|
class << self
|
@@ -12,7 +12,7 @@ module Solve
|
|
12
12
|
# If the given string does not contain a valid version string then
|
13
13
|
# nil will be returned.
|
14
14
|
#
|
15
|
-
# @param [#to_s]
|
15
|
+
# @param [#to_s] constraint
|
16
16
|
#
|
17
17
|
# @example splitting a string with a constraint operator and valid version string
|
18
18
|
# Constraint.split(">= 1.0.0") => [ ">=", "1.0.0" ]
|
@@ -24,17 +24,32 @@ module Solve
|
|
24
24
|
# Constraint.split("hello") => nil
|
25
25
|
#
|
26
26
|
# @return [Array, nil]
|
27
|
-
def split(
|
28
|
-
if
|
29
|
-
|
30
|
-
|
27
|
+
def split(constraint)
|
28
|
+
if constraint =~ /^[0-9]/
|
29
|
+
operator = "="
|
30
|
+
version = constraint
|
31
31
|
else
|
32
|
-
_,
|
32
|
+
_, operator, version = REGEXP.match(constraint).to_a
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
if operator.nil?
|
36
|
+
raise Errors::InvalidConstraintFormat.new(constraint)
|
37
|
+
end
|
38
|
+
|
39
|
+
split_version = case version.to_s
|
40
|
+
when /^(\d+)\.(\d+)\.(\d+)(-([0-9a-z\-\.]+))?(\+([0-9a-z\-\.]+))?$/i
|
41
|
+
[ $1.to_i, $2.to_i, $3.to_i, $5, $7 ]
|
42
|
+
when /^(\d+)\.(\d+)\.(\d+)?$/
|
43
|
+
[ $1.to_i, $2.to_i, $3.to_i, nil, nil ]
|
44
|
+
when /^(\d+)\.(\d+)?$/
|
45
|
+
[ $1.to_i, $2.to_i, nil, nil, nil ]
|
46
|
+
when /^(\d+)$/
|
47
|
+
[ $1.to_i, nil, nil, nil, nil ]
|
48
|
+
else
|
49
|
+
raise Errors::InvalidConstraintFormat.new(constraint)
|
50
|
+
end
|
36
51
|
|
37
|
-
[
|
52
|
+
[ operator, split_version ].flatten
|
38
53
|
end
|
39
54
|
|
40
55
|
# @param [Solve::Constraint] constraint
|
@@ -83,18 +98,18 @@ module Solve
|
|
83
98
|
# @return [Boolean]
|
84
99
|
def compare_aprox(constraint, target_version)
|
85
100
|
min = constraint.version
|
86
|
-
if constraint.patch
|
87
|
-
|
101
|
+
max = if constraint.patch.nil?
|
102
|
+
Version.new([min.major + 1, 0, 0, 0])
|
88
103
|
elsif constraint.build
|
89
104
|
identifiers = constraint.version.identifiers(:build)
|
90
|
-
replace
|
91
|
-
|
105
|
+
replace = identifiers.last.to_i.to_s == identifiers.last.to_s ? "-" : nil
|
106
|
+
Version.new([min.major, min.minor, min.patch, min.pre_release, identifiers.fill(replace, -1).join('.')])
|
92
107
|
elsif constraint.pre_release
|
93
108
|
identifiers = constraint.version.identifiers(:pre_release)
|
94
|
-
replace
|
95
|
-
|
109
|
+
replace = identifiers.last.to_i.to_s == identifiers.last.to_s ? "-" : nil
|
110
|
+
Version.new([min.major, min.minor, min.patch, identifiers.fill(replace, -1).join('.')])
|
96
111
|
else
|
97
|
-
|
112
|
+
Version.new([min.major, min.minor + 1, 0, 0])
|
98
113
|
end
|
99
114
|
min <= target_version && target_version < max
|
100
115
|
end
|
@@ -125,12 +140,7 @@ module Solve
|
|
125
140
|
constraint = ">= 0.0.0"
|
126
141
|
end
|
127
142
|
|
128
|
-
@operator,
|
129
|
-
if @operator.nil? || ver_str.nil?
|
130
|
-
raise Errors::InvalidConstraintFormat.new(constraint)
|
131
|
-
end
|
132
|
-
|
133
|
-
@major, @minor, @patch, @pre_release, @build = Version.split(ver_str)
|
143
|
+
@operator, @major, @minor, @patch, @pre_release, @build = self.class.split(constraint)
|
134
144
|
@compare_fun = OPERATORS.fetch(self.operator)
|
135
145
|
end
|
136
146
|
|
@@ -159,6 +169,10 @@ module Solve
|
|
159
169
|
def satisfies?(target_version)
|
160
170
|
target_version = Version.new(target_version.to_s)
|
161
171
|
|
172
|
+
if target_version.pre_release? && !version.pre_release?
|
173
|
+
return false
|
174
|
+
end
|
175
|
+
|
162
176
|
@compare_fun.call(self, target_version)
|
163
177
|
end
|
164
178
|
|
data/lib/solve/demand.rb
CHANGED
data/lib/solve/dependency.rb
CHANGED
data/lib/solve/errors.rb
CHANGED
data/lib/solve/gem_version.rb
CHANGED
data/lib/solve/graph.rb
CHANGED
data/lib/solve/solver.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Solve
|
2
|
-
# @author Jamie Winsor <
|
2
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
3
|
+
# @author Andrew Garson <agarson@riotgames.com>
|
3
4
|
class Solver
|
4
5
|
autoload :VariableTable, 'solve/solver/variable_table'
|
5
6
|
autoload :VariableRow, 'solve/solver/variable_row'
|
@@ -101,7 +102,7 @@ module Solve
|
|
101
102
|
trace("\t#{constraint}")
|
102
103
|
end
|
103
104
|
trace("Possible values are #{possible_values_for_unbound}")
|
104
|
-
|
105
|
+
|
105
106
|
while possible_value = possible_values_for_unbound.shift
|
106
107
|
possible_artifact = graph.get_artifact(unbound_variable.artifact, possible_value.version)
|
107
108
|
possible_dependencies = possible_artifact.dependencies
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Solve
|
2
2
|
class Solver
|
3
|
-
# @author Andrew Garson <
|
4
|
-
# @author Jamie Winsor <
|
3
|
+
# @author Andrew Garson <agarson@riotgames.com>
|
4
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
5
5
|
class ConstraintRow
|
6
6
|
extend Forwardable
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Solve
|
2
2
|
class Solver
|
3
|
-
# @author Andrew Garson <
|
4
|
-
# @author Jamie Winsor <
|
3
|
+
# @author Andrew Garson <agarson@riotgames.com>
|
4
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
5
5
|
class ConstraintTable
|
6
6
|
attr_reader :rows
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Solve
|
2
2
|
class Solver
|
3
|
-
# @author Andrew Garson <
|
4
|
-
# @author Jamie Winsor <
|
3
|
+
# @author Andrew Garson <agarson@riotgames.com>
|
4
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
5
5
|
class VariableRow
|
6
6
|
attr_reader :artifact
|
7
7
|
attr_reader :value
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Solve
|
2
2
|
class Solver
|
3
|
-
# @author Andrew Garson <
|
4
|
-
# @author Jamie Winsor <
|
3
|
+
# @author Andrew Garson <agarson@riotgames.com>
|
4
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
5
5
|
class VariableTable
|
6
6
|
attr_reader :rows
|
7
7
|
|
data/lib/solve/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Solve
|
2
|
-
# @author Jamie Winsor <
|
2
|
+
# @author Jamie Winsor <reset@riotgames.com>
|
3
3
|
# @author Thibaud Guillaume-Gentil <thibaud@thibaud.me>
|
4
4
|
class Version
|
5
5
|
class << self
|
@@ -57,9 +57,11 @@ module Solve
|
|
57
57
|
@major, @minor, @patch, @pre_release, @build = self.class.split(args.first.to_s)
|
58
58
|
end
|
59
59
|
|
60
|
-
@major
|
61
|
-
@minor
|
62
|
-
@patch
|
60
|
+
@major ||= 0
|
61
|
+
@minor ||= 0
|
62
|
+
@patch ||= 0
|
63
|
+
@pre_release ||= nil
|
64
|
+
@build ||= nil
|
63
65
|
end
|
64
66
|
|
65
67
|
# @param [Solve::Version] other
|
@@ -89,6 +91,10 @@ module Solve
|
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
94
|
+
def pre_release?
|
95
|
+
!!pre_release
|
96
|
+
end
|
97
|
+
|
92
98
|
# @return [Integer]
|
93
99
|
def pre_release_and_build_presence_score
|
94
100
|
pre_release ? 0 : (build.nil? ? 1 : 2)
|
data/solve.gemspec
CHANGED
@@ -3,10 +3,10 @@ require File.expand_path('../lib/solve/gem_version', __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.authors = ["Jamie Winsor", "Andrew Garson", "Thibaud Guillaume-Gentil"]
|
6
|
-
s.email = ["
|
6
|
+
s.email = ["reset@riotgames.com", "agarson@riotgames.com", "thibaud@thibaud.me"]
|
7
7
|
s.description = %q{A Ruby version constraint solver}
|
8
8
|
s.summary = %q{A Ruby version constraint solver implementing Semantic Versioning 2.0.0-rc.1}
|
9
|
-
s.homepage = "https://github.com/
|
9
|
+
s.homepage = "https://github.com/RiotGames/solve"
|
10
10
|
s.license = "Apache 2.0"
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split($\)
|
@@ -49,49 +49,205 @@ describe Solve::Constraint do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
context "given a
|
53
|
-
it "
|
54
|
-
|
55
|
-
subject.new(nil)
|
56
|
-
}.should raise_error(Solve::Errors::InvalidConstraintFormat)
|
52
|
+
context "given a constraint that does not include a minor version" do
|
53
|
+
it "has a nil value for minor" do
|
54
|
+
subject.new(">= 1").minor.should be_nil
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
60
|
-
context "given a
|
58
|
+
context "given a constraint that does not include a patch version" do
|
61
59
|
it "has a nil value for patch" do
|
62
60
|
subject.new("~> 1.2").patch.should be_nil
|
63
61
|
end
|
64
62
|
end
|
63
|
+
|
64
|
+
context "given a constraint that does not include a build version" do
|
65
|
+
it "has a nil value for build" do
|
66
|
+
subject.new(">= 1.2.3-alpha").build.should be_nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "given a constraint that does not include a pre release version" do
|
71
|
+
it "has a nil value for pre release" do
|
72
|
+
subject.new(">= 1.2.3+build").pre_release.should be_nil
|
73
|
+
end
|
74
|
+
end
|
65
75
|
end
|
66
76
|
|
67
77
|
describe "::split" do
|
68
|
-
|
69
|
-
|
78
|
+
let(:constraint_string) { nil }
|
79
|
+
|
80
|
+
subject { described_class.split(constraint_string) }
|
81
|
+
|
82
|
+
context "given a constraint containing the elements (operator, major, minor, patch, pre_release, build)" do
|
83
|
+
let(:constraint_string) { ">= 1.2.3-alpha+build" }
|
84
|
+
|
85
|
+
it "returns an array with the constraint operator at index 0" do
|
86
|
+
subject[0].should eql(">=")
|
87
|
+
end
|
88
|
+
|
89
|
+
it "returns an array with the major version in index 1" do
|
90
|
+
subject[1].should eql(1)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "returns an array with the minor version at index 2" do
|
94
|
+
subject[2].should eql(2)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "returns an array with the patch version at index 3" do
|
98
|
+
subject[3].should eql(3)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "returns an array with the pre release version at index 4" do
|
102
|
+
subject[4].should eql("alpha")
|
103
|
+
end
|
104
|
+
|
105
|
+
it "returns an array with the build version at index 5" do
|
106
|
+
subject[5].should eql("build")
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context "given a constraint containing the elements (operator, major, minor, patch, pre_release)" do
|
111
|
+
let(:constraint_string) { ">= 1.2.3-alpha" }
|
112
|
+
|
113
|
+
it "returns an array with the constraint operator at index 0" do
|
114
|
+
subject[0].should eql(">=")
|
115
|
+
end
|
116
|
+
|
117
|
+
it "returns an array with the major version in index 1" do
|
118
|
+
subject[1].should eql(1)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "returns an array with the minor version at index 2" do
|
122
|
+
subject[2].should eql(2)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "returns an array with the patch version at index 3" do
|
126
|
+
subject[3].should eql(3)
|
127
|
+
end
|
128
|
+
|
129
|
+
it "returns an array with the pre release version at index 4" do
|
130
|
+
subject[4].should eql("alpha")
|
131
|
+
end
|
132
|
+
|
133
|
+
it "returns an array with a nil value at index 5" do
|
134
|
+
subject[5].should be_nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context "given a constraint containing the elements (operator, major, minor, patch)" do
|
139
|
+
let(:constraint_string) { ">= 1.2.3" }
|
140
|
+
|
141
|
+
it "returns an array with the constraint operator at index 0" do
|
142
|
+
subject[0].should eql(">=")
|
143
|
+
end
|
144
|
+
|
145
|
+
it "returns an array with the major version in index 1" do
|
146
|
+
subject[1].should eql(1)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "returns an array with the minor version at index 2" do
|
150
|
+
subject[2].should eql(2)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "returns an array with the patch version at index 3" do
|
154
|
+
subject[3].should eql(3)
|
155
|
+
end
|
156
|
+
|
157
|
+
it "returns an array with a nil value at index 4" do
|
158
|
+
subject[4].should be_nil
|
159
|
+
end
|
160
|
+
|
161
|
+
it "returns an array with a nil value at index 5" do
|
162
|
+
subject[5].should be_nil
|
163
|
+
end
|
70
164
|
end
|
71
165
|
|
72
|
-
|
73
|
-
|
166
|
+
context "given a constraint containing the elements (operator, major, minor)" do
|
167
|
+
let(:constraint_string) { ">= 1.2" }
|
168
|
+
|
169
|
+
it "returns an array with the constraint operator at index 0" do
|
170
|
+
subject[0].should eql(">=")
|
171
|
+
end
|
172
|
+
|
173
|
+
it "returns an array with the major version in index 1" do
|
174
|
+
subject[1].should eql(1)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "returns an array with the minor version at index 2" do
|
178
|
+
subject[2].should eql(2)
|
179
|
+
end
|
180
|
+
|
181
|
+
it "returns an array with a nil value at index 3" do
|
182
|
+
subject[3].should be_nil
|
183
|
+
end
|
184
|
+
|
185
|
+
it "returns an array with a nil value at index 4" do
|
186
|
+
subject[4].should be_nil
|
187
|
+
end
|
188
|
+
|
189
|
+
it "returns an array with a nil value at index 5" do
|
190
|
+
subject[5].should be_nil
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context "given a constraint containing the elements (operator, major)" do
|
195
|
+
let(:constraint_string) { ">= 1" }
|
196
|
+
|
197
|
+
it "returns an array with the constraint operator at index 0" do
|
198
|
+
subject[0].should eql(">=")
|
199
|
+
end
|
200
|
+
|
201
|
+
it "returns an array with the major version in index 1" do
|
202
|
+
subject[1].should eql(1)
|
203
|
+
end
|
204
|
+
|
205
|
+
it "returns an array with a nil value at index 2" do
|
206
|
+
subject[2].should be_nil
|
207
|
+
end
|
208
|
+
|
209
|
+
it "returns an array with a nil value at index 3" do
|
210
|
+
subject[3].should be_nil
|
211
|
+
end
|
212
|
+
|
213
|
+
it "returns an array with a nil value at index 4" do
|
214
|
+
subject[4].should be_nil
|
215
|
+
end
|
216
|
+
|
217
|
+
it "returns an array with a nil value at index 5" do
|
218
|
+
subject[5].should be_nil
|
219
|
+
end
|
74
220
|
end
|
75
221
|
|
76
|
-
|
77
|
-
|
222
|
+
context "given a constraint which is missing an operator" do
|
223
|
+
let(:constraint_string) { "1.2.3" }
|
224
|
+
|
225
|
+
it "returns an equality operator at index 0" do
|
226
|
+
subject[0].should eql("=")
|
227
|
+
end
|
78
228
|
end
|
79
229
|
|
80
230
|
context "given a string that does not match the Constraint REGEXP" do
|
81
|
-
|
82
|
-
|
231
|
+
let(:constraint_string) { "x23u7089213.*" }
|
232
|
+
|
233
|
+
it "raises an InvalidConstraintFormat error" do
|
234
|
+
expect {
|
235
|
+
subject.split(invalid_string)
|
236
|
+
}.to raise_error(Solve::Errors::InvalidConstraintFormat)
|
83
237
|
end
|
84
238
|
end
|
85
239
|
|
86
240
|
context "given a string that does not contain an operator" do
|
241
|
+
let(:constraint_string) { "1.2.3" }
|
242
|
+
|
87
243
|
it "returns a constraint constraint with a default operator (=)" do
|
88
|
-
subject
|
244
|
+
subject[0].should eql("=")
|
89
245
|
end
|
90
246
|
end
|
91
247
|
end
|
92
248
|
end
|
93
249
|
|
94
|
-
describe "#satisfies?"
|
250
|
+
describe "#satisfies?" do
|
95
251
|
subject { Solve::Constraint.new("= 1.0.0") }
|
96
252
|
|
97
253
|
it { should satisfies("1.0.0") }
|
@@ -100,6 +256,22 @@ describe Solve::Constraint do
|
|
100
256
|
should satisfies(Solve::Version.new("1.0.0"))
|
101
257
|
end
|
102
258
|
|
259
|
+
context "when the constraint contains a pre-release value" do
|
260
|
+
subject { Solve::Constraint.new(">= 1.2.3-alpha") }
|
261
|
+
|
262
|
+
it "is satisfied by pre-release versions" do
|
263
|
+
should satisfies("1.2.3-beta")
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
context "when the constraint does not contain a pre-release value" do
|
268
|
+
subject { Solve::Constraint.new(">= 1.2.3") }
|
269
|
+
|
270
|
+
it "is not satisfied by pre-release versions" do
|
271
|
+
should_not satisfies("1.2.3-beta")
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
103
275
|
context "strictly greater than (>)" do
|
104
276
|
subject { Solve::Constraint.new("> 1.0.0-alpha") }
|
105
277
|
|
@@ -139,7 +311,7 @@ describe Solve::Constraint do
|
|
139
311
|
subject { Solve::Constraint.new("<= 1.0.0") }
|
140
312
|
|
141
313
|
it { should satisfies("0.9.9+build") }
|
142
|
-
it {
|
314
|
+
it { should_not satisfies("1.0.0-alpha") }
|
143
315
|
it { should satisfies("1.0.0") }
|
144
316
|
it { should_not satisfies("1.0.0+build") }
|
145
317
|
it { should_not satisfies("1.0.1") }
|
@@ -156,16 +328,18 @@ describe Solve::Constraint do
|
|
156
328
|
it { should satisfies("1.2.0") }
|
157
329
|
it { should satisfies("1.2.3") }
|
158
330
|
it { should satisfies("1.2.3+build") }
|
331
|
+
it { should satisfies("1.3") }
|
332
|
+
it { should satisfies("1.3.0") }
|
159
333
|
it { should_not satisfies("2.0.0-0") }
|
160
334
|
it { should_not satisfies("2.0.0") }
|
161
335
|
end
|
162
336
|
|
163
|
-
context "when the last value in the constraint is for
|
164
|
-
subject { Solve::Constraint.new("#{operator} 1.2.
|
337
|
+
context "when the last value in the constraint is for patch" do
|
338
|
+
subject { Solve::Constraint.new("#{operator} 1.2.0") }
|
165
339
|
|
166
340
|
it { should_not satisfies("1.1.0") }
|
167
341
|
it { should_not satisfies("1.2.3-alpha") }
|
168
|
-
it {
|
342
|
+
it { should satisfies("1.2.2") }
|
169
343
|
it { should satisfies("1.2.3") }
|
170
344
|
it { should satisfies("1.2.5+build") }
|
171
345
|
it { should_not satisfies("1.3.0-0") }
|
@@ -282,6 +282,18 @@ describe Solve::Version do
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
|
285
|
+
describe "#pre_release?" do
|
286
|
+
context "when a pre-release value is set" do
|
287
|
+
subject { described_class.new("1.2.3-alpha").pre_release? }
|
288
|
+
it { should be_true }
|
289
|
+
end
|
290
|
+
|
291
|
+
context "when no pre-release value is set" do
|
292
|
+
subject { described_class.new("1.2.3").pre_release? }
|
293
|
+
it { should be_false }
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
285
297
|
describe "#to_s" do
|
286
298
|
subject { Solve::Version.new("1.0.0-rc.1+build.1") }
|
287
299
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: json
|
@@ -31,15 +31,15 @@ dependencies:
|
|
31
31
|
version: '0'
|
32
32
|
description: A Ruby version constraint solver
|
33
33
|
email:
|
34
|
-
-
|
35
|
-
-
|
34
|
+
- reset@riotgames.com
|
35
|
+
- agarson@riotgames.com
|
36
36
|
- thibaud@thibaud.me
|
37
37
|
executables: []
|
38
38
|
extensions: []
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
41
|
- .gitignore
|
42
|
-
- .
|
42
|
+
- .ruby-version
|
43
43
|
- .travis.yml
|
44
44
|
- Gemfile
|
45
45
|
- Guardfile
|
@@ -73,7 +73,7 @@ files:
|
|
73
73
|
- spec/unit/solve/solver_spec.rb
|
74
74
|
- spec/unit/solve/version_spec.rb
|
75
75
|
- spec/unit/solve_spec.rb
|
76
|
-
homepage: https://github.com/
|
76
|
+
homepage: https://github.com/RiotGames/solve
|
77
77
|
licenses:
|
78
78
|
- Apache 2.0
|
79
79
|
post_install_message:
|
@@ -94,10 +94,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
hash:
|
97
|
+
hash: -856939986988863331
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.23
|
101
101
|
signing_key:
|
102
102
|
specification_version: 3
|
103
103
|
summary: A Ruby version constraint solver implementing Semantic Versioning 2.0.0-rc.1
|
data/.rbenv-version
DELETED