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,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler
|
3
|
+
class Source
|
4
|
+
class Path
|
5
|
+
class Installer < Bundler::RubyGemsGemInstaller
|
6
|
+
attr_reader :spec
|
7
|
+
|
8
|
+
def initialize(spec, options = {})
|
9
|
+
@spec = spec
|
10
|
+
@gem_dir = Bundler.rubygems.path(spec.full_gem_path)
|
11
|
+
@wrappers = true
|
12
|
+
@env_shebang = true
|
13
|
+
@format_executable = options[:format_executable] || false
|
14
|
+
@build_args = options[:build_args] || Bundler.rubygems.build_args
|
15
|
+
@gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
|
16
|
+
|
17
|
+
if Bundler.requires_sudo?
|
18
|
+
@tmp_dir = Bundler.tmp(spec.full_name).to_s
|
19
|
+
@bin_dir = "#{@tmp_dir}/bin"
|
20
|
+
else
|
21
|
+
@bin_dir = @gem_bin_dir
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_bin
|
26
|
+
return if spec.executables.nil? || spec.executables.empty?
|
27
|
+
|
28
|
+
super
|
29
|
+
|
30
|
+
if Bundler.requires_sudo?
|
31
|
+
SharedHelpers.filesystem_access(@gem_bin_dir) do |p|
|
32
|
+
Bundler.mkdir_p(p)
|
33
|
+
end
|
34
|
+
spec.executables.each do |exe|
|
35
|
+
Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
ensure
|
39
|
+
Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,450 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "uri"
|
3
|
+
require "rubygems/user_interaction"
|
4
|
+
require "rubygems/spec_fetcher"
|
5
|
+
|
6
|
+
module Bundler
|
7
|
+
class Source
|
8
|
+
class Rubygems < Source
|
9
|
+
autoload :Remote, "bundler/source/rubygems/remote"
|
10
|
+
|
11
|
+
# Use the API when installing less than X gems
|
12
|
+
API_REQUEST_LIMIT = 500
|
13
|
+
# Ask for X gems per API request
|
14
|
+
API_REQUEST_SIZE = 50
|
15
|
+
|
16
|
+
attr_reader :remotes, :caches
|
17
|
+
|
18
|
+
def initialize(options = {})
|
19
|
+
@options = options
|
20
|
+
@remotes = []
|
21
|
+
@dependency_names = []
|
22
|
+
@allow_remote = false
|
23
|
+
@allow_cached = false
|
24
|
+
@caches = [cache_path, *Bundler.rubygems.gem_cache]
|
25
|
+
|
26
|
+
Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def remote!
|
30
|
+
@specs = nil
|
31
|
+
@allow_remote = true
|
32
|
+
end
|
33
|
+
|
34
|
+
def cached!
|
35
|
+
@allow_cached = true
|
36
|
+
end
|
37
|
+
|
38
|
+
def hash
|
39
|
+
@remotes.hash
|
40
|
+
end
|
41
|
+
|
42
|
+
def eql?(other)
|
43
|
+
other.is_a?(Rubygems) && other.credless_remotes == credless_remotes
|
44
|
+
end
|
45
|
+
|
46
|
+
alias_method :==, :eql?
|
47
|
+
|
48
|
+
def include?(o)
|
49
|
+
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
def can_lock?(spec)
|
53
|
+
spec.source.is_a?(Rubygems)
|
54
|
+
end
|
55
|
+
|
56
|
+
def options
|
57
|
+
{ "remotes" => @remotes.map(&:to_s) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.from_lock(options)
|
61
|
+
new(options)
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_lock
|
65
|
+
out = String.new("GEM\n")
|
66
|
+
remotes.reverse_each do |remote|
|
67
|
+
out << " remote: #{suppress_configured_credentials remote}\n"
|
68
|
+
end
|
69
|
+
out << " specs:\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
def to_s
|
73
|
+
remote_names = remotes.map(&:to_s).join(", ")
|
74
|
+
"rubygems repository #{remote_names}"
|
75
|
+
end
|
76
|
+
alias_method :name, :to_s
|
77
|
+
|
78
|
+
def specs
|
79
|
+
@specs ||= begin
|
80
|
+
# remote_specs usually generates a way larger Index than the other
|
81
|
+
# sources, and large_idx.use small_idx is way faster than
|
82
|
+
# small_idx.use large_idx.
|
83
|
+
idx = @allow_remote ? remote_specs.dup : Index.new
|
84
|
+
idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
|
85
|
+
idx.use(installed_specs, :override_dupes)
|
86
|
+
idx
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def install(spec, opts = {})
|
91
|
+
force = opts[:force]
|
92
|
+
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
|
93
|
+
|
94
|
+
if ensure_builtin_gems_cached && builtin_gem?(spec)
|
95
|
+
if !cached_path(spec)
|
96
|
+
cached_built_in_gem(spec) unless spec.remote
|
97
|
+
force = true
|
98
|
+
else
|
99
|
+
spec.loaded_from = loaded_from(spec)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
if installed?(spec) && (!force || spec.name.eql?("bundler"))
|
104
|
+
Bundler.ui.info "Using #{version_message(spec)}"
|
105
|
+
return nil # no post-install message
|
106
|
+
end
|
107
|
+
|
108
|
+
# Download the gem to get the spec, because some specs that are returned
|
109
|
+
# by rubygems.org are broken and wrong.
|
110
|
+
if spec.remote
|
111
|
+
# Check for this spec from other sources
|
112
|
+
uris = [spec.remote.anonymized_uri]
|
113
|
+
uris += remotes_for_spec(spec).map(&:anonymized_uri)
|
114
|
+
uris.uniq!
|
115
|
+
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
|
116
|
+
|
117
|
+
s = Bundler.rubygems.spec_from_gem(fetch_gem(spec), Bundler.settings["trust-policy"])
|
118
|
+
spec.__swap__(s)
|
119
|
+
end
|
120
|
+
|
121
|
+
unless Bundler.settings[:no_install]
|
122
|
+
message = "Installing #{version_message(spec)}"
|
123
|
+
message += " with native extensions" if spec.extensions.any?
|
124
|
+
Bundler.ui.confirm message
|
125
|
+
|
126
|
+
path = cached_gem(spec)
|
127
|
+
if requires_sudo?
|
128
|
+
install_path = Bundler.tmp(spec.full_name)
|
129
|
+
bin_path = install_path.join("bin")
|
130
|
+
else
|
131
|
+
install_path = rubygems_dir
|
132
|
+
bin_path = Bundler.system_bindir
|
133
|
+
end
|
134
|
+
|
135
|
+
installed_spec = nil
|
136
|
+
Bundler.rubygems.preserve_paths do
|
137
|
+
installed_spec = Bundler::RubyGemsGemInstaller.new(
|
138
|
+
path,
|
139
|
+
:install_dir => install_path.to_s,
|
140
|
+
:bin_dir => bin_path.to_s,
|
141
|
+
:ignore_dependencies => true,
|
142
|
+
:wrappers => true,
|
143
|
+
:env_shebang => true
|
144
|
+
).install
|
145
|
+
end
|
146
|
+
spec.full_gem_path = installed_spec.full_gem_path
|
147
|
+
|
148
|
+
# SUDO HAX
|
149
|
+
if requires_sudo?
|
150
|
+
Bundler.rubygems.repository_subdirectories.each do |name|
|
151
|
+
src = File.join(install_path, name, "*")
|
152
|
+
dst = File.join(rubygems_dir, name)
|
153
|
+
if name == "extensions" && Dir.glob(src).any?
|
154
|
+
src = File.join(src, "*/*")
|
155
|
+
ext_src = Dir.glob(src).first
|
156
|
+
ext_src.gsub!(src[0..-6], "")
|
157
|
+
dst = File.dirname(File.join(dst, ext_src))
|
158
|
+
end
|
159
|
+
SharedHelpers.filesystem_access(dst) do |p|
|
160
|
+
Bundler.mkdir_p(p)
|
161
|
+
end
|
162
|
+
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
163
|
+
end
|
164
|
+
|
165
|
+
spec.executables.each do |exe|
|
166
|
+
SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
|
167
|
+
Bundler.mkdir_p(p)
|
168
|
+
end
|
169
|
+
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
installed_spec.loaded_from = loaded_from(spec)
|
173
|
+
end
|
174
|
+
spec.loaded_from = loaded_from(spec)
|
175
|
+
|
176
|
+
spec.post_install_message
|
177
|
+
ensure
|
178
|
+
Bundler.rm_rf(install_path) if requires_sudo?
|
179
|
+
end
|
180
|
+
|
181
|
+
def cache(spec, custom_path = nil)
|
182
|
+
if builtin_gem?(spec)
|
183
|
+
cached_path = cached_built_in_gem(spec)
|
184
|
+
else
|
185
|
+
cached_path = cached_gem(spec)
|
186
|
+
end
|
187
|
+
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
|
188
|
+
return if File.dirname(cached_path) == Bundler.app_cache.to_s
|
189
|
+
Bundler.ui.info " * #{File.basename(cached_path)}"
|
190
|
+
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
|
191
|
+
rescue Errno::EACCES => e
|
192
|
+
Bundler.ui.debug(e)
|
193
|
+
raise InstallError, e.message
|
194
|
+
end
|
195
|
+
|
196
|
+
def cached_built_in_gem(spec)
|
197
|
+
cached_path = cached_path(spec)
|
198
|
+
if cached_path.nil?
|
199
|
+
remote_spec = remote_specs.search(spec).first
|
200
|
+
if remote_spec
|
201
|
+
cached_path = fetch_gem(remote_spec)
|
202
|
+
else
|
203
|
+
Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it."
|
204
|
+
end
|
205
|
+
end
|
206
|
+
cached_path
|
207
|
+
end
|
208
|
+
|
209
|
+
def add_remote(source)
|
210
|
+
uri = normalize_uri(source)
|
211
|
+
@remotes.unshift(uri) unless @remotes.include?(uri)
|
212
|
+
end
|
213
|
+
|
214
|
+
def replace_remotes(other_remotes)
|
215
|
+
return false if other_remotes == @remotes
|
216
|
+
|
217
|
+
@remotes = []
|
218
|
+
other_remotes.reverse_each do |r|
|
219
|
+
add_remote r.to_s
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def unmet_deps
|
224
|
+
if @allow_remote && api_fetchers.any?
|
225
|
+
remote_specs.unmet_dependency_names
|
226
|
+
else
|
227
|
+
[]
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def fetchers
|
232
|
+
@fetchers ||= remotes.map do |uri|
|
233
|
+
remote = Source::Rubygems::Remote.new(uri)
|
234
|
+
Bundler::Fetcher.new(remote)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
protected
|
239
|
+
|
240
|
+
def credless_remotes
|
241
|
+
remotes.map(&method(:suppress_configured_credentials))
|
242
|
+
end
|
243
|
+
|
244
|
+
def remotes_for_spec(spec)
|
245
|
+
specs.search_all(spec.name).inject([]) do |uris, s|
|
246
|
+
uris << s.remote if s.remote
|
247
|
+
uris
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def loaded_from(spec)
|
252
|
+
"#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
|
253
|
+
end
|
254
|
+
|
255
|
+
def cached_gem(spec)
|
256
|
+
cached_gem = cached_path(spec)
|
257
|
+
unless cached_gem
|
258
|
+
raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation"
|
259
|
+
end
|
260
|
+
cached_gem
|
261
|
+
end
|
262
|
+
|
263
|
+
def cached_path(spec)
|
264
|
+
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
|
265
|
+
possibilities.find {|p| File.exist?(p) }
|
266
|
+
end
|
267
|
+
|
268
|
+
def normalize_uri(uri)
|
269
|
+
uri = uri.to_s
|
270
|
+
uri = "#{uri}/" unless uri =~ %r{/$}
|
271
|
+
uri = URI(uri)
|
272
|
+
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
|
273
|
+
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(URI::HTTP) && uri.host.nil?)
|
274
|
+
uri
|
275
|
+
end
|
276
|
+
|
277
|
+
def suppress_configured_credentials(remote)
|
278
|
+
remote_nouser = remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s
|
279
|
+
if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser]
|
280
|
+
remote_nouser
|
281
|
+
else
|
282
|
+
remote
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
def installed_specs
|
287
|
+
@installed_specs ||= begin
|
288
|
+
idx = Index.new
|
289
|
+
have_bundler = false
|
290
|
+
Bundler.rubygems.all_specs.reverse_each do |spec|
|
291
|
+
next if spec.name == "bundler" && spec.version.to_s != VERSION
|
292
|
+
have_bundler = true if spec.name == "bundler"
|
293
|
+
spec.source = self
|
294
|
+
idx << spec
|
295
|
+
end
|
296
|
+
|
297
|
+
# Always have bundler locally
|
298
|
+
unless have_bundler
|
299
|
+
# We're running bundler directly from the source
|
300
|
+
# so, let's create a fake gemspec for it (it's a path)
|
301
|
+
# gemspec
|
302
|
+
bundler = Gem::Specification.new do |s|
|
303
|
+
s.name = "bundler"
|
304
|
+
s.version = VERSION
|
305
|
+
s.platform = Gem::Platform::RUBY
|
306
|
+
s.source = self
|
307
|
+
s.authors = ["bundler team"]
|
308
|
+
s.loaded_from = File.expand_path("..", __FILE__)
|
309
|
+
end
|
310
|
+
idx << bundler
|
311
|
+
end
|
312
|
+
idx
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
def cached_specs
|
317
|
+
@cached_specs ||= begin
|
318
|
+
idx = installed_specs.dup
|
319
|
+
|
320
|
+
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
321
|
+
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
|
322
|
+
s ||= Bundler.rubygems.spec_from_gem(gemfile)
|
323
|
+
s.source = self
|
324
|
+
idx << s
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
idx
|
329
|
+
end
|
330
|
+
|
331
|
+
def api_fetchers
|
332
|
+
fetchers.select {|f| f.use_api && f.fetchers.first.api_fetcher? }
|
333
|
+
end
|
334
|
+
|
335
|
+
def remote_specs
|
336
|
+
@remote_specs ||= Index.build do |idx|
|
337
|
+
index_fetchers = fetchers - api_fetchers
|
338
|
+
|
339
|
+
# gather lists from non-api sites
|
340
|
+
index_fetchers.each do |f|
|
341
|
+
Bundler.ui.info "Fetching source index from #{f.uri}"
|
342
|
+
idx.use f.specs_with_retry(nil, self)
|
343
|
+
end
|
344
|
+
|
345
|
+
# because ensuring we have all the gems we need involves downloading
|
346
|
+
# the gemspecs of those gems, if the non-api sites contain more than
|
347
|
+
# about 100 gems, we treat all sites as non-api for speed.
|
348
|
+
allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT
|
349
|
+
Bundler.ui.debug "Need to query more than #{API_REQUEST_LIMIT} gems." \
|
350
|
+
" Downloading full index instead..." unless allow_api
|
351
|
+
|
352
|
+
if allow_api
|
353
|
+
api_fetchers.each do |f|
|
354
|
+
Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
|
355
|
+
idx.use f.specs_with_retry(dependency_names, self)
|
356
|
+
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
|
357
|
+
end
|
358
|
+
|
359
|
+
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
360
|
+
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
361
|
+
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
362
|
+
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
363
|
+
# each spec we found, we add all possible versions from all sources to the index.
|
364
|
+
loop do
|
365
|
+
idxcount = idx.size
|
366
|
+
api_fetchers.each do |f|
|
367
|
+
Bundler.ui.info "Fetching version metadata from #{f.uri}", Bundler.ui.debug?
|
368
|
+
idx.use f.specs_with_retry(idx.dependency_names, self), true
|
369
|
+
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
|
370
|
+
end
|
371
|
+
break if idxcount == idx.size
|
372
|
+
end
|
373
|
+
|
374
|
+
if api_fetchers.any?
|
375
|
+
# it's possible that gems from one source depend on gems from some
|
376
|
+
# other source, so now we download gemspecs and iterate over those
|
377
|
+
# dependencies, looking for gems we don't have info on yet.
|
378
|
+
unmet = idx.unmet_dependency_names
|
379
|
+
|
380
|
+
# if there are any cross-site gems we missed, get them now
|
381
|
+
api_fetchers.each do |f|
|
382
|
+
Bundler.ui.info "Fetching dependency metadata from #{f.uri}", Bundler.ui.debug?
|
383
|
+
idx.use f.specs_with_retry(unmet, self)
|
384
|
+
Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
|
385
|
+
end if unmet.any?
|
386
|
+
else
|
387
|
+
allow_api = false
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
unless allow_api
|
392
|
+
api_fetchers.each do |f|
|
393
|
+
Bundler.ui.info "Fetching source index from #{f.uri}"
|
394
|
+
idx.use f.specs_with_retry(nil, self)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
def fetch_gem(spec)
|
401
|
+
return false unless spec.remote
|
402
|
+
uri = spec.remote.uri
|
403
|
+
spec.fetch_platform
|
404
|
+
|
405
|
+
download_path = requires_sudo? ? Bundler.tmp(spec.full_name) : rubygems_dir
|
406
|
+
gem_path = "#{rubygems_dir}/cache/#{spec.full_name}.gem"
|
407
|
+
|
408
|
+
SharedHelpers.filesystem_access("#{download_path}/cache") do |p|
|
409
|
+
FileUtils.mkdir_p(p)
|
410
|
+
end
|
411
|
+
Bundler.rubygems.download_gem(spec, uri, download_path)
|
412
|
+
|
413
|
+
if requires_sudo?
|
414
|
+
SharedHelpers.filesystem_access("#{rubygems_dir}/cache") do |p|
|
415
|
+
Bundler.mkdir_p(p)
|
416
|
+
end
|
417
|
+
Bundler.sudo "mv #{download_path}/cache/#{spec.full_name}.gem #{gem_path}"
|
418
|
+
end
|
419
|
+
|
420
|
+
gem_path
|
421
|
+
ensure
|
422
|
+
Bundler.rm_rf(download_path) if requires_sudo?
|
423
|
+
end
|
424
|
+
|
425
|
+
def builtin_gem?(spec)
|
426
|
+
# Ruby 2.1, where all included gems have this summary
|
427
|
+
return true if spec.summary =~ /is bundled with Ruby/
|
428
|
+
|
429
|
+
# Ruby 2.0, where gemspecs are stored in specifications/default/
|
430
|
+
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
|
431
|
+
end
|
432
|
+
|
433
|
+
def installed?(spec)
|
434
|
+
installed_specs[spec].any?
|
435
|
+
end
|
436
|
+
|
437
|
+
def requires_sudo?
|
438
|
+
Bundler.requires_sudo?
|
439
|
+
end
|
440
|
+
|
441
|
+
def rubygems_dir
|
442
|
+
Bundler.rubygems.gem_dir
|
443
|
+
end
|
444
|
+
|
445
|
+
def cache_path
|
446
|
+
Bundler.app_cache
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|