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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a67e6b4597f818bf3075b20f3910be621cde2c8
4
- data.tar.gz: 8d5e37c2641122b761c3c3c1128a77ad906d0430
3
+ metadata.gz: 80076e8f01f36c012ab6dfb0fd3e28002828f06b
4
+ data.tar.gz: 8a44a15ea9dc630a83937e8a765af8801784163d
5
5
  SHA512:
6
- metadata.gz: bb8424d75e0392beaa679ccdce8d7046d8bc37d061db0f628635f46d44952c508cca2f89f2e8a37edd110ee3df82b62ab63c64c103a30a910573472c99f34f41
7
- data.tar.gz: b7a5c8769d2c75472eb3e1b0b3a0774a006eae9bfff8df0bfd02e04c9434b29f76e7d5416d236e63d8d5c0c85df349af2a169de0f0b8f7b16378658a276b3065
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
@@ -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
- path = Solver.new(
47
- :requirements => RequirementList.new(
46
+ begin
47
+ req_list = RequirementList.new(
48
48
  :name => :world_pruner,
49
49
  :requirements => [[r_unit.name, r_unit.version.version]]
50
- ),
51
- :system => world,
52
- :score_keeper => score_keeper
53
- ).generate!.pop
54
- new_world.add_unit(*path.units)
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[name]
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?)
@@ -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
- raise KeyError.new("Failed to locate any units loaded in system with requested name: `#{unit_name}`")
63
- end
64
- units[unit_name].find_all do |unit|
65
- constraint.satisfied_by?(unit.version)
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
 
@@ -1,4 +1,4 @@
1
1
  module Grimoire
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.2.2')
3
+ VERSION = Gem::Version.new('0.2.4')
4
4
  end
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.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-06 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo