rubygems-update 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +18 -24
- data/CODE_OF_CONDUCT.md +2 -2
- data/CONTRIBUTING.rdoc +1 -1
- data/History.txt +30 -1
- data/Manifest.txt +233 -3
- data/Rakefile +30 -1
- data/appveyor.yml +0 -2
- data/bundler/CHANGELOG.md +2407 -0
- data/bundler/CODE_OF_CONDUCT.md +42 -0
- data/bundler/CONTRIBUTING.md +36 -0
- data/bundler/DEVELOPMENT.md +148 -0
- data/bundler/ISSUES.md +100 -0
- data/bundler/LICENSE.md +23 -0
- data/bundler/README.md +40 -0
- data/bundler/exe/bundle +35 -0
- data/bundler/exe/bundle_ruby +61 -0
- data/bundler/exe/bundler +22 -0
- data/bundler/lib/bundler.rb +455 -0
- data/bundler/lib/bundler/capistrano.rb +17 -0
- data/bundler/lib/bundler/cli.rb +497 -0
- data/bundler/lib/bundler/cli/binstubs.rb +40 -0
- data/bundler/lib/bundler/cli/cache.rb +35 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +26 -0
- data/bundler/lib/bundler/cli/common.rb +56 -0
- data/bundler/lib/bundler/cli/config.rb +100 -0
- data/bundler/lib/bundler/cli/console.rb +39 -0
- data/bundler/lib/bundler/cli/exec.rb +82 -0
- data/bundler/lib/bundler/cli/gem.rb +214 -0
- data/bundler/lib/bundler/cli/init.rb +33 -0
- data/bundler/lib/bundler/cli/inject.rb +33 -0
- data/bundler/lib/bundler/cli/install.rb +225 -0
- data/bundler/lib/bundler/cli/lock.rb +48 -0
- data/bundler/lib/bundler/cli/open.rb +25 -0
- data/bundler/lib/bundler/cli/outdated.rb +151 -0
- data/bundler/lib/bundler/cli/package.rb +46 -0
- data/bundler/lib/bundler/cli/platform.rb +45 -0
- data/bundler/lib/bundler/cli/plugin.rb +23 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +72 -0
- data/bundler/lib/bundler/cli/viz.rb +27 -0
- data/bundler/lib/bundler/constants.rb +6 -0
- data/bundler/lib/bundler/current_ruby.rb +84 -0
- data/bundler/lib/bundler/definition.rb +744 -0
- data/bundler/lib/bundler/dep_proxy.rb +46 -0
- data/bundler/lib/bundler/dependency.rb +127 -0
- data/bundler/lib/bundler/deployment.rb +63 -0
- data/bundler/lib/bundler/deprecate.rb +16 -0
- data/bundler/lib/bundler/dsl.rb +512 -0
- data/bundler/lib/bundler/endpoint_specification.rb +129 -0
- data/bundler/lib/bundler/env.rb +83 -0
- data/bundler/lib/bundler/environment.rb +42 -0
- data/bundler/lib/bundler/environment_preserver.rb +38 -0
- data/bundler/lib/bundler/errors.rb +124 -0
- data/bundler/lib/bundler/fetcher.rb +304 -0
- data/bundler/lib/bundler/fetcher/base.rb +41 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +103 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +92 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +66 -0
- data/bundler/lib/bundler/fetcher/index.rb +51 -0
- data/bundler/lib/bundler/friendly_errors.rb +103 -0
- data/bundler/lib/bundler/gem_helper.rb +188 -0
- data/bundler/lib/bundler/gem_helpers.rb +32 -0
- data/bundler/lib/bundler/gem_remote_fetcher.rb +42 -0
- data/bundler/lib/bundler/gem_tasks.rb +6 -0
- data/bundler/lib/bundler/graph.rb +172 -0
- data/bundler/lib/bundler/index.rb +191 -0
- data/bundler/lib/bundler/injector.rb +63 -0
- data/bundler/lib/bundler/inline.rb +74 -0
- data/bundler/lib/bundler/installer.rb +217 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +77 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +126 -0
- data/bundler/lib/bundler/installer/standalone.rb +52 -0
- data/bundler/lib/bundler/lazy_specification.rb +85 -0
- data/bundler/lib/bundler/lockfile_parser.rb +233 -0
- data/bundler/lib/bundler/match_platform.rb +14 -0
- data/bundler/lib/bundler/mirror.rb +218 -0
- data/bundler/lib/bundler/plugin.rb +156 -0
- data/bundler/lib/bundler/plugin/api.rb +56 -0
- data/bundler/lib/bundler/plugin/dsl.rb +29 -0
- data/bundler/lib/bundler/plugin/index.rb +88 -0
- data/bundler/lib/bundler/plugin/installer.rb +99 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/bundler/lib/bundler/plugin/source_list.rb +24 -0
- data/bundler/lib/bundler/postit_trampoline.rb +57 -0
- data/bundler/lib/bundler/psyched_yaml.rb +27 -0
- data/bundler/lib/bundler/remote_specification.rb +85 -0
- data/bundler/lib/bundler/resolver.rb +368 -0
- data/bundler/lib/bundler/retry.rb +61 -0
- data/bundler/lib/bundler/ruby_dsl.rb +17 -0
- data/bundler/lib/bundler/ruby_version.rb +140 -0
- data/bundler/lib/bundler/rubygems_ext.rb +178 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +10 -0
- data/bundler/lib/bundler/rubygems_integration.rb +710 -0
- data/bundler/lib/bundler/runtime.rb +282 -0
- data/bundler/lib/bundler/settings.rb +259 -0
- data/bundler/lib/bundler/setup.rb +28 -0
- data/bundler/lib/bundler/shared_helpers.rb +212 -0
- data/bundler/lib/bundler/similarity_detector.rb +62 -0
- data/bundler/lib/bundler/source.rb +37 -0
- data/bundler/lib/bundler/source/gemspec.rb +13 -0
- data/bundler/lib/bundler/source/git.rb +297 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +218 -0
- data/bundler/lib/bundler/source/path.rb +245 -0
- data/bundler/lib/bundler/source/path/installer.rb +44 -0
- data/bundler/lib/bundler/source/rubygems.rb +450 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +59 -0
- data/bundler/lib/bundler/source_list.rb +106 -0
- data/bundler/lib/bundler/spec_set.rb +157 -0
- data/bundler/lib/bundler/ssl_certs/.document +1 -0
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +65 -0
- data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
- data/bundler/lib/bundler/stub_specification.rb +24 -0
- data/bundler/lib/bundler/templates/Executable +17 -0
- data/bundler/lib/bundler/templates/Executable.standalone +12 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/.travis.yml.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +41 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +46 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/bundler/lib/bundler/ui.rb +8 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +18 -0
- data/bundler/lib/bundler/ui/shell.rb +114 -0
- data/bundler/lib/bundler/ui/silent.rb +48 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +36 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +79 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +98 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +80 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +4 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +10 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +203 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +5 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +100 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +65 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +460 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +54 -0
- data/bundler/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/bundler/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/bundler/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit.rb +15 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +484 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendored_molinillo.rb +3 -0
- data/bundler/lib/bundler/vendored_persistent.rb +12 -0
- data/bundler/lib/bundler/vendored_thor.rb +4 -0
- data/bundler/lib/bundler/version.rb +11 -0
- data/bundler/lib/bundler/vlad.rb +12 -0
- data/bundler/lib/bundler/worker.rb +82 -0
- data/bundler/lib/bundler/yaml_serializer.rb +67 -0
- data/bundler/man/bundle-config.ronn +193 -0
- data/bundler/man/bundle-exec.ronn +136 -0
- data/bundler/man/bundle-gem.ronn +77 -0
- data/bundler/man/bundle-install.ronn +404 -0
- data/bundler/man/bundle-lock.ronn +47 -0
- data/bundler/man/bundle-package.ronn +67 -0
- data/bundler/man/bundle-platform.ronn +42 -0
- data/bundler/man/bundle-update.ronn +194 -0
- data/bundler/man/bundle.ronn +98 -0
- data/bundler/man/gemfile.5.ronn +499 -0
- data/bundler/man/index.txt +8 -0
- data/lib/rubygems.rb +42 -2
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/defaults.rb +18 -0
- data/lib/rubygems/installer.rb +1 -0
- data/lib/rubygems/package.rb +3 -1
- data/lib/rubygems/package/tar_writer.rb +10 -16
- data/lib/rubygems/remote_fetcher.rb +1 -15
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +57 -145
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +55 -54
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
- data/lib/rubygems/security/signer.rb +2 -0
- data/lib/rubygems/specification.rb +4 -4
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/test/rubygems/alternate_cert.pem +10 -9
- data/test/rubygems/alternate_cert_32.pem +10 -9
- data/test/rubygems/child_cert.pem +11 -9
- data/test/rubygems/child_cert_32.pem +11 -9
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +9 -8
- data/test/rubygems/future_cert.pem +9 -8
- data/test/rubygems/future_cert_32.pem +9 -8
- data/test/rubygems/grandchild_cert.pem +11 -9
- data/test/rubygems/grandchild_cert_32.pem +11 -9
- data/test/rubygems/invalid_issuer_cert.pem +11 -9
- data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
- data/test/rubygems/invalid_signer_cert.pem +10 -9
- data/test/rubygems/invalid_signer_cert_32.pem +10 -9
- data/test/rubygems/invalidchild_cert.pem +11 -9
- data/test/rubygems/invalidchild_cert_32.pem +11 -9
- data/test/rubygems/public_cert.pem +11 -9
- data/test/rubygems/public_cert_32.pem +10 -9
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_gem.rb +7 -0
- data/test/rubygems/test_gem_installer.rb +119 -0
- data/test/rubygems/test_gem_package.rb +9 -3
- data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +0 -12
- data/test/rubygems/test_gem_security_signer.rb +8 -0
- data/test/rubygems/test_gem_specification.rb +1 -1
- data/test/rubygems/wrong_key_cert.pem +10 -9
- data/test/rubygems/wrong_key_cert_32.pem +10 -9
- data/util/ci +73 -0
- data/util/create_certs.rb +64 -49
- data/util/update_bundled_ca_certificates.rb +23 -2
- metadata +257 -19
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -0,0 +1,203 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'set'
|
3
|
+
require 'tsort'
|
4
|
+
|
5
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/log'
|
6
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex'
|
7
|
+
|
8
|
+
module Bundler::Molinillo
|
9
|
+
# A directed acyclic graph that is tuned to hold named dependencies
|
10
|
+
class DependencyGraph
|
11
|
+
include Enumerable
|
12
|
+
|
13
|
+
# Enumerates through the vertices of the graph.
|
14
|
+
# @return [Array<Vertex>] The graph's vertices.
|
15
|
+
def each
|
16
|
+
return vertices.values.each unless block_given?
|
17
|
+
vertices.values.each { |v| yield v }
|
18
|
+
end
|
19
|
+
|
20
|
+
include TSort
|
21
|
+
|
22
|
+
# @!visibility private
|
23
|
+
alias tsort_each_node each
|
24
|
+
|
25
|
+
# @!visibility private
|
26
|
+
def tsort_each_child(vertex, &block)
|
27
|
+
vertex.successors.each(&block)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Topologically sorts the given vertices.
|
31
|
+
# @param [Enumerable<Vertex>] vertices the vertices to be sorted, which must
|
32
|
+
# all belong to the same graph.
|
33
|
+
# @return [Array<Vertex>] The sorted vertices.
|
34
|
+
def self.tsort(vertices)
|
35
|
+
TSort.tsort(
|
36
|
+
lambda { |b| vertices.each(&b) },
|
37
|
+
lambda { |v, &b| (v.successors & vertices).each(&b) }
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
# A directed edge of a {DependencyGraph}
|
42
|
+
# @attr [Vertex] origin The origin of the directed edge
|
43
|
+
# @attr [Vertex] destination The destination of the directed edge
|
44
|
+
# @attr [Object] requirement The requirement the directed edge represents
|
45
|
+
Edge = Struct.new(:origin, :destination, :requirement)
|
46
|
+
|
47
|
+
# @return [{String => Vertex}] the vertices of the dependency graph, keyed
|
48
|
+
# by {Vertex#name}
|
49
|
+
attr_reader :vertices
|
50
|
+
|
51
|
+
# @return [Log] the op log for this graph
|
52
|
+
attr_reader :log
|
53
|
+
|
54
|
+
# Initializes an empty dependency graph
|
55
|
+
def initialize
|
56
|
+
@vertices = {}
|
57
|
+
@log = Log.new
|
58
|
+
end
|
59
|
+
|
60
|
+
# Tags the current state of the dependency as the given tag
|
61
|
+
# @param [Object] tag an opaque tag for the current state of the graph
|
62
|
+
# @return [Void]
|
63
|
+
def tag(tag)
|
64
|
+
log.tag(self, tag)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Rewinds the graph to the state tagged as `tag`
|
68
|
+
# @param [Object] tag the tag to rewind to
|
69
|
+
# @return [Void]
|
70
|
+
def rewind_to(tag)
|
71
|
+
log.rewind_to(self, tag)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes a copy of a {DependencyGraph}, ensuring that all {#vertices}
|
75
|
+
# are properly copied.
|
76
|
+
# @param [DependencyGraph] other the graph to copy.
|
77
|
+
def initialize_copy(other)
|
78
|
+
super
|
79
|
+
@vertices = {}
|
80
|
+
@log = other.log.dup
|
81
|
+
traverse = lambda do |new_v, old_v|
|
82
|
+
return if new_v.outgoing_edges.size == old_v.outgoing_edges.size
|
83
|
+
old_v.outgoing_edges.each do |edge|
|
84
|
+
destination = add_vertex(edge.destination.name, edge.destination.payload)
|
85
|
+
add_edge_no_circular(new_v, destination, edge.requirement)
|
86
|
+
traverse.call(destination, edge.destination)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
other.vertices.each do |name, vertex|
|
90
|
+
new_vertex = add_vertex(name, vertex.payload, vertex.root?)
|
91
|
+
new_vertex.explicit_requirements.replace(vertex.explicit_requirements)
|
92
|
+
traverse.call(new_vertex, vertex)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# @return [String] a string suitable for debugging
|
97
|
+
def inspect
|
98
|
+
"#{self.class}:#{vertices.values.inspect}"
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [String] Returns a dot format representation of the graph
|
102
|
+
def to_dot
|
103
|
+
dot_vertices = []
|
104
|
+
dot_edges = []
|
105
|
+
vertices.each do |n, v|
|
106
|
+
dot_vertices << " #{n} [label=\"{#{n}|#{v.payload}}\"]"
|
107
|
+
v.outgoing_edges.each do |e|
|
108
|
+
dot_edges << " #{e.origin.name} -> #{e.destination.name} [label=\"#{e.requirement}\"]"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
dot_vertices.sort!
|
112
|
+
dot_edges.sort!
|
113
|
+
dot = dot_vertices.unshift('digraph G {').push('') + dot_edges.push('}')
|
114
|
+
dot.join("\n")
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [Boolean] whether the two dependency graphs are equal, determined
|
118
|
+
# by a recursive traversal of each {#root_vertices} and its
|
119
|
+
# {Vertex#successors}
|
120
|
+
def ==(other)
|
121
|
+
return false unless other
|
122
|
+
vertices.each do |name, vertex|
|
123
|
+
other_vertex = other.vertex_named(name)
|
124
|
+
return false unless other_vertex
|
125
|
+
return false unless other_vertex.successors.map(&:name).to_set == vertex.successors.map(&:name).to_set
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# @param [String] name
|
130
|
+
# @param [Object] payload
|
131
|
+
# @param [Array<String>] parent_names
|
132
|
+
# @param [Object] requirement the requirement that is requiring the child
|
133
|
+
# @return [void]
|
134
|
+
def add_child_vertex(name, payload, parent_names, requirement)
|
135
|
+
root = !parent_names.delete(nil) { true }
|
136
|
+
vertex = add_vertex(name, payload, root)
|
137
|
+
parent_names.each do |parent_name|
|
138
|
+
parent_node = vertex_named(parent_name)
|
139
|
+
add_edge(parent_node, vertex, requirement)
|
140
|
+
end
|
141
|
+
vertex
|
142
|
+
end
|
143
|
+
|
144
|
+
# Adds a vertex with the given name, or updates the existing one.
|
145
|
+
# @param [String] name
|
146
|
+
# @param [Object] payload
|
147
|
+
# @return [Vertex] the vertex that was added to `self`
|
148
|
+
def add_vertex(name, payload, root = false)
|
149
|
+
log.add_vertex(self, name, payload, root)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Detaches the {#vertex_named} `name` {Vertex} from the graph, recursively
|
153
|
+
# removing any non-root vertices that were orphaned in the process
|
154
|
+
# @param [String] name
|
155
|
+
# @return [void]
|
156
|
+
def detach_vertex_named(name)
|
157
|
+
log.detach_vertex_named(self, name)
|
158
|
+
end
|
159
|
+
|
160
|
+
# @param [String] name
|
161
|
+
# @return [Vertex,nil] the vertex with the given name
|
162
|
+
def vertex_named(name)
|
163
|
+
vertices[name]
|
164
|
+
end
|
165
|
+
|
166
|
+
# @param [String] name
|
167
|
+
# @return [Vertex,nil] the root vertex with the given name
|
168
|
+
def root_vertex_named(name)
|
169
|
+
vertex = vertex_named(name)
|
170
|
+
vertex if vertex && vertex.root?
|
171
|
+
end
|
172
|
+
|
173
|
+
# Adds a new {Edge} to the dependency graph
|
174
|
+
# @param [Vertex] origin
|
175
|
+
# @param [Vertex] destination
|
176
|
+
# @param [Object] requirement the requirement that this edge represents
|
177
|
+
# @return [Edge] the added edge
|
178
|
+
def add_edge(origin, destination, requirement)
|
179
|
+
if destination.path_to?(origin)
|
180
|
+
raise CircularDependencyError.new([origin, destination])
|
181
|
+
end
|
182
|
+
add_edge_no_circular(origin, destination, requirement)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Sets the payload of the vertex with the given name
|
186
|
+
# @param [String] name the name of the vertex
|
187
|
+
# @param [Object] payload the payload
|
188
|
+
# @return [Void]
|
189
|
+
def set_payload(name, payload)
|
190
|
+
log.set_payload(self, name, payload)
|
191
|
+
end
|
192
|
+
|
193
|
+
private
|
194
|
+
|
195
|
+
# Adds a new {Edge} to the dependency graph without checking for
|
196
|
+
# circularity.
|
197
|
+
# @param (see #add_edge)
|
198
|
+
# @return (see #add_edge)
|
199
|
+
def add_edge_no_circular(origin, destination, requirement)
|
200
|
+
log.add_edge_no_circular(self, origin.name, destination.name, requirement)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler::Molinillo
|
3
|
+
class DependencyGraph
|
4
|
+
# An action that modifies a {DependencyGraph} that is reversible.
|
5
|
+
# @abstract
|
6
|
+
class Action
|
7
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
8
|
+
|
9
|
+
# @return [Symbol] The name of the action.
|
10
|
+
def self.name
|
11
|
+
raise 'Abstract'
|
12
|
+
end
|
13
|
+
|
14
|
+
# Performs the action on the given graph.
|
15
|
+
# @param [DependencyGraph] graph the graph to perform the action on.
|
16
|
+
# @return [Void]
|
17
|
+
def up(graph)
|
18
|
+
raise 'Abstract'
|
19
|
+
end
|
20
|
+
|
21
|
+
# Reverses the action on the given graph.
|
22
|
+
# @param [DependencyGraph] graph the graph to reverse the action on.
|
23
|
+
# @return [Void]
|
24
|
+
def down(graph)
|
25
|
+
raise 'Abstract'
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Action,Nil] The previous action
|
29
|
+
attr_accessor :previous
|
30
|
+
|
31
|
+
# @return [Action,Nil] The next action
|
32
|
+
attr_accessor :next
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
3
|
+
module Bundler::Molinillo
|
4
|
+
class DependencyGraph
|
5
|
+
# @!visibility private
|
6
|
+
# (see DependencyGraph#add_edge_no_circular)
|
7
|
+
class AddEdgeNoCircular < Action
|
8
|
+
# @!group Action
|
9
|
+
|
10
|
+
# (see Action.name)
|
11
|
+
def self.name
|
12
|
+
:add_vertex
|
13
|
+
end
|
14
|
+
|
15
|
+
# (see Action#up)
|
16
|
+
def up(graph)
|
17
|
+
edge = make_edge(graph)
|
18
|
+
edge.origin.outgoing_edges << edge
|
19
|
+
edge.destination.incoming_edges << edge
|
20
|
+
edge
|
21
|
+
end
|
22
|
+
|
23
|
+
# (see Action#down)
|
24
|
+
def down(graph)
|
25
|
+
edge = make_edge(graph)
|
26
|
+
edge.origin.outgoing_edges.delete(edge)
|
27
|
+
edge.destination.incoming_edges.delete(edge)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @!group AddEdgeNoCircular
|
31
|
+
|
32
|
+
# @return [String] the name of the origin of the edge
|
33
|
+
attr_reader :origin
|
34
|
+
|
35
|
+
# @return [String] the name of the destination of the edge
|
36
|
+
attr_reader :destination
|
37
|
+
|
38
|
+
# @return [Object] the requirement that the edge represents
|
39
|
+
attr_reader :requirement
|
40
|
+
|
41
|
+
# @param [DependencyGraph] graph the graph to find vertices from
|
42
|
+
# @return [Edge] The edge this action adds
|
43
|
+
def make_edge(graph)
|
44
|
+
Edge.new(graph.vertex_named(origin), graph.vertex_named(destination), requirement)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Initialize an action to add an edge to a dependency graph
|
48
|
+
# @param [String] origin the name of the origin of the edge
|
49
|
+
# @param [String] destination the name of the destination of the edge
|
50
|
+
# @param [Object] requirement the requirement that the edge represents
|
51
|
+
def initialize(origin, destination, requirement)
|
52
|
+
@origin = origin
|
53
|
+
@destination = destination
|
54
|
+
@requirement = requirement
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
3
|
+
module Bundler::Molinillo
|
4
|
+
class DependencyGraph
|
5
|
+
# @!visibility private
|
6
|
+
# (see DependencyGraph#add_vertex)
|
7
|
+
class AddVertex < Action # :nodoc:
|
8
|
+
# @!group Action
|
9
|
+
|
10
|
+
# (see Action.name)
|
11
|
+
def self.name
|
12
|
+
:add_vertex
|
13
|
+
end
|
14
|
+
|
15
|
+
# (see Action#up)
|
16
|
+
def up(graph)
|
17
|
+
if existing = graph.vertices[name]
|
18
|
+
@existing_payload = existing.payload
|
19
|
+
@existing_root = existing.root
|
20
|
+
end
|
21
|
+
vertex = existing || Vertex.new(name, payload)
|
22
|
+
graph.vertices[vertex.name] = vertex
|
23
|
+
vertex.payload ||= payload
|
24
|
+
vertex.root ||= root
|
25
|
+
vertex
|
26
|
+
end
|
27
|
+
|
28
|
+
# (see Action#down)
|
29
|
+
def down(graph)
|
30
|
+
if defined?(@existing_payload)
|
31
|
+
vertex = graph.vertices[name]
|
32
|
+
vertex.payload = @existing_payload
|
33
|
+
vertex.root = @existing_root
|
34
|
+
else
|
35
|
+
graph.vertices.delete(name)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# @!group AddVertex
|
40
|
+
|
41
|
+
# @return [String] the name of the vertex
|
42
|
+
attr_reader :name
|
43
|
+
|
44
|
+
# @return [Object] the payload for the vertex
|
45
|
+
attr_reader :payload
|
46
|
+
|
47
|
+
# @return [Boolean] whether the vertex is root or not
|
48
|
+
attr_reader :root
|
49
|
+
|
50
|
+
# Initialize an action to add a vertex to a dependency graph
|
51
|
+
# @param [String] name the name of the vertex
|
52
|
+
# @param [Object] payload the payload for the vertex
|
53
|
+
# @param [Boolean] root whether the vertex is root or not
|
54
|
+
def initialize(name, payload, root)
|
55
|
+
@name = name
|
56
|
+
@payload = payload
|
57
|
+
@root = root
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/action'
|
3
|
+
module Bundler::Molinillo
|
4
|
+
class DependencyGraph
|
5
|
+
# @!visibility private
|
6
|
+
# @see DependencyGraph#detach_vertex_named
|
7
|
+
class DetachVertexNamed < Action
|
8
|
+
# @!group Action
|
9
|
+
|
10
|
+
# (see Action#name)
|
11
|
+
def self.name
|
12
|
+
:add_vertex
|
13
|
+
end
|
14
|
+
|
15
|
+
# (see Action#up)
|
16
|
+
def up(graph)
|
17
|
+
return unless @vertex = graph.vertices.delete(name)
|
18
|
+
@vertex.outgoing_edges.each do |e|
|
19
|
+
v = e.destination
|
20
|
+
v.incoming_edges.delete(e)
|
21
|
+
graph.detach_vertex_named(v.name) unless v.root? || v.predecessors.any?
|
22
|
+
end
|
23
|
+
@vertex.incoming_edges.each do |e|
|
24
|
+
v = e.origin
|
25
|
+
v.outgoing_edges.delete(e)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# (see Action#down)
|
30
|
+
def down(graph)
|
31
|
+
return unless @vertex
|
32
|
+
graph.vertices[@vertex.name] = @vertex
|
33
|
+
@vertex.outgoing_edges.each do |e|
|
34
|
+
e.destination.incoming_edges << e
|
35
|
+
end
|
36
|
+
@vertex.incoming_edges.each do |e|
|
37
|
+
e.origin.outgoing_edges << e
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @!group DetachVertexNamed
|
42
|
+
|
43
|
+
# @return [String] the name of the vertex to detach
|
44
|
+
attr_reader :name
|
45
|
+
|
46
|
+
# Initialize an action to detach a vertex from a dependency graph
|
47
|
+
# @param [String] name the name of the vertex to detach
|
48
|
+
def initialize(name)
|
49
|
+
@name = name
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular'
|
3
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex'
|
4
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named'
|
5
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload'
|
6
|
+
require 'bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag'
|
7
|
+
|
8
|
+
module Bundler::Molinillo
|
9
|
+
class DependencyGraph
|
10
|
+
# A log for dependency graph actions
|
11
|
+
class Log
|
12
|
+
# Initializes an empty log
|
13
|
+
def initialize
|
14
|
+
@current_action = @first_action = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
# @!macro [new] action
|
18
|
+
# {include:DependencyGraph#$0}
|
19
|
+
# @param [Graph] graph the graph to perform the action on
|
20
|
+
# @param (see DependencyGraph#$0)
|
21
|
+
# @return (see DependencyGraph#$0)
|
22
|
+
|
23
|
+
# @macro action
|
24
|
+
def tag(graph, tag)
|
25
|
+
push_action(graph, Tag.new(tag))
|
26
|
+
end
|
27
|
+
|
28
|
+
# @macro action
|
29
|
+
def add_vertex(graph, name, payload, root)
|
30
|
+
push_action(graph, AddVertex.new(name, payload, root))
|
31
|
+
end
|
32
|
+
|
33
|
+
# @macro action
|
34
|
+
def detach_vertex_named(graph, name)
|
35
|
+
push_action(graph, DetachVertexNamed.new(name))
|
36
|
+
end
|
37
|
+
|
38
|
+
# @macro action
|
39
|
+
def add_edge_no_circular(graph, origin, destination, requirement)
|
40
|
+
push_action(graph, AddEdgeNoCircular.new(origin, destination, requirement))
|
41
|
+
end
|
42
|
+
|
43
|
+
# @macro action
|
44
|
+
def set_payload(graph, name, payload)
|
45
|
+
push_action(graph, SetPayload.new(name, payload))
|
46
|
+
end
|
47
|
+
|
48
|
+
# Pops the most recent action from the log and undoes the action
|
49
|
+
# @param [DependencyGraph] graph
|
50
|
+
# @return [Action] the action that was popped off the log
|
51
|
+
def pop!(graph)
|
52
|
+
return unless action = @current_action
|
53
|
+
unless @current_action = action.previous
|
54
|
+
@first_action = nil
|
55
|
+
end
|
56
|
+
action.down(graph)
|
57
|
+
action
|
58
|
+
end
|
59
|
+
|
60
|
+
extend Enumerable
|
61
|
+
|
62
|
+
# @!visibility private
|
63
|
+
# Enumerates each action in the log
|
64
|
+
# @yield [Action]
|
65
|
+
def each
|
66
|
+
return enum_for unless block_given?
|
67
|
+
action = @first_action
|
68
|
+
loop do
|
69
|
+
break unless action
|
70
|
+
yield action
|
71
|
+
action = action.next
|
72
|
+
end
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
# @!visibility private
|
77
|
+
# Enumerates each action in the log in reverse order
|
78
|
+
# @yield [Action]
|
79
|
+
def reverse_each
|
80
|
+
return enum_for(:reverse_each) unless block_given?
|
81
|
+
action = @current_action
|
82
|
+
loop do
|
83
|
+
break unless action
|
84
|
+
yield action
|
85
|
+
action = action.previous
|
86
|
+
end
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
# @macro action
|
91
|
+
def rewind_to(graph, tag)
|
92
|
+
loop do
|
93
|
+
action = pop!(graph)
|
94
|
+
raise "No tag #{tag.inspect} found" unless action
|
95
|
+
break if action.class.name == :tag && action.tag == tag
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
# Adds the given action to the log, running the action
|
102
|
+
# @param [DependencyGraph] graph
|
103
|
+
# @param [Action] action
|
104
|
+
# @return The value returned by `action.up`
|
105
|
+
def push_action(graph, action)
|
106
|
+
action.previous = @current_action
|
107
|
+
@current_action.next = action if @current_action
|
108
|
+
@current_action = action
|
109
|
+
@first_action ||= action
|
110
|
+
action.up(graph)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|