pub_grub 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 906d1263305a0df7b8082cf01fd1abb3ddbd92f294744b1d9131603396be31a1
4
- data.tar.gz: 6566971cf3a8ed458d15d21233614351d12b407c3e056f3bc580b0efe810fef0
3
+ metadata.gz: 90903e9ac8d79a7f74af0ef80ad36f53bd485e3c359369a861b609426b3146a9
4
+ data.tar.gz: 6d3e1d1f6989e4b22825eeed08bfd8476b138efd0d436ea2ab707391a2e759c3
5
5
  SHA512:
6
- metadata.gz: 2d793abfc4b0481e6a056f2355310c60e8450058f777754284e011369d2e420a14c37939a8631b3d1ae01ec3f7b1f7c4250234a245ba4b2b6d6d4fc4ea90a5ee
7
- data.tar.gz: 526cc6588093a2ec82b44fdad8a2bf6c09f3520c02d1c9a248e11576ca80e6c2817dc8564573b95d8da637e29ea5bed80379632f176a8729bb7c4eecba227950
6
+ metadata.gz: 10d228e102328e2d112c79eaebd50b35e77667b290986ef36685081eb517101f68f741b489accbab9a46e8f5628b757924b57faf265d7a3913c38333eabb0088
7
+ data.tar.gz: 90dcf1cfe0921f95cef532d92affe813ac30bbef2c57e736cc706d55265a2fb4f42a6e4e0886c0b667c8d0f4f7a3e7f4f73c858436ff0c01295648479937632b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pub_grub (0.4.0)
4
+ pub_grub (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -18,7 +18,7 @@ module PubGrub
18
18
  @terms = cleanup_terms(terms)
19
19
 
20
20
  if cause == :dependency && @terms.length != 2
21
- raise ArgumentError, "a dependency Incompatibility must have exactly two terms. Got #{terms.inspect}"
21
+ raise ArgumentError, "a dependency Incompatibility must have exactly two terms. Got #{@terms.inspect}"
22
22
  end
23
23
  end
24
24
 
@@ -37,9 +37,9 @@ module PubGrub
37
37
  propagate(next_package)
38
38
 
39
39
  if solved?
40
- logger.info "Solution found after #{solution.attempted_solutions} attempts:"
40
+ logger.info { "Solution found after #{solution.attempted_solutions} attempts:" }
41
41
  solution.decisions.each do |package, version|
42
- logger.info "* #{package} #{version}"
42
+ logger.info { "* #{package} #{version}" }
43
43
  end
44
44
 
45
45
  false
@@ -92,7 +92,7 @@ module PubGrub
92
92
  return :conflict
93
93
  end
94
94
 
95
- logger.debug("derived: #{unsatisfied.invert}")
95
+ logger.debug { "derived: #{unsatisfied.invert}" }
96
96
 
97
97
  solution.derive(unsatisfied.invert, incompatibility)
98
98
 
@@ -135,7 +135,7 @@ module PubGrub
135
135
  end
136
136
 
137
137
  unless conflict
138
- logger.info("selecting #{package} #{version}")
138
+ logger.info { "selecting #{package} #{version}" }
139
139
 
140
140
  solution.decide(package, version)
141
141
  end
@@ -144,7 +144,7 @@ module PubGrub
144
144
  end
145
145
 
146
146
  def resolve_conflict(incompatibility)
147
- logger.info "conflict: #{incompatibility}"
147
+ logger.info { "conflict: #{incompatibility}" }
148
148
 
149
149
  new_incompatibility = false
150
150
 
@@ -184,7 +184,7 @@ module PubGrub
184
184
  if previous_level < most_recent_satisfier.decision_level ||
185
185
  most_recent_satisfier.decision?
186
186
 
187
- logger.info "backtracking to #{previous_level}"
187
+ logger.info { "backtracking to #{previous_level}" }
188
188
  solution.backtrack(previous_level)
189
189
 
190
190
  if new_incompatibility
@@ -208,16 +208,16 @@ module PubGrub
208
208
  new_incompatibility = true
209
209
 
210
210
  partially = difference ? " partially" : ""
211
- logger.info "! #{most_recent_term} is#{partially} satisfied by #{most_recent_satisfier.term}"
212
- logger.info "! which is caused by #{most_recent_satisfier.cause}"
213
- logger.info "! thus #{incompatibility}"
211
+ logger.info { "! #{most_recent_term} is#{partially} satisfied by #{most_recent_satisfier.term}" }
212
+ logger.info { "! which is caused by #{most_recent_satisfier.cause}" }
213
+ logger.info { "! thus #{incompatibility}" }
214
214
  end
215
215
 
216
216
  raise SolveFailure.new(incompatibility)
217
217
  end
218
218
 
219
219
  def add_incompatibility(incompatibility)
220
- logger.debug("fact: #{incompatibility}");
220
+ logger.debug { "fact: #{incompatibility}" }
221
221
  incompatibility.terms.each do |term|
222
222
  package = term.package
223
223
  @incompatibilities[package] << incompatibility
@@ -18,7 +18,7 @@ module PubGrub
18
18
  return [] if ranges.empty?
19
19
 
20
20
  mins, ranges = ranges.partition { |r| !r.min }
21
- original_ranges = mins + ranges.sort_by { |r| [r.include_min ? 0 : 1, r.min] }
21
+ original_ranges = mins + ranges.sort_by { |r| [r.min, r.include_min ? 0 : 1] }
22
22
  ranges = [original_ranges.shift]
23
23
  original_ranges.each do |range|
24
24
  if ranges.last.contiguous_to?(range)
@@ -124,7 +124,28 @@ module PubGrub
124
124
  end
125
125
 
126
126
  def to_s
127
- ranges.map(&:to_s).join(" OR ")
127
+ output = []
128
+
129
+ ranges = self.ranges.dup
130
+ while !ranges.empty?
131
+ ne = []
132
+ range = ranges.shift
133
+ while !ranges.empty? && ranges[0].min == range.max
134
+ ne << range.max
135
+ range = range.span(ranges.shift)
136
+ end
137
+
138
+ ne.map! {|x| "!= #{x}" }
139
+ if ne.empty?
140
+ output << range.to_s
141
+ elsif range.any?
142
+ output << ne.join(', ')
143
+ else
144
+ output << "#{range}, #{ne.join(', ')}"
145
+ end
146
+ end
147
+
148
+ output.join(" OR ")
128
149
  end
129
150
 
130
151
  def inspect
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "pub_grub"
7
- spec.version = "0.4.0"
7
+ spec.version = "0.4.1"
8
8
  spec.authors = ["John Hawthorn"]
9
9
  spec.email = ["john@hawthorn.email"]
10
10
 
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.4.0
4
+ version: 0.4.1
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-28 00:00:00.000000000 Z
11
+ date: 2018-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler