summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-10-27 22:37:53 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-10-27 22:37:53 -0500
commitf3836b6a1ec0620d164e52b8afec830b13494858 (patch)
tree312dd16ffb755099a3f3fa3b5ea5e8e4b49d98c2
parent72f9a4d68b24ff04f2e01efca978a45ab0159c66 (diff)
downloadbundler-seg-molinillo-0.5.3.tar.gz
Update vendored Molinillo to 0.5.3seg-molinillo-0.5.3
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb7
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb2
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb4
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb4
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb62
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb2
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb13
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb4
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb4
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb2
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb13
11 files changed, 102 insertions, 15 deletions
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
index ce5c5efa46..28d237482d 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
@@ -182,6 +182,13 @@ module Bundler::Molinillo
add_edge_no_circular(origin, destination, requirement)
end
+ # Deletes an {Edge} from the dependency graph
+ # @param [Edge] edge
+ # @return [Void]
+ def delete_edge(edge)
+ log.delete_edge(self, edge.origin.name, edge.destination.name, edge.requirement)
+ end
+
# Sets the payload of the vertex with the given name
# @param [String] name the name of the vertex
# @param [Object] payload the payload
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb
index c8eacbe08f..e0dfe6cbbd 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb
@@ -7,7 +7,7 @@ module Bundler::Molinillo
# rubocop:disable Lint/UnusedMethodArgument
# @return [Symbol] The name of the action.
- def self.name
+ def self.action_name
raise 'Abstract'
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
index a7e703a8f9..a030c03f5f 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
@@ -7,8 +7,8 @@ module Bundler::Molinillo
class AddEdgeNoCircular < Action
# @!group Action
- # (see Action.name)
- def self.name
+ # (see Action.action_name)
+ def self.action_name
:add_vertex
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
index 14cd027804..eda4251801 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb
@@ -7,8 +7,8 @@ module Bundler::Molinillo
class AddVertex < Action # :nodoc:
# @!group Action
- # (see Action.name)
- def self.name
+ # (see Action.action_name)
+ def self.action_name
:add_vertex
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
new file mode 100644
index 0000000000..e9125a59c6
--- /dev/null
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb
@@ -0,0 +1,62 @@
+# frozen_string_literal: true
+require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
+module Bundler::Molinillo
+ class DependencyGraph
+ # @!visibility private
+ # (see DependencyGraph#delete_edge)
+ class DeleteEdge < Action
+ # @!group Action
+
+ # (see Action.action_name)
+ def self.action_name
+ :delete_edge
+ end
+
+ # (see Action#up)
+ def up(graph)
+ edge = make_edge(graph)
+ edge.origin.outgoing_edges.delete(edge)
+ edge.destination.incoming_edges.delete(edge)
+ end
+
+ # (see Action#down)
+ def down(graph)
+ edge = make_edge(graph)
+ edge.origin.outgoing_edges << edge
+ edge.destination.incoming_edges << edge
+ edge
+ end
+
+ # @!group DeleteEdge
+
+ # @return [String] the name of the origin of the edge
+ attr_reader :origin_name
+
+ # @return [String] the name of the destination of the edge
+ attr_reader :destination_name
+
+ # @return [Object] the requirement that the edge represents
+ attr_reader :requirement
+
+ # @param [DependencyGraph] graph the graph to find vertices from
+ # @return [Edge] The edge this action adds
+ def make_edge(graph)
+ Edge.new(
+ graph.vertex_named(origin_name),
+ graph.vertex_named(destination_name),
+ requirement
+ )
+ end
+
+ # Initialize an action to add an edge to a dependency graph
+ # @param [String] origin_name the name of the origin of the edge
+ # @param [String] destination_name the name of the destination of the edge
+ # @param [Object] requirement the requirement that the edge represents
+ def initialize(origin_name, destination_name, requirement)
+ @origin_name = origin_name
+ @destination_name = destination_name
+ @requirement = requirement
+ end
+ end
+ end
+end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
index 78c0da67ef..fdb6f102b3 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
@@ -8,7 +8,7 @@ module Bundler::Molinillo
# @!group Action
# (see Action#name)
- def self.name
+ def self.action_name
:add_vertex
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb
index 863b4912be..72a705e023 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular'
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex'
+require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge'
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named'
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload'
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag'
@@ -40,6 +41,16 @@ module Bundler::Molinillo
push_action(graph, AddEdgeNoCircular.new(origin, destination, requirement))
end
+ # {include:DependencyGraph#delete_edge}
+ # @param [Graph] graph the graph to perform the action on
+ # @param [String] origin_name
+ # @param [String] destination_name
+ # @param [Object] requirement
+ # @return (see DependencyGraph#delete_edge)
+ def delete_edge(graph, origin_name, destination_name, requirement)
+ push_action(graph, DeleteEdge.new(origin_name, destination_name, requirement))
+ end
+
# @macro action
def set_payload(graph, name, payload)
push_action(graph, SetPayload.new(name, payload))
@@ -92,7 +103,7 @@ module Bundler::Molinillo
loop do
action = pop!(graph)
raise "No tag #{tag.inspect} found" unless action
- break if action.class.name == :tag && action.tag == tag
+ break if action.class.action_name == :tag && action.tag == tag
end
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb
index f2fe4b0289..8d8e10fedf 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb
@@ -7,8 +7,8 @@ module Bundler::Molinillo
class SetPayload < Action # :nodoc:
# @!group Action
- # (see Action.name)
- def self.name
+ # (see Action.action_name)
+ def self.action_name
:set_payload
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb
index cb0e626e6a..53524d36ad 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb
@@ -7,8 +7,8 @@ module Bundler::Molinillo
class Tag < Action
# @!group Action
- # (see Action.name)
- def self.name
+ # (see Action.action_name)
+ def self.action_name
:tag
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
index f840e7ea30..1880df2e10 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Bundler::Molinillo
# The version of Bundler::Molinillo.
- VERSION = '0.5.1'.freeze
+ VERSION = '0.5.3'.freeze
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb
index 1890d95a56..2686a8ee70 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb
@@ -356,10 +356,14 @@ module Bundler::Molinillo
# @return [void]
def fixup_swapped_children(vertex)
payload = vertex.payload
- dep_names = dependencies_for(payload).map(&method(:name_for))
- vertex.successors.each do |succ|
- if !dep_names.include?(succ.name) && !succ.root? && succ.predecessors.to_a == [vertex]
+ deps = dependencies_for(payload).group_by(&method(:name_for))
+ vertex.outgoing_edges.each do |outgoing_edge|
+ @parent_of[outgoing_edge.requirement] = states.size - 1
+ succ = outgoing_edge.destination
+ matching_deps = Array(deps[succ.name])
+ if matching_deps.empty? && !succ.root? && succ.predecessors.to_a == [vertex]
debug(depth) { "Removing orphaned spec #{succ.name} after swapping #{name}" }
+ succ.requirements.each { |r| @parent_of.delete(r) }
activated.detach_vertex_named(succ.name)
all_successor_names = succ.recursive_successors.map(&:name)
@@ -368,6 +372,9 @@ module Bundler::Molinillo
requirement_name = name_for(requirement)
(requirement_name == succ.name) || all_successor_names.include?(requirement_name)
end
+ elsif !matching_deps.include?(outgoing_edge.requirement)
+ activated.delete_edge(outgoing_edge)
+ requirements.delete(outgoing_edge.requirement)
end
end
end