molinillo 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/molinillo/dependency_graph.rb +4 -0
- data/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/molinillo/modules/ui.rb +2 -1
- data/lib/molinillo/resolution.rb +36 -14
- data/spec/dependency_graph_spec.rb +9 -0
- data/spec/resolver_integration_specs/index_from_rubygems.rb +2 -2
- data/spec/resolver_spec.rb +2 -2
- data/spec/spec_helper.rb +5 -0
- data/spec/spec_helper/specification.rb +4 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a5127f777d4d2241afc7f5c7835805688f3735
|
4
|
+
data.tar.gz: 59355f73e74c7ecb33ffae6d07eebb865efa2126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6a5abe9e0e3b9a15e7dc26d03a77e9710cddcc58c53b3a572e93925711d52481e422dc9e8436a0629e1170bde42dabe9181831465d915e884bfbe5f807f4043
|
7
|
+
data.tar.gz: 56c23925d436aa33cb9ac8998abf464b4bb72e6c6b3b6404916ae76632e7ec347e1a9975993a21ca7d69dd85c3215a52641c688a2e14bc0452de218086230971
|
@@ -126,6 +126,10 @@ module Molinillo
|
|
126
126
|
v.incoming_edges.delete(e)
|
127
127
|
detach_vertex_named(v.name) unless v.root? || v.predecessors.any?
|
128
128
|
end
|
129
|
+
vertex.incoming_edges.each do |e|
|
130
|
+
v = e.origin
|
131
|
+
v.outgoing_edges.delete(e)
|
132
|
+
end
|
129
133
|
end
|
130
134
|
|
131
135
|
# @param [String] name
|
data/lib/molinillo/modules/ui.rb
CHANGED
data/lib/molinillo/resolution.rb
CHANGED
@@ -341,26 +341,36 @@ module Molinillo
|
|
341
341
|
# @return [Boolean] Whether the possibility was swapped into {#activated}
|
342
342
|
def attempt_to_swap_possibility
|
343
343
|
swapped = activated.dup
|
344
|
-
swapped.vertex_named(name)
|
345
|
-
|
344
|
+
vertex = swapped.vertex_named(name)
|
345
|
+
vertex.payload = possibility
|
346
|
+
return unless vertex.requirements.
|
346
347
|
all? { |r| requirement_satisfied_by?(r, swapped, possibility) }
|
347
|
-
|
348
|
+
return unless new_spec_satisfied?
|
349
|
+
actual_vertex = activated.vertex_named(name)
|
350
|
+
actual_vertex.payload = possibility
|
351
|
+
fixup_swapped_children(actual_vertex)
|
352
|
+
activate_spec
|
353
|
+
end
|
354
|
+
|
355
|
+
# Ensures there are no orphaned successors to the given {vertex}.
|
356
|
+
# @param [DependencyGraph::Vertex] vertex the vertex to fix up.
|
357
|
+
# @return [void]
|
358
|
+
def fixup_swapped_children(vertex)
|
359
|
+
payload = vertex.payload
|
360
|
+
dep_names = dependencies_for(payload).map(&method(:name_for))
|
361
|
+
vertex.successors.each do |succ|
|
362
|
+
if !dep_names.include?(succ.name) && !succ.root? && succ.predecessors.to_a == [vertex]
|
363
|
+
debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
|
364
|
+
activated.detach_vertex_named(succ.name)
|
365
|
+
end
|
366
|
+
end
|
348
367
|
end
|
349
368
|
|
350
369
|
# Attempts to activate the current {#possibility} (given that it hasn't
|
351
370
|
# already been activated)
|
352
371
|
# @return [void]
|
353
372
|
def attempt_to_activate_new_spec
|
354
|
-
|
355
|
-
locked_requirement = locked_requirement_named(name)
|
356
|
-
requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility)
|
357
|
-
locked_spec_satisfied = !locked_requirement ||
|
358
|
-
requirement_satisfied_by?(locked_requirement, activated, possibility)
|
359
|
-
debug(depth) { 'Unsatisfied by requested spec' } unless requested_spec_satisfied
|
360
|
-
debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied
|
361
|
-
requested_spec_satisfied && locked_spec_satisfied
|
362
|
-
end
|
363
|
-
if satisfied
|
373
|
+
if new_spec_satisfied?
|
364
374
|
activate_spec
|
365
375
|
else
|
366
376
|
create_conflict
|
@@ -368,6 +378,18 @@ module Molinillo
|
|
368
378
|
end
|
369
379
|
end
|
370
380
|
|
381
|
+
# @return [Boolean] whether the current spec is satisfied as a new
|
382
|
+
# possibility.
|
383
|
+
def new_spec_satisfied?
|
384
|
+
locked_requirement = locked_requirement_named(name)
|
385
|
+
requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility)
|
386
|
+
locked_spec_satisfied = !locked_requirement ||
|
387
|
+
requirement_satisfied_by?(locked_requirement, activated, possibility)
|
388
|
+
debug(depth) { 'Unsatisfied by requested spec' } unless requested_spec_satisfied
|
389
|
+
debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied
|
390
|
+
requested_spec_satisfied && locked_spec_satisfied
|
391
|
+
end
|
392
|
+
|
371
393
|
# @param [String] requirement_name the spec name to search for
|
372
394
|
# @return [Object] the locked spec named `requirement_name`, if one
|
373
395
|
# is found on {#base}
|
@@ -393,7 +415,7 @@ module Molinillo
|
|
393
415
|
# @return [void]
|
394
416
|
def require_nested_dependencies_for(activated_spec)
|
395
417
|
nested_dependencies = dependencies_for(activated_spec)
|
396
|
-
debug(depth) { "Requiring nested dependencies (#{nested_dependencies.
|
418
|
+
debug(depth) { "Requiring nested dependencies (#{nested_dependencies.join(', ')})" }
|
397
419
|
nested_dependencies.each { |d| activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d) }
|
398
420
|
|
399
421
|
push_state_for_requirements(requirements + nested_dependencies, nested_dependencies.size > 0)
|
@@ -59,6 +59,15 @@ module Molinillo
|
|
59
59
|
expect(child.predecessors).to eq([root2])
|
60
60
|
expect(@graph.vertices.count).to eq(2)
|
61
61
|
end
|
62
|
+
|
63
|
+
it 'detaches a vertex with predecessors' do
|
64
|
+
parent = @graph.add_vertex('parent', 'parent', true)
|
65
|
+
child = @graph.add_child_vertex('child', 'child', %w(parent), 'child')
|
66
|
+
@graph.detach_vertex_named(child.name)
|
67
|
+
expect(@graph.vertex_named(child.name)).to be_nil
|
68
|
+
expect(@graph.vertices).to eq(parent.name => parent)
|
69
|
+
expect(parent.outgoing_edges).to be_empty
|
70
|
+
end
|
62
71
|
end
|
63
72
|
end
|
64
73
|
end
|
@@ -4,7 +4,7 @@ require 'json'
|
|
4
4
|
require 'open-uri'
|
5
5
|
require 'set'
|
6
6
|
|
7
|
-
GEMS = %w(rails capybara bundler).freeze
|
7
|
+
GEMS = %w(rails capybara bundler mail).freeze
|
8
8
|
|
9
9
|
VERSION_PATTERN = /\A
|
10
10
|
[0-9]+\.[0-9]+\.[0-9]+ (?# Number component)
|
@@ -63,7 +63,7 @@ specs = specs.group_by { |s| s['name'] }.values.map do |spec|
|
|
63
63
|
{
|
64
64
|
'name' => s['name'],
|
65
65
|
'version' => coerce_to_semver(s['number']),
|
66
|
-
'dependencies' => coerce_dependencies_to_semver(
|
66
|
+
'dependencies' => coerce_dependencies_to_semver(s['dependencies'].sort_by(&:first))
|
67
67
|
}
|
68
68
|
end.uniq { |s| s['version'] }.sort_by { |s| Gem::Version.new(s['version']) }
|
69
69
|
]
|
data/spec/resolver_spec.rb
CHANGED
@@ -77,9 +77,9 @@ module Molinillo
|
|
77
77
|
result = resolve.call
|
78
78
|
|
79
79
|
pretty_dependencies = lambda do |dg|
|
80
|
-
dg.vertices.values.map { |v| "#{v.
|
80
|
+
dg.vertices.values.map { |v| "#{v.name} (#{v.payload && v.payload.version})" }
|
81
81
|
end
|
82
|
-
expect(pretty_dependencies.call(result)).to
|
82
|
+
expect(pretty_dependencies.call(result)).to contain_exactly(*pretty_dependencies.call(test_case.result))
|
83
83
|
|
84
84
|
expect(result).to eq(test_case.result)
|
85
85
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: molinillo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel E. Giddins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.5'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '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
40
|
version: '0'
|
41
41
|
description:
|
@@ -74,12 +74,12 @@ require_paths:
|
|
74
74
|
- lib
|
75
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: '0'
|
80
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|