pub_grub 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/pub_grub/version_range.rb +31 -13
- data/lib/pub_grub/version_union.rb +7 -3
- data/pub_grub.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312b4d6ab0235f22ead56c025d6ae557043af8f4e4b0ac7bbed1e0a219151a29
|
4
|
+
data.tar.gz: 7b9de23d87e9918d4a97b24ded5d1db9573e7693af34b737c2b66b46f93a9e76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ceeb01137803054fb77b1fba533e21880c49b4ae3e4cbaed52887543137a641f9e4527a86e5840df725e96c9ed021b14f1dcf10233a8608f8eb1f84eb7c4e97
|
7
|
+
data.tar.gz: ce803cc3420bef9d78bd4745ad2e3829272dabb2b1083659e4de712f3a8ab1db4a9f990589a9405e251d0ed2f24d4e466fd035bea6d429ee366d05735cc1777c
|
data/Gemfile.lock
CHANGED
@@ -79,27 +79,45 @@ module PubGrub
|
|
79
79
|
compare_version(version) == 0
|
80
80
|
end
|
81
81
|
|
82
|
-
#
|
82
|
+
# Partitions passed versions into [lower, within, higher]
|
83
83
|
#
|
84
84
|
# versions must be sorted
|
85
|
-
def
|
86
|
-
|
87
|
-
if
|
88
|
-
|
85
|
+
def partition_versions(versions)
|
86
|
+
min_index =
|
87
|
+
if !min || versions.empty?
|
88
|
+
0
|
89
|
+
elsif include_min?
|
90
|
+
(0..versions.size).bsearch { |i| versions[i].nil? || versions[i] >= min }
|
89
91
|
else
|
90
|
-
versions
|
92
|
+
(0..versions.size).bsearch { |i| versions[i].nil? || versions[i] > min }
|
91
93
|
end
|
92
|
-
end
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
95
|
+
lower = versions.slice(0, min_index)
|
96
|
+
versions = versions.slice(min_index, versions.size)
|
97
|
+
|
98
|
+
max_index =
|
99
|
+
if !max || versions.empty?
|
100
|
+
versions.size
|
101
|
+
elsif include_max?
|
102
|
+
(0..versions.size).bsearch { |i| versions[i].nil? || versions[i] > max }
|
97
103
|
else
|
98
|
-
versions
|
104
|
+
(0..versions.size).bsearch { |i| versions[i].nil? || versions[i] >= max }
|
99
105
|
end
|
100
|
-
end
|
101
106
|
|
102
|
-
|
107
|
+
[
|
108
|
+
lower,
|
109
|
+
versions.slice(0, max_index),
|
110
|
+
versions.slice(max_index, versions.size)
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
# Returns verisons which are included by this range.
|
115
|
+
#
|
116
|
+
# versions must be sorted
|
117
|
+
def select_versions(versions)
|
118
|
+
return versions if any?
|
119
|
+
|
120
|
+
partition_versions(versions)[1]
|
103
121
|
end
|
104
122
|
|
105
123
|
def compare_version(version)
|
@@ -52,10 +52,14 @@ module PubGrub
|
|
52
52
|
!!ranges.bsearch {|r| r.compare_version(version) }
|
53
53
|
end
|
54
54
|
|
55
|
-
def select_versions(
|
56
|
-
|
57
|
-
|
55
|
+
def select_versions(all_versions)
|
56
|
+
versions = []
|
57
|
+
ranges.inject(all_versions) do |acc, range|
|
58
|
+
lower, matching, higher = range.partition_versions(acc)
|
59
|
+
versions.concat matching
|
60
|
+
higher
|
58
61
|
end
|
62
|
+
versions
|
59
63
|
end
|
60
64
|
|
61
65
|
def intersects?(other)
|
data/pub_grub.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pub_grub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|