grimoire 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/grimoire/solver.rb +14 -9
- data/lib/grimoire/system.rb +6 -4
- data/lib/grimoire/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80076e8f01f36c012ab6dfb0fd3e28002828f06b
|
4
|
+
data.tar.gz: 8a44a15ea9dc630a83937e8a765af8801784163d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d92eb9fcf4c38ae1fd67d5c30472cdcbf7e9775afc7b51129530cf16f9e37edd42269007d82e3ef32c397d9b2be26659f813f751a7f47dd4c436a0e5bab887
|
7
|
+
data.tar.gz: c980efe5d8a72b2ea50fe3b19169662939de2a711076aa4c2de3ce032e0be58dac1ffcc51b881bc7076b85d11e4b45adceb05268fdb8c15ca23b9c71c9a600ed
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# v0.2.4
|
2
|
+
* No longer force error when no requested units are within system
|
3
|
+
* Discard no solution errors when pruning the world instead of failing
|
4
|
+
|
1
5
|
# v0.2.2
|
2
6
|
* Provide origin solver to score keeper when requesting unit score
|
3
7
|
* Introduce Solver#prune_world! to remove extraneous units
|
data/lib/grimoire/solver.rb
CHANGED
@@ -43,15 +43,20 @@ module Grimoire
|
|
43
43
|
@new_world = System.new
|
44
44
|
requirements.requirements.each do |req|
|
45
45
|
world.units[req.name].each do |r_unit|
|
46
|
-
|
47
|
-
|
46
|
+
begin
|
47
|
+
req_list = RequirementList.new(
|
48
48
|
:name => :world_pruner,
|
49
49
|
:requirements => [[r_unit.name, r_unit.version.version]]
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
)
|
51
|
+
path = Solver.new(
|
52
|
+
:requirements => req_list,
|
53
|
+
:system => world,
|
54
|
+
:score_keeper => score_keeper
|
55
|
+
).generate!.pop
|
56
|
+
new_world.add_unit(*path.units)
|
57
|
+
rescue Error::NoSolution => e
|
58
|
+
debug "Failed to generate valid path for: #{r_unit.name}-#{r_unit.version}"
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
@world = new_world
|
@@ -142,7 +147,7 @@ module Grimoire
|
|
142
147
|
def reset_queue(name)
|
143
148
|
queue = populate_queue(
|
144
149
|
create_queue,
|
145
|
-
world.units[
|
150
|
+
world.units.fetch(name, [])
|
146
151
|
)
|
147
152
|
queues[name] = queue
|
148
153
|
self
|
@@ -239,7 +244,7 @@ module Grimoire
|
|
239
244
|
count += 1
|
240
245
|
end
|
241
246
|
rescue Error::UnitUnavailable => e
|
242
|
-
debug "Failed to unit: #{e}"
|
247
|
+
debug "Failed to locate unit: #{e}"
|
243
248
|
count = nil
|
244
249
|
end
|
245
250
|
if(results.empty?)
|
data/lib/grimoire/system.rb
CHANGED
@@ -59,10 +59,12 @@ module Grimoire
|
|
59
59
|
raise TypeError.new "Expecting `#{REQUIREMENT_CLASS}` but received `#{constraint.class}`"
|
60
60
|
end
|
61
61
|
unless(units[unit_name])
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
Grimoire.debug "Failed to locate any units loaded in system with requested name: `#{unit_name}`"
|
63
|
+
[]
|
64
|
+
else
|
65
|
+
units[unit_name].find_all do |unit|
|
66
|
+
constraint.satisfied_by?(unit.version)
|
67
|
+
end
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
data/lib/grimoire/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grimoire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo
|