semantic_range 2.0.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -3
- data/lib/semantic_range.rb +52 -32
- data/lib/semantic_range/comparator.rb +40 -5
- data/lib/semantic_range/range.rb +13 -0
- data/lib/semantic_range/version.rb +1 -1
- metadata +10 -22
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -6
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -10
- data/Gemfile +0 -5
- data/Guardfile +0 -87
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -7
- data/semantic_range.gemspec +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ccde626c1a653687b8994fa8f79db2862c424e785e5f9947081481eadce45a21
|
4
|
+
data.tar.gz: d73b3387a5955017d9133f41a9ab844fb647805d206f1b5221e82ace813c68fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df892019675f0bd4c9b0d9e38dbc373201de7b7ee1a5e40f0aa0f6339d7915021476b01569aaa6e2ab4a903fa45c5fc6fa31449877a221be90bf155b6b2e7527
|
7
|
+
data.tar.gz: ca56913a665bc5b9adca0f5497331c11c190149ca1f6349fdc370f4fe4405cced341a19c95b991ded906fc6edd123022dbfd88aabbfef94f2637bde85c49410b
|
data/README.md
CHANGED
@@ -24,9 +24,10 @@ Or install it yourself as:
|
|
24
24
|
SemanticRange.valid('1.2.3') # '1.2.3'
|
25
25
|
SemanticRange.valid('a.b.c') # nil
|
26
26
|
SemanticRange.clean(' =v1.2.3 ') # '1.2.3'
|
27
|
-
SemanticRange.
|
28
|
-
SemanticRange.
|
29
|
-
SemanticRange.
|
27
|
+
SemanticRange.filter(['0.9.0', '1.3.0', '1.5.0', '2.0.5'], '1.3.0 || <1.0.0 || >2.0.0') # ['0.9.0', '1.3.0', '2.0.5']
|
28
|
+
SemanticRange.satisfies?('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') # true
|
29
|
+
SemanticRange.gt?('1.2.3', '9.8.7') # false
|
30
|
+
SemanticRange.lt?('1.2.3', '9.8.7') # true
|
30
31
|
```
|
31
32
|
|
32
33
|
## Development
|
data/lib/semantic_range.rb
CHANGED
@@ -50,12 +50,12 @@ module SemanticRange
|
|
50
50
|
class InvalidComparator < StandardError; end
|
51
51
|
class InvalidRange < StandardError; end
|
52
52
|
|
53
|
-
def self.ltr(version, range, loose = false, platform = nil)
|
54
|
-
outside(version, range, '<', loose, platform)
|
53
|
+
def self.ltr?(version, range, loose = false, platform = nil)
|
54
|
+
outside?(version, range, '<', loose, platform)
|
55
55
|
end
|
56
56
|
|
57
|
-
def self.gtr(version, range, loose = false, platform = nil)
|
58
|
-
outside(version, range, '>', loose, platform)
|
57
|
+
def self.gtr?(version, range, loose = false, platform = nil)
|
58
|
+
outside?(version, range, '>', loose, platform)
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.cmp(a, op, b, loose = false)
|
@@ -69,27 +69,27 @@ module SemanticRange
|
|
69
69
|
b = b.version if !b.is_a?(String)
|
70
70
|
a != b
|
71
71
|
when '', '=', '=='
|
72
|
-
eq(a, b, loose)
|
72
|
+
eq?(a, b, loose)
|
73
73
|
when '!='
|
74
|
-
neq(a, b, loose)
|
74
|
+
neq?(a, b, loose)
|
75
75
|
when '>'
|
76
|
-
gt(a, b, loose)
|
76
|
+
gt?(a, b, loose)
|
77
77
|
when '>='
|
78
|
-
gte(a, b, loose)
|
78
|
+
gte?(a, b, loose)
|
79
79
|
when '<'
|
80
|
-
lt(a, b, loose)
|
80
|
+
lt?(a, b, loose)
|
81
81
|
when '<='
|
82
|
-
lte(a, b, loose)
|
82
|
+
lte?(a, b, loose)
|
83
83
|
else
|
84
84
|
raise 'Invalid operator: ' + op
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
def self.outside(version, range, hilo, loose = false, platform = nil)
|
88
|
+
def self.outside?(version, range, hilo, loose = false, platform = nil)
|
89
89
|
version = Version.new(version, loose)
|
90
90
|
range = Range.new(range, loose, platform)
|
91
91
|
|
92
|
-
return false if satisfies(version, range, loose, platform)
|
92
|
+
return false if satisfies?(version, range, loose, platform)
|
93
93
|
|
94
94
|
case hilo
|
95
95
|
when '>'
|
@@ -114,15 +114,15 @@ module SemanticRange
|
|
114
114
|
|
115
115
|
case hilo
|
116
116
|
when '>'
|
117
|
-
if gt(comparator.semver, high.semver, loose)
|
117
|
+
if gt?(comparator.semver, high.semver, loose)
|
118
118
|
high = comparator
|
119
|
-
elsif lt(comparator.semver, low.semver, loose)
|
119
|
+
elsif lt?(comparator.semver, low.semver, loose)
|
120
120
|
low = comparator
|
121
121
|
end
|
122
122
|
when '<'
|
123
|
-
if lt(comparator.semver, high.semver, loose)
|
123
|
+
if lt?(comparator.semver, high.semver, loose)
|
124
124
|
high = comparator
|
125
|
-
elsif gt(comparator.semver, low.semver, loose)
|
125
|
+
elsif gt?(comparator.semver, low.semver, loose)
|
126
126
|
low = comparator
|
127
127
|
end
|
128
128
|
end
|
@@ -132,15 +132,15 @@ module SemanticRange
|
|
132
132
|
|
133
133
|
case hilo
|
134
134
|
when '>'
|
135
|
-
if (low.operator.empty? || low.operator == comp) && lte(version, low.semver, loose)
|
135
|
+
if (low.operator.empty? || low.operator == comp) && lte?(version, low.semver, loose)
|
136
136
|
return false;
|
137
|
-
elsif (low.operator == ecomp && lt(version, low.semver, loose))
|
137
|
+
elsif (low.operator == ecomp && lt?(version, low.semver, loose))
|
138
138
|
return false;
|
139
139
|
end
|
140
140
|
when '<'
|
141
|
-
if (low.operator.empty? || low.operator == comp) && gte(version, low.semver, loose)
|
141
|
+
if (low.operator.empty? || low.operator == comp) && gte?(version, low.semver, loose)
|
142
142
|
return false;
|
143
|
-
elsif low.operator == ecomp && gt(version, low.semver, loose)
|
143
|
+
elsif low.operator == ecomp && gt?(version, low.semver, loose)
|
144
144
|
return false;
|
145
145
|
end
|
146
146
|
end
|
@@ -148,14 +148,20 @@ module SemanticRange
|
|
148
148
|
true
|
149
149
|
end
|
150
150
|
|
151
|
-
def self.satisfies(version, range, loose = false, platform = nil)
|
151
|
+
def self.satisfies?(version, range, loose = false, platform = nil)
|
152
152
|
return false if !valid_range(range, loose, platform)
|
153
153
|
Range.new(range, loose, platform).test(version)
|
154
154
|
end
|
155
155
|
|
156
|
+
def self.filter(versions, range, loose = false, platform = nil)
|
157
|
+
return [] if !valid_range(range, loose, platform)
|
158
|
+
|
159
|
+
versions.filter { |v| SemanticRange.satisfies?(v, range, loose, platform) }
|
160
|
+
end
|
161
|
+
|
156
162
|
def self.max_satisfying(versions, range, loose = false, platform = nil)
|
157
163
|
versions.select { |version|
|
158
|
-
satisfies(version, range, loose, platform)
|
164
|
+
satisfies?(version, range, loose, platform)
|
159
165
|
}.sort { |a, b|
|
160
166
|
rcompare(a, b, loose)
|
161
167
|
}[0] || nil
|
@@ -191,27 +197,27 @@ module SemanticRange
|
|
191
197
|
# TODO
|
192
198
|
end
|
193
199
|
|
194
|
-
def self.lt(a, b, loose = false)
|
200
|
+
def self.lt?(a, b, loose = false)
|
195
201
|
compare(a, b, loose) < 0
|
196
202
|
end
|
197
203
|
|
198
|
-
def self.gt(a, b, loose = false)
|
204
|
+
def self.gt?(a, b, loose = false)
|
199
205
|
compare(a, b, loose) > 0
|
200
206
|
end
|
201
207
|
|
202
|
-
def self.eq(a, b, loose = false)
|
208
|
+
def self.eq?(a, b, loose = false)
|
203
209
|
compare(a, b, loose) == 0
|
204
210
|
end
|
205
211
|
|
206
|
-
def self.neq(a, b, loose = false)
|
212
|
+
def self.neq?(a, b, loose = false)
|
207
213
|
compare(a, b, loose) != 0
|
208
214
|
end
|
209
215
|
|
210
|
-
def self.gte(a, b, loose = false)
|
216
|
+
def self.gte?(a, b, loose = false)
|
211
217
|
compare(a, b, loose) >= 0
|
212
218
|
end
|
213
219
|
|
214
|
-
def self.lte(a, b, loose = false)
|
220
|
+
def self.lte?(a, b, loose = false)
|
215
221
|
compare(a, b, loose) <= 0
|
216
222
|
end
|
217
223
|
|
@@ -230,14 +236,14 @@ module SemanticRange
|
|
230
236
|
|
231
237
|
return nil unless version.is_a?(String)
|
232
238
|
|
233
|
-
version.strip
|
239
|
+
stripped_version = version.strip
|
234
240
|
|
235
|
-
return nil if
|
241
|
+
return nil if stripped_version.length > MAX_LENGTH
|
236
242
|
|
237
243
|
rxp = loose ? LOOSE : FULL
|
238
|
-
return nil if !rxp.match(
|
244
|
+
return nil if !rxp.match(stripped_version)
|
239
245
|
|
240
|
-
Version.new(
|
246
|
+
Version.new(stripped_version, loose)
|
241
247
|
end
|
242
248
|
|
243
249
|
def self.increment!(version, release, loose, identifier)
|
@@ -267,4 +273,18 @@ module SemanticRange
|
|
267
273
|
comp.map(&:to_s)
|
268
274
|
end
|
269
275
|
end
|
276
|
+
|
277
|
+
class << self
|
278
|
+
# Support for older non-inquisitive method versions
|
279
|
+
alias_method :gt, :gt?
|
280
|
+
alias_method :gtr, :gtr?
|
281
|
+
alias_method :gte, :gte?
|
282
|
+
alias_method :lt, :lt?
|
283
|
+
alias_method :ltr, :ltr?
|
284
|
+
alias_method :lte, :lte?
|
285
|
+
alias_method :eq, :eq?
|
286
|
+
alias_method :neq, :neq?
|
287
|
+
alias_method :outside, :outside?
|
288
|
+
alias_method :satisfies, :satisfies?
|
289
|
+
end
|
270
290
|
end
|
@@ -2,12 +2,9 @@ module SemanticRange
|
|
2
2
|
class Comparator
|
3
3
|
attr_reader :semver, :operator, :value
|
4
4
|
def initialize(comp, loose)
|
5
|
-
if comp.is_a?(Comparator)
|
6
|
-
return comp if comp.loose == loose
|
7
|
-
@comp = comp.value
|
8
|
-
end
|
9
|
-
|
5
|
+
comp = comp.value if comp.is_a?(Comparator)
|
10
6
|
@loose = loose
|
7
|
+
|
11
8
|
parse(comp)
|
12
9
|
|
13
10
|
@value = @semver == ANY ? '' : @operator + @semver.version
|
@@ -32,5 +29,43 @@ module SemanticRange
|
|
32
29
|
|
33
30
|
@semver = !m[2] ? ANY : Version.new(m[2], @loose)
|
34
31
|
end
|
32
|
+
|
33
|
+
def intersects?(comp, loose = false, platform = nil)
|
34
|
+
comp = Comparator.new(comp, loose)
|
35
|
+
|
36
|
+
if @operator == ''
|
37
|
+
range_b = Range.new(comp.value, loose, platform)
|
38
|
+
SemanticRange.satisfies?(@value, range_b, loose, platform)
|
39
|
+
elsif comp.operator == ''
|
40
|
+
range_a = Range.new(@value, loose, platform)
|
41
|
+
SemanticRange.satisfies?(comp.semver, range_a, loose, platform)
|
42
|
+
else
|
43
|
+
same_direction_increasing = (@operator == '>=' || @operator == '>') && (comp.operator == '>=' || comp.operator == '>')
|
44
|
+
same_direction_decreasing = (@operator == '<=' || @operator == '<') && (comp.operator == '<=' || comp.operator == '<')
|
45
|
+
same_version = @semver.raw == comp.semver.raw
|
46
|
+
different_directions_inclusive = (@operator == '>=' || @operator == '<=') && (comp.operator == '>=' || comp.operator == '<=')
|
47
|
+
opposite_directions_lte = SemanticRange.cmp(@semver, '<', comp.semver, loose) &&
|
48
|
+
((@operator == '>=' || @operator == '>') && (comp.operator == '<=' || comp.operator == '<'))
|
49
|
+
opposite_directions_gte = SemanticRange.cmp(@semver, '>', comp.semver, loose) &&
|
50
|
+
((@operator == '<=' || @operator == '<') && (comp.operator == '>=' || comp.operator == '>'))
|
51
|
+
|
52
|
+
same_direction_increasing || same_direction_decreasing || (same_version && different_directions_inclusive) ||
|
53
|
+
opposite_directions_lte || opposite_directions_gte
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def satisfies_range?(range, loose = false, platform = nil)
|
58
|
+
range = Range.new(range, loose, platform)
|
59
|
+
|
60
|
+
range.set.any? do |comparators|
|
61
|
+
comparators.all? do |comparator|
|
62
|
+
intersects?(comparator, loose, platform)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Support for older non-inquisitive method versions
|
68
|
+
alias_method :intersects, :intersects?
|
69
|
+
alias_method :satisfies_range, :satisfies_range?
|
35
70
|
end
|
36
71
|
end
|
data/lib/semantic_range/range.rb
CHANGED
@@ -64,6 +64,9 @@ module SemanticRange
|
|
64
64
|
# caret trim
|
65
65
|
range = range.gsub(CARETTRIM, '\1^')
|
66
66
|
|
67
|
+
# comma trim
|
68
|
+
range = range.gsub(',', ' ')
|
69
|
+
|
67
70
|
# normalise spaces
|
68
71
|
range = range.split(/\s+/).join(' ')
|
69
72
|
|
@@ -279,5 +282,15 @@ module SemanticRange
|
|
279
282
|
|
280
283
|
"#{from} #{to}".strip
|
281
284
|
end
|
285
|
+
|
286
|
+
def intersects(range, loose = false, platform = nil)
|
287
|
+
range = Range.new(range, loose, platform)
|
288
|
+
|
289
|
+
@set.any? do |comparators|
|
290
|
+
comparators.all? do |comparator|
|
291
|
+
comparator.satisfies_range(range, loose, platform)
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
282
295
|
end
|
283
296
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_range
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,36 +52,25 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.4'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- andrewnez@gmail.com
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- ".gitignore"
|
63
|
-
- ".rspec"
|
64
|
-
- ".travis.yml"
|
65
|
-
- CODE_OF_CONDUCT.md
|
66
|
-
- CONTRIBUTING.md
|
67
|
-
- Gemfile
|
68
|
-
- Guardfile
|
69
62
|
- LICENSE.txt
|
70
63
|
- README.md
|
71
|
-
- Rakefile
|
72
|
-
- bin/console
|
73
|
-
- bin/setup
|
74
64
|
- lib/semantic_range.rb
|
75
65
|
- lib/semantic_range/comparator.rb
|
76
66
|
- lib/semantic_range/pre_release.rb
|
77
67
|
- lib/semantic_range/range.rb
|
78
68
|
- lib/semantic_range/version.rb
|
79
|
-
- semantic_range.gemspec
|
80
69
|
homepage: https://libraries.io/github/librariesio/semantic_range
|
81
70
|
licenses:
|
82
71
|
- MIT
|
83
72
|
metadata: {}
|
84
|
-
post_install_message:
|
73
|
+
post_install_message:
|
85
74
|
rdoc_options: []
|
86
75
|
require_paths:
|
87
76
|
- lib
|
@@ -96,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
85
|
- !ruby/object:Gem::Version
|
97
86
|
version: '0'
|
98
87
|
requirements: []
|
99
|
-
|
100
|
-
|
101
|
-
signing_key:
|
88
|
+
rubygems_version: 3.0.4
|
89
|
+
signing_key:
|
102
90
|
specification_version: 4
|
103
91
|
summary: node-semver rewritten in ruby, for comparison and inclusion of semantic versions
|
104
92
|
and ranges
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at andrew@libraries.io. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
* Fork the project.
|
4
|
-
* Make your feature addition or bug fix.
|
5
|
-
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
6
|
-
* Send a pull request. Bonus points for topic branches.
|
7
|
-
|
8
|
-
## Code of Conduct
|
9
|
-
|
10
|
-
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
data/Gemfile
DELETED
data/Guardfile
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
## Uncomment and set this to only include directories you want to watch
|
5
|
-
# directories %w(app lib config test spec features) \
|
6
|
-
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
-
|
8
|
-
## Note: if you are using the `directories` clause above and you are not
|
9
|
-
## watching the project directory ('.'), then you will want to move
|
10
|
-
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
-
#
|
12
|
-
# $ mkdir config
|
13
|
-
# $ mv Guardfile config/
|
14
|
-
# $ ln -s config/Guardfile .
|
15
|
-
#
|
16
|
-
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
-
|
18
|
-
guard :bundler do
|
19
|
-
require 'guard/bundler'
|
20
|
-
require 'guard/bundler/verify'
|
21
|
-
helper = Guard::Bundler::Verify.new
|
22
|
-
|
23
|
-
files = ['Gemfile']
|
24
|
-
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
25
|
-
|
26
|
-
# Assume files are symlinked from somewhere
|
27
|
-
files.each { |file| watch(helper.real_path(file)) }
|
28
|
-
end
|
29
|
-
|
30
|
-
guard 'migrate' do
|
31
|
-
watch(%r{^db/migrate/(\d+).+\.rb})
|
32
|
-
watch('db/seeds.rb')
|
33
|
-
end
|
34
|
-
|
35
|
-
# Note: The cmd option is now required due to the increasing number of ways
|
36
|
-
# rspec may be run, below are examples of the most common uses.
|
37
|
-
# * bundler: 'bundle exec rspec'
|
38
|
-
# * bundler binstubs: 'bin/rspec'
|
39
|
-
# * spring: 'bin/rspec' (This will use spring if running and you have
|
40
|
-
# installed the spring binstubs per the docs)
|
41
|
-
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
42
|
-
# * 'just' rspec: 'rspec'
|
43
|
-
|
44
|
-
guard :rspec, cmd: "bundle exec rspec" do
|
45
|
-
require "guard/rspec/dsl"
|
46
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
47
|
-
|
48
|
-
# Feel free to open issues for suggestions and improvements
|
49
|
-
|
50
|
-
# RSpec files
|
51
|
-
rspec = dsl.rspec
|
52
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
53
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
54
|
-
watch(rspec.spec_files)
|
55
|
-
|
56
|
-
# Ruby files
|
57
|
-
ruby = dsl.ruby
|
58
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
59
|
-
|
60
|
-
# Rails files
|
61
|
-
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
62
|
-
dsl.watch_spec_files_for(rails.app_files)
|
63
|
-
dsl.watch_spec_files_for(rails.views)
|
64
|
-
|
65
|
-
watch(rails.controllers) do |m|
|
66
|
-
[
|
67
|
-
rspec.spec.("routing/#{m[1]}_routing"),
|
68
|
-
rspec.spec.("controllers/#{m[1]}_controller"),
|
69
|
-
rspec.spec.("acceptance/#{m[1]}")
|
70
|
-
]
|
71
|
-
end
|
72
|
-
|
73
|
-
# Rails config changes
|
74
|
-
watch(rails.spec_helper) { rspec.spec_dir }
|
75
|
-
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
76
|
-
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
77
|
-
|
78
|
-
# Capybara features specs
|
79
|
-
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
80
|
-
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
81
|
-
|
82
|
-
# Turnip features and steps
|
83
|
-
watch(%r{^spec/acceptance/(.+)\.feature$})
|
84
|
-
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
85
|
-
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
86
|
-
end
|
87
|
-
end
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "semantic_range"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/semantic_range.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'semantic_range/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "semantic_range"
|
8
|
-
spec.version = SemanticRange::VERSION
|
9
|
-
spec.authors = ["Andrew Nesbitt"]
|
10
|
-
spec.email = ["andrewnez@gmail.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{node-semver rewritten in ruby, for comparison and inclusion of semantic versions and ranges}
|
13
|
-
spec.homepage = "https://libraries.io/github/librariesio/semantic_range"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir = "exe"
|
18
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.11"
|
22
|
-
spec.add_development_dependency "rake", "~> 11.0"
|
23
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
24
|
-
end
|