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,188 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "bundler/vendored_thor" unless defined?(Thor)
|
3
|
+
require "bundler"
|
4
|
+
|
5
|
+
module Bundler
|
6
|
+
class GemHelper
|
7
|
+
include Rake::DSL if defined? Rake::DSL
|
8
|
+
|
9
|
+
class << self
|
10
|
+
# set when install'd.
|
11
|
+
attr_accessor :instance
|
12
|
+
|
13
|
+
def install_tasks(opts = {})
|
14
|
+
new(opts[:dir], opts[:name]).install
|
15
|
+
end
|
16
|
+
|
17
|
+
def gemspec(&block)
|
18
|
+
gemspec = instance.gemspec
|
19
|
+
block.call(gemspec) if block
|
20
|
+
gemspec
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
attr_reader :spec_path, :base, :gemspec
|
25
|
+
|
26
|
+
def initialize(base = nil, name = nil)
|
27
|
+
Bundler.ui = UI::Shell.new
|
28
|
+
@base = (base ||= SharedHelpers.pwd)
|
29
|
+
gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
|
30
|
+
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
|
31
|
+
@spec_path = gemspecs.first
|
32
|
+
@gemspec = Bundler.load_gemspec(@spec_path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def install
|
36
|
+
built_gem_path = nil
|
37
|
+
|
38
|
+
desc "Build #{name}-#{version}.gem into the pkg directory."
|
39
|
+
task "build" do
|
40
|
+
built_gem_path = build_gem
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Build and install #{name}-#{version}.gem into system gems."
|
44
|
+
task "install" => "build" do
|
45
|
+
install_gem(built_gem_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "Build and install #{name}-#{version}.gem into system gems without network access."
|
49
|
+
task "install:local" => "build" do
|
50
|
+
install_gem(built_gem_path, :local)
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems\n" \
|
54
|
+
"To prevent publishing in Rubygems use `gem_push=no rake release`"
|
55
|
+
task "release", [:remote] => ["build", "release:guard_clean",
|
56
|
+
"release:source_control_push", "release:rubygem_push"] do
|
57
|
+
end
|
58
|
+
|
59
|
+
task "release:guard_clean" do
|
60
|
+
guard_clean
|
61
|
+
end
|
62
|
+
|
63
|
+
task "release:source_control_push", [:remote] do |_, args|
|
64
|
+
tag_version { git_push(args[:remote]) } unless already_tagged?
|
65
|
+
end
|
66
|
+
|
67
|
+
task "release:rubygem_push" do
|
68
|
+
rubygem_push(built_gem_path) if gem_push?
|
69
|
+
end
|
70
|
+
|
71
|
+
GemHelper.instance = self
|
72
|
+
end
|
73
|
+
|
74
|
+
def build_gem
|
75
|
+
file_name = nil
|
76
|
+
sh("gem build -V '#{spec_path}'") do
|
77
|
+
file_name = File.basename(built_gem_path)
|
78
|
+
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
|
79
|
+
FileUtils.mv(built_gem_path, "pkg")
|
80
|
+
Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}."
|
81
|
+
end
|
82
|
+
File.join(base, "pkg", file_name)
|
83
|
+
end
|
84
|
+
|
85
|
+
def install_gem(built_gem_path = nil, local = false)
|
86
|
+
built_gem_path ||= build_gem
|
87
|
+
out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}")
|
88
|
+
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
|
89
|
+
Bundler.ui.confirm "#{name} (#{version}) installed."
|
90
|
+
end
|
91
|
+
|
92
|
+
protected
|
93
|
+
|
94
|
+
def rubygem_push(path)
|
95
|
+
allowed_push_host = nil
|
96
|
+
gem_command = "gem push '#{path}'"
|
97
|
+
if @gemspec.respond_to?(:metadata)
|
98
|
+
allowed_push_host = @gemspec.metadata["allowed_push_host"]
|
99
|
+
gem_command += " --host #{allowed_push_host}" if allowed_push_host
|
100
|
+
end
|
101
|
+
unless allowed_push_host || Pathname.new("~/.gem/credentials").expand_path.file?
|
102
|
+
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
|
103
|
+
end
|
104
|
+
sh(gem_command)
|
105
|
+
Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}"
|
106
|
+
end
|
107
|
+
|
108
|
+
def built_gem_path
|
109
|
+
Dir[File.join(base, "#{name}-*.gem")].sort_by {|f| File.mtime(f) }.last
|
110
|
+
end
|
111
|
+
|
112
|
+
def git_push(remote = "")
|
113
|
+
perform_git_push remote
|
114
|
+
perform_git_push "#{remote} --tags"
|
115
|
+
Bundler.ui.confirm "Pushed git commits and tags."
|
116
|
+
end
|
117
|
+
|
118
|
+
def perform_git_push(options = "")
|
119
|
+
cmd = "git push #{options}"
|
120
|
+
out, code = sh_with_code(cmd)
|
121
|
+
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
|
122
|
+
end
|
123
|
+
|
124
|
+
def already_tagged?
|
125
|
+
return false unless sh("git tag").split(/\n/).include?(version_tag)
|
126
|
+
Bundler.ui.confirm "Tag #{version_tag} has already been created."
|
127
|
+
true
|
128
|
+
end
|
129
|
+
|
130
|
+
def guard_clean
|
131
|
+
clean? && committed? || raise("There are files that need to be committed first.")
|
132
|
+
end
|
133
|
+
|
134
|
+
def clean?
|
135
|
+
sh_with_code("git diff --exit-code")[1] == 0
|
136
|
+
end
|
137
|
+
|
138
|
+
def committed?
|
139
|
+
sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0
|
140
|
+
end
|
141
|
+
|
142
|
+
def tag_version
|
143
|
+
sh "git tag -a -m \"Version #{version}\" #{version_tag}"
|
144
|
+
Bundler.ui.confirm "Tagged #{version_tag}."
|
145
|
+
yield if block_given?
|
146
|
+
rescue
|
147
|
+
Bundler.ui.error "Untagging #{version_tag} due to error."
|
148
|
+
sh_with_code "git tag -d #{version_tag}"
|
149
|
+
raise
|
150
|
+
end
|
151
|
+
|
152
|
+
def version
|
153
|
+
gemspec.version
|
154
|
+
end
|
155
|
+
|
156
|
+
def version_tag
|
157
|
+
"v#{version}"
|
158
|
+
end
|
159
|
+
|
160
|
+
def name
|
161
|
+
gemspec.name
|
162
|
+
end
|
163
|
+
|
164
|
+
def sh(cmd, &block)
|
165
|
+
out, code = sh_with_code(cmd, &block)
|
166
|
+
unless code.zero?
|
167
|
+
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
168
|
+
end
|
169
|
+
out
|
170
|
+
end
|
171
|
+
|
172
|
+
def sh_with_code(cmd, &block)
|
173
|
+
cmd += " 2>&1"
|
174
|
+
outbuf = String.new
|
175
|
+
Bundler.ui.debug(cmd)
|
176
|
+
SharedHelpers.chdir(base) do
|
177
|
+
outbuf = `#{cmd}`
|
178
|
+
status = $?.exitstatus
|
179
|
+
block.call(outbuf) if status.zero? && block
|
180
|
+
[outbuf, status]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def gem_push?
|
185
|
+
! %w(n no nil false off 0).include?(ENV["gem_push"].to_s.downcase)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler
|
3
|
+
module GemHelpers
|
4
|
+
GENERIC_CACHE = {} # rubocop:disable MutableConstant
|
5
|
+
GENERICS = [
|
6
|
+
[Gem::Platform.new("java"), Gem::Platform.new("java")],
|
7
|
+
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
|
8
|
+
[Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
|
9
|
+
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
|
10
|
+
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
11
|
+
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
12
|
+
[Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
def generic(p)
|
16
|
+
return p if p == Gem::Platform::RUBY
|
17
|
+
|
18
|
+
GENERIC_CACHE[p] ||= begin
|
19
|
+
_, found = GENERICS.find do |match, _generic|
|
20
|
+
p.os == match.os && (!match.cpu || p.cpu == match.cpu)
|
21
|
+
end
|
22
|
+
found || Gem::Platform::RUBY
|
23
|
+
end
|
24
|
+
end
|
25
|
+
module_function :generic
|
26
|
+
|
27
|
+
def generic_local_platform
|
28
|
+
generic(Gem::Platform.local)
|
29
|
+
end
|
30
|
+
module_function :generic_local_platform
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rubygems/remote_fetcher"
|
3
|
+
|
4
|
+
module Bundler
|
5
|
+
# Adds support for setting custom HTTP headers when fetching gems from the
|
6
|
+
# server.
|
7
|
+
#
|
8
|
+
# TODO: Get rid of this when and if gemstash only supports RubyGems versions
|
9
|
+
# that contain https://github.com/rubygems/rubygems/commit/3db265cc20b2f813.
|
10
|
+
class GemRemoteFetcher < Gem::RemoteFetcher
|
11
|
+
attr_accessor :headers
|
12
|
+
|
13
|
+
# Extracted from RubyGems 2.4.
|
14
|
+
def fetch_http(uri, last_modified = nil, head = false, depth = 0)
|
15
|
+
fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get
|
16
|
+
# beginning of change
|
17
|
+
response = request uri, fetch_type, last_modified do |req|
|
18
|
+
headers.each {|k, v| req.add_field(k, v) } if headers
|
19
|
+
end
|
20
|
+
# end of change
|
21
|
+
|
22
|
+
case response
|
23
|
+
when Net::HTTPOK, Net::HTTPNotModified then
|
24
|
+
response.uri = uri if response.respond_to? :uri
|
25
|
+
head ? response : response.body
|
26
|
+
when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther,
|
27
|
+
Net::HTTPTemporaryRedirect then
|
28
|
+
raise FetchError.new("too many redirects", uri) if depth > 10
|
29
|
+
|
30
|
+
location = URI.parse response["Location"]
|
31
|
+
|
32
|
+
if https?(uri) && !https?(location)
|
33
|
+
raise FetchError.new("redirecting to non-https resource: #{location}", uri)
|
34
|
+
end
|
35
|
+
|
36
|
+
fetch_http(location, last_modified, head, depth + 1)
|
37
|
+
else
|
38
|
+
raise FetchError.new("bad response #{response.message} #{response.code}", uri)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,172 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "set"
|
3
|
+
module Bundler
|
4
|
+
class Graph
|
5
|
+
GRAPH_NAME = :Gemfile
|
6
|
+
|
7
|
+
def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png", without = [])
|
8
|
+
@env = env
|
9
|
+
@output_file = output_file
|
10
|
+
@show_version = show_version
|
11
|
+
@show_requirements = show_requirements
|
12
|
+
@output_format = output_format
|
13
|
+
@without_groups = without.map(&:to_sym)
|
14
|
+
|
15
|
+
@groups = []
|
16
|
+
@relations = Hash.new {|h, k| h[k] = Set.new }
|
17
|
+
@node_options = {}
|
18
|
+
@edge_options = {}
|
19
|
+
|
20
|
+
_patching_gem_dependency_class
|
21
|
+
_populate_relations
|
22
|
+
end
|
23
|
+
|
24
|
+
attr_reader :groups, :relations, :node_options, :edge_options, :output_file, :output_format
|
25
|
+
|
26
|
+
def viz
|
27
|
+
GraphVizClient.new(self).run
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def _populate_relations
|
33
|
+
parent_dependencies = _groups.values.to_set.flatten
|
34
|
+
loop do
|
35
|
+
break if parent_dependencies.empty?
|
36
|
+
|
37
|
+
tmp = Set.new
|
38
|
+
parent_dependencies.each do |dependency|
|
39
|
+
# if the dependency is a prerelease, allow to_spec to be non-nil
|
40
|
+
dependency.prerelease = true
|
41
|
+
|
42
|
+
child_dependencies = dependency.to_spec.runtime_dependencies.to_set
|
43
|
+
@relations[dependency.name] += child_dependencies.map(&:name).to_set
|
44
|
+
tmp += child_dependencies
|
45
|
+
|
46
|
+
@node_options[dependency.name] = _make_label(dependency, :node)
|
47
|
+
child_dependencies.each do |c_dependency|
|
48
|
+
@edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
parent_dependencies = tmp
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def _groups
|
56
|
+
relations = Hash.new {|h, k| h[k] = Set.new }
|
57
|
+
@env.current_dependencies.each do |dependency|
|
58
|
+
dependency.groups.each do |group|
|
59
|
+
next if @without_groups.include?(group)
|
60
|
+
|
61
|
+
relations[group.to_s].add(dependency)
|
62
|
+
@relations[group.to_s].add(dependency.name)
|
63
|
+
|
64
|
+
@node_options[group.to_s] ||= _make_label(group, :node)
|
65
|
+
@edge_options["#{group}_#{dependency.name}"] = _make_label(dependency, :edge)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
@groups = relations.keys
|
69
|
+
relations
|
70
|
+
end
|
71
|
+
|
72
|
+
def _make_label(symbol_or_string_or_dependency, element_type)
|
73
|
+
case element_type.to_sym
|
74
|
+
when :node
|
75
|
+
if symbol_or_string_or_dependency.is_a?(Gem::Dependency)
|
76
|
+
label = symbol_or_string_or_dependency.name.dup
|
77
|
+
label << "\n#{symbol_or_string_or_dependency.to_spec.version}" if @show_version
|
78
|
+
else
|
79
|
+
label = symbol_or_string_or_dependency.to_s
|
80
|
+
end
|
81
|
+
when :edge
|
82
|
+
label = nil
|
83
|
+
if symbol_or_string_or_dependency.respond_to?(:requirements_list) && @show_requirements
|
84
|
+
tmp = symbol_or_string_or_dependency.requirements_list.join(", ")
|
85
|
+
label = tmp if tmp != ">= 0"
|
86
|
+
end
|
87
|
+
else
|
88
|
+
raise ArgumentError, "2nd argument is invalid"
|
89
|
+
end
|
90
|
+
label.nil? ? {} : { :label => label }
|
91
|
+
end
|
92
|
+
|
93
|
+
def _patching_gem_dependency_class
|
94
|
+
# method borrow from rubygems/dependency.rb
|
95
|
+
# redefinition of matching_specs will also redefine to_spec and to_specs
|
96
|
+
Gem::Dependency.class_eval do
|
97
|
+
def matching_specs(platform_only = false)
|
98
|
+
matches = Bundler.load.specs.select do |spec|
|
99
|
+
name == spec.name &&
|
100
|
+
requirement.satisfied_by?(spec.version)
|
101
|
+
end
|
102
|
+
|
103
|
+
if platform_only
|
104
|
+
matches.select! do |spec|
|
105
|
+
Gem::Platform.match spec.platform
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
matches = matches.sort_by(&:sort_obj) # HACK: shouldn't be needed
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
class GraphVizClient
|
115
|
+
def initialize(graph_instance)
|
116
|
+
@graph_name = graph_instance.class::GRAPH_NAME
|
117
|
+
@groups = graph_instance.groups
|
118
|
+
@relations = graph_instance.relations
|
119
|
+
@node_options = graph_instance.node_options
|
120
|
+
@edge_options = graph_instance.edge_options
|
121
|
+
@output_file = graph_instance.output_file
|
122
|
+
@output_format = graph_instance.output_format
|
123
|
+
end
|
124
|
+
|
125
|
+
def g
|
126
|
+
@g ||= ::GraphViz.digraph(@graph_name, :concentrate => true, :normalize => true, :nodesep => 0.55) do |g|
|
127
|
+
g.edge[:weight] = 2
|
128
|
+
g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif"
|
129
|
+
g.edge[:fontsize] = 12
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def run
|
134
|
+
@groups.each do |group|
|
135
|
+
g.add_nodes(
|
136
|
+
group, {
|
137
|
+
:style => "filled",
|
138
|
+
:fillcolor => "#B9B9D5",
|
139
|
+
:shape => "box3d",
|
140
|
+
:fontsize => 16
|
141
|
+
}.merge(@node_options[group])
|
142
|
+
)
|
143
|
+
end
|
144
|
+
|
145
|
+
@relations.each do |parent, children|
|
146
|
+
children.each do |child|
|
147
|
+
if @groups.include?(parent)
|
148
|
+
g.add_nodes(child, { :style => "filled", :fillcolor => "#B9B9D5" }.merge(@node_options[child]))
|
149
|
+
g.add_edges(parent, child, { :constraint => false }.merge(@edge_options["#{parent}_#{child}"]))
|
150
|
+
else
|
151
|
+
g.add_nodes(child, @node_options[child])
|
152
|
+
g.add_edges(parent, child, @edge_options["#{parent}_#{child}"])
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
if @output_format.to_s == "debug"
|
158
|
+
$stdout.puts g.output :none => String
|
159
|
+
Bundler.ui.info "debugging bundle viz..."
|
160
|
+
else
|
161
|
+
begin
|
162
|
+
g.output @output_format.to_sym => "#{@output_file}.#{@output_format}"
|
163
|
+
Bundler.ui.info "#{@output_file}.#{@output_format}"
|
164
|
+
rescue ArgumentError => e
|
165
|
+
$stderr.puts "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb"
|
166
|
+
raise e
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "set"
|
3
|
+
|
4
|
+
module Bundler
|
5
|
+
class Index
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
def self.build
|
9
|
+
i = new
|
10
|
+
yield i
|
11
|
+
i
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :specs, :all_specs, :sources
|
15
|
+
protected :specs, :all_specs
|
16
|
+
|
17
|
+
RUBY = "ruby".freeze
|
18
|
+
NULL = "\0".freeze
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@sources = []
|
22
|
+
@cache = {}
|
23
|
+
@specs = Hash.new {|h, k| h[k] = {} }
|
24
|
+
@all_specs = Hash.new {|h, k| h[k] = EMPTY_SEARCH }
|
25
|
+
end
|
26
|
+
|
27
|
+
def initialize_copy(o)
|
28
|
+
@sources = o.sources.dup
|
29
|
+
@cache = {}
|
30
|
+
@specs = Hash.new {|h, k| h[k] = {} }
|
31
|
+
@all_specs = Hash.new {|h, k| h[k] = EMPTY_SEARCH }
|
32
|
+
|
33
|
+
o.specs.each do |name, hash|
|
34
|
+
@specs[name] = hash.dup
|
35
|
+
end
|
36
|
+
o.all_specs.each do |name, array|
|
37
|
+
@all_specs[name] = array.dup
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def inspect
|
42
|
+
"#<#{self.class}:0x#{object_id} sources=#{sources.map(&:inspect)} specs.size=#{specs.size}>"
|
43
|
+
end
|
44
|
+
|
45
|
+
def empty?
|
46
|
+
each { return false }
|
47
|
+
true
|
48
|
+
end
|
49
|
+
|
50
|
+
def search_all(name)
|
51
|
+
all_matches = local_search(name) + @all_specs[name]
|
52
|
+
@sources.each do |source|
|
53
|
+
all_matches.concat(source.search_all(name))
|
54
|
+
end
|
55
|
+
all_matches
|
56
|
+
end
|
57
|
+
|
58
|
+
# Search this index's specs, and any source indexes that this index knows
|
59
|
+
# about, returning all of the results.
|
60
|
+
def search(query, base = nil)
|
61
|
+
results = local_search(query, base)
|
62
|
+
seen = results.map(&:full_name).to_set
|
63
|
+
|
64
|
+
@sources.each do |source|
|
65
|
+
source.search(query, base).each do |spec|
|
66
|
+
results << spec if seen.add?(spec.full_name)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
results.sort_by do |s|
|
71
|
+
platform_string = s.platform.to_s
|
72
|
+
[s.version, platform_string == RUBY ? NULL : platform_string]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def local_search(query, base = nil)
|
77
|
+
case query
|
78
|
+
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
|
79
|
+
when String then specs_by_name(query)
|
80
|
+
when Gem::Dependency then search_by_dependency(query, base)
|
81
|
+
when DepProxy then search_by_dependency(query.dep, base)
|
82
|
+
else
|
83
|
+
raise "You can't search for a #{query.inspect}."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
alias_method :[], :search
|
88
|
+
|
89
|
+
def <<(spec)
|
90
|
+
@specs[spec.name][spec.full_name] = spec
|
91
|
+
spec
|
92
|
+
end
|
93
|
+
|
94
|
+
def each(&blk)
|
95
|
+
return enum_for(:each) unless blk
|
96
|
+
specs.values.each do |spec_sets|
|
97
|
+
spec_sets.values.each(&blk)
|
98
|
+
end
|
99
|
+
sources.each {|s| s.each(&blk) }
|
100
|
+
end
|
101
|
+
|
102
|
+
# returns a list of the dependencies
|
103
|
+
def unmet_dependency_names
|
104
|
+
names = dependency_names
|
105
|
+
names.delete_if {|n| n == "bundler" }
|
106
|
+
names.select {|n| search(n).empty? }
|
107
|
+
end
|
108
|
+
|
109
|
+
def dependency_names
|
110
|
+
names = []
|
111
|
+
each {|s| names.concat(s.dependencies.map(&:name)) }
|
112
|
+
names.uniq
|
113
|
+
end
|
114
|
+
|
115
|
+
def use(other, override_dupes = false)
|
116
|
+
return unless other
|
117
|
+
other.each do |s|
|
118
|
+
if (dupes = search_by_spec(s)) && !dupes.empty?
|
119
|
+
# safe to << since it's a new array when it has contents
|
120
|
+
@all_specs[s.name] = dupes << s
|
121
|
+
next unless override_dupes
|
122
|
+
end
|
123
|
+
self << s
|
124
|
+
end
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
def size
|
129
|
+
@sources.inject(@specs.size) do |size, source|
|
130
|
+
size += source.size
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def ==(other)
|
135
|
+
all? do |spec|
|
136
|
+
other_spec = other[spec].first
|
137
|
+
other_spec && dependencies_eql?(spec, other_spec) && spec.source == other_spec.source
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def dependencies_eql?(spec, other_spec)
|
142
|
+
deps = spec.dependencies.select {|d| d.type != :development }
|
143
|
+
other_deps = other_spec.dependencies.select {|d| d.type != :development }
|
144
|
+
Set.new(deps) == Set.new(other_deps)
|
145
|
+
end
|
146
|
+
|
147
|
+
def add_source(index)
|
148
|
+
raise ArgumentError, "Source must be an index, not #{index.class}" unless index.is_a?(Index)
|
149
|
+
@sources << index
|
150
|
+
@sources.uniq! # need to use uniq! here instead of checking for the item before adding
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
def specs_by_name(name)
|
156
|
+
@specs[name].values
|
157
|
+
end
|
158
|
+
|
159
|
+
def search_by_dependency(dependency, base = nil)
|
160
|
+
@cache[base || false] ||= {}
|
161
|
+
@cache[base || false][dependency] ||= begin
|
162
|
+
specs = specs_by_name(dependency.name)
|
163
|
+
specs += base if base
|
164
|
+
found = specs.select do |spec|
|
165
|
+
next true if spec.source.is_a?(Source::Gemspec)
|
166
|
+
if base # allow all platforms when searching from a lockfile
|
167
|
+
dependency.matches_spec?(spec)
|
168
|
+
else
|
169
|
+
dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
wants_prerelease = dependency.requirement.prerelease?
|
174
|
+
only_prerelease = specs.all? {|spec| spec.version.prerelease? }
|
175
|
+
|
176
|
+
unless wants_prerelease || only_prerelease
|
177
|
+
found.reject! {|spec| spec.version.prerelease? }
|
178
|
+
end
|
179
|
+
|
180
|
+
found
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
EMPTY_SEARCH = [].freeze
|
185
|
+
|
186
|
+
def search_by_spec(spec)
|
187
|
+
spec = @specs[spec.name][spec.full_name]
|
188
|
+
spec ? [spec] : EMPTY_SEARCH
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|