bundler 1.17.2 → 2.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2095 -1251
- data/LICENSE.md +18 -19
- data/README.md +10 -11
- data/bundler.gemspec +10 -28
- data/exe/bundle +22 -3
- data/lib/bundler/build_metadata.rb +4 -12
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +39 -13
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +20 -9
- data/lib/bundler/cli/exec.rb +8 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +213 -32
- data/lib/bundler/cli/info.rb +42 -7
- data/lib/bundler/cli/init.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +34 -44
- data/lib/bundler/cli/issue.rb +8 -7
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +11 -8
- data/lib/bundler/cli/outdated.rb +142 -118
- data/lib/bundler/cli/plugin.rb +19 -2
- data/lib/bundler/cli/pristine.rb +6 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +43 -16
- data/lib/bundler/cli.rb +211 -150
- data/lib/bundler/compact_index_client/cache.rb +6 -14
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +15 -28
- data/lib/bundler/compact_index_client.rb +28 -12
- data/lib/bundler/current_ruby.rb +14 -11
- data/lib/bundler/definition.rb +207 -368
- data/lib/bundler/dep_proxy.rb +16 -9
- data/lib/bundler/dependency.rb +19 -14
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +81 -81
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +9 -14
- data/lib/bundler/environment_preserver.rb +29 -3
- data/lib/bundler/errors.rb +20 -3
- data/lib/bundler/feature_flag.rb +14 -33
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +28 -14
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +8 -8
- data/lib/bundler/fetcher.rb +22 -17
- data/lib/bundler/friendly_errors.rb +29 -48
- data/lib/bundler/gem_helper.rb +79 -43
- data/lib/bundler/gem_helpers.rb +38 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +5 -5
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +9 -9
- data/lib/bundler/injector.rb +33 -13
- data/lib/bundler/inline.rb +41 -30
- data/lib/bundler/installer/gem_installer.rb +9 -18
- data/lib/bundler/installer/parallel_installer.rb +50 -33
- data/lib/bundler/installer/standalone.rb +30 -11
- data/lib/bundler/installer.rb +39 -66
- data/lib/bundler/lazy_specification.rb +63 -28
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +19 -52
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/lib/bundler/man/bundle-cache.1 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-config.1 +59 -60
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-init.1 +2 -2
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-install.1 +37 -7
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-update.1 +7 -7
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle.1 +7 -3
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
- data/{man → lib/bundler/man}/gemfile.5 +44 -21
- data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
- data/{man → lib/bundler/man}/index.txt +1 -1
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +5 -5
- data/lib/bundler/plugin/api/source.rb +27 -7
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +27 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/installer.rb +35 -22
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +100 -42
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +5 -4
- data/lib/bundler/resolver/spec_group.rb +57 -53
- data/lib/bundler/resolver.rb +127 -113
- data/lib/bundler/retry.rb +4 -4
- data/lib/bundler/ruby_version.rb +5 -20
- data/lib/bundler/rubygems_ext.rb +103 -79
- data/lib/bundler/rubygems_gem_installer.rb +69 -8
- data/lib/bundler/rubygems_integration.rb +181 -446
- data/lib/bundler/runtime.rb +24 -34
- data/lib/bundler/settings.rb +159 -110
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +56 -90
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +106 -105
- data/lib/bundler/source/git.rb +66 -39
- data/lib/bundler/source/metadata.rb +9 -9
- data/lib/bundler/source/path/installer.rb +10 -10
- data/lib/bundler/source/path.rb +23 -12
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +136 -120
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +27 -6
- data/lib/bundler/source_list.rb +101 -66
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +49 -53
- data/lib/bundler/stub_specification.rb +40 -34
- data/lib/bundler/templates/Executable.bundler +24 -15
- data/lib/bundler/templates/Gemfile +1 -1
- data/lib/bundler/templates/gems.rb +1 -1
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +29 -40
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +7 -11
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +10 -4
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -12
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +21 -8
- data/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/bundler.rb +248 -118
- metadata +115 -190
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-add.1.txt +0 -52
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -529
- data/man/bundle-doctor.1.txt +0 -44
- data/man/bundle-exec.1.txt +0 -178
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -396
- data/man/bundle-list.1.txt +0 -43
- data/man/bundle-lock.1.txt +0 -93
- data/man/bundle-open.1.txt +0 -29
- data/man/bundle-outdated.1.txt +0 -131
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
- data/man/bundle-platform.1.txt +0 -57
- data/man/bundle-pristine.1.txt +0 -44
- data/man/bundle-remove.1.txt +0 -34
- data/man/bundle-show.1.txt +0 -27
- data/man/bundle-update.1.txt +0 -391
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -113
- data/man/gemfile.5.txt +0 -653
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "rubygems"
|
5
|
-
require "rubygems/config_file"
|
3
|
+
require "rubygems" unless defined?(Gem)
|
6
4
|
|
7
5
|
module Bundler
|
8
6
|
class RubygemsIntegration
|
9
7
|
if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
|
10
8
|
EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR
|
11
9
|
else
|
10
|
+
require "monitor"
|
11
|
+
|
12
12
|
EXT_LOCK = Monitor.new
|
13
13
|
end
|
14
14
|
|
@@ -22,6 +22,7 @@ module Bundler
|
|
22
22
|
|
23
23
|
def initialize
|
24
24
|
@replaced_methods = {}
|
25
|
+
backport_ext_builder_monitor
|
25
26
|
end
|
26
27
|
|
27
28
|
def version
|
@@ -33,21 +34,31 @@ module Bundler
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def build_args
|
37
|
+
require "rubygems/command"
|
36
38
|
Gem::Command.build_args
|
37
39
|
end
|
38
40
|
|
39
41
|
def build_args=(args)
|
42
|
+
require "rubygems/command"
|
40
43
|
Gem::Command.build_args = args
|
41
44
|
end
|
42
45
|
|
43
|
-
def load_path_insert_index
|
44
|
-
Gem.load_path_insert_index
|
45
|
-
end
|
46
|
-
|
47
46
|
def loaded_specs(name)
|
48
47
|
Gem.loaded_specs[name]
|
49
48
|
end
|
50
49
|
|
50
|
+
def add_to_load_path(paths)
|
51
|
+
return Gem.add_to_load_path(*paths) if Gem.respond_to?(:add_to_load_path)
|
52
|
+
|
53
|
+
if insert_index = Gem.load_path_insert_index
|
54
|
+
# Gem directories must come after -I and ENV['RUBYLIB']
|
55
|
+
$LOAD_PATH.insert(insert_index, *paths)
|
56
|
+
else
|
57
|
+
# We are probably testing in core, -I and RUBYLIB don't apply
|
58
|
+
$LOAD_PATH.unshift(*paths)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
51
62
|
def mark_loaded(spec)
|
52
63
|
if spec.respond_to?(:activated=)
|
53
64
|
current = Gem.loaded_specs[spec.name]
|
@@ -75,16 +86,12 @@ module Bundler
|
|
75
86
|
def spec_missing_extensions?(spec, default = true)
|
76
87
|
return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)
|
77
88
|
|
78
|
-
return false if
|
89
|
+
return false if spec.default_gem?
|
79
90
|
return false if spec.extensions.empty?
|
80
91
|
|
81
92
|
default
|
82
93
|
end
|
83
94
|
|
84
|
-
def spec_default_gem?(spec)
|
85
|
-
spec.respond_to?(:default_gem?) && spec.default_gem?
|
86
|
-
end
|
87
|
-
|
88
95
|
def spec_matches_for_glob(spec, glob)
|
89
96
|
return spec.matches_for_glob(glob) if spec.respond_to?(:matches_for_glob)
|
90
97
|
|
@@ -93,11 +100,6 @@ module Bundler
|
|
93
100
|
end.flatten(1)
|
94
101
|
end
|
95
102
|
|
96
|
-
def spec_extension_dir(spec)
|
97
|
-
return unless spec.respond_to?(:extension_dir)
|
98
|
-
spec.extension_dir
|
99
|
-
end
|
100
|
-
|
101
103
|
def stub_set_spec(stub, spec)
|
102
104
|
stub.instance_variable_set(:@spec, spec)
|
103
105
|
end
|
@@ -106,13 +108,8 @@ module Bundler
|
|
106
108
|
obj.to_s
|
107
109
|
end
|
108
110
|
|
109
|
-
def platforms
|
110
|
-
return [Gem::Platform::RUBY] if Bundler.settings[:force_ruby_platform]
|
111
|
-
Gem.platforms
|
112
|
-
end
|
113
|
-
|
114
111
|
def configuration
|
115
|
-
|
112
|
+
require_relative "psyched_yaml"
|
116
113
|
Gem.configuration
|
117
114
|
rescue Gem::SystemExitException, LoadError => e
|
118
115
|
Bundler.ui.error "#{e.class}: #{e.message}"
|
@@ -132,10 +129,16 @@ module Bundler
|
|
132
129
|
end
|
133
130
|
|
134
131
|
def inflate(obj)
|
135
|
-
|
136
|
-
|
132
|
+
Gem::Util.inflate(obj)
|
133
|
+
end
|
134
|
+
|
135
|
+
def correct_for_windows_path(path)
|
136
|
+
if Gem::Util.respond_to?(:correct_for_windows_path)
|
137
|
+
Gem::Util.correct_for_windows_path(path)
|
138
|
+
elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
|
139
|
+
path[1..-1]
|
137
140
|
else
|
138
|
-
|
141
|
+
path
|
139
142
|
end
|
140
143
|
end
|
141
144
|
|
@@ -196,14 +199,6 @@ module Bundler
|
|
196
199
|
Gem::MARSHAL_SPEC_DIR
|
197
200
|
end
|
198
201
|
|
199
|
-
def config_map
|
200
|
-
Gem::ConfigMap
|
201
|
-
end
|
202
|
-
|
203
|
-
def repository_subdirectories
|
204
|
-
%w[cache doc gems specifications]
|
205
|
-
end
|
206
|
-
|
207
202
|
def clear_paths
|
208
203
|
Gem.clear_paths
|
209
204
|
end
|
@@ -212,26 +207,9 @@ module Bundler
|
|
212
207
|
Gem.bin_path(gem, bin, ver)
|
213
208
|
end
|
214
209
|
|
215
|
-
def path_separator
|
216
|
-
File::PATH_SEPARATOR
|
217
|
-
end
|
218
|
-
|
219
|
-
def preserve_paths
|
220
|
-
# this is a no-op outside of RubyGems 1.8
|
221
|
-
yield
|
222
|
-
end
|
223
|
-
|
224
210
|
def loaded_gem_paths
|
225
|
-
|
226
|
-
|
227
|
-
if Gem::Specification.method_defined? :full_require_paths
|
228
|
-
loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
|
229
|
-
loaded_gem_paths.flatten
|
230
|
-
else
|
231
|
-
$LOAD_PATH.select do |p|
|
232
|
-
Bundler.rubygems.gem_path.any? {|gp| p =~ /^#{Regexp.escape(gp)}/ }
|
233
|
-
end
|
234
|
-
end
|
211
|
+
loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths }
|
212
|
+
loaded_gem_paths.flatten
|
235
213
|
end
|
236
214
|
|
237
215
|
def load_plugins
|
@@ -242,6 +220,10 @@ module Bundler
|
|
242
220
|
Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files)
|
243
221
|
end
|
244
222
|
|
223
|
+
def load_env_plugins
|
224
|
+
Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
|
225
|
+
end
|
226
|
+
|
245
227
|
def ui=(obj)
|
246
228
|
Gem::DefaultUserInteraction.ui = obj
|
247
229
|
end
|
@@ -250,36 +232,6 @@ module Bundler
|
|
250
232
|
EXT_LOCK
|
251
233
|
end
|
252
234
|
|
253
|
-
def fetch_specs(all, pre, &blk)
|
254
|
-
require "rubygems/spec_fetcher"
|
255
|
-
specs = Gem::SpecFetcher.new.list(all, pre)
|
256
|
-
specs.each { yield } if block_given?
|
257
|
-
specs
|
258
|
-
end
|
259
|
-
|
260
|
-
def fetch_prerelease_specs
|
261
|
-
fetch_specs(false, true)
|
262
|
-
rescue Gem::RemoteFetcher::FetchError
|
263
|
-
{} # if we can't download them, there aren't any
|
264
|
-
end
|
265
|
-
|
266
|
-
# TODO: This is for older versions of RubyGems... should we support the
|
267
|
-
# X-Gemfile-Source header on these old versions?
|
268
|
-
# Maybe the newer implementation will work on older RubyGems?
|
269
|
-
# It seems difficult to keep this implementation and still send the header.
|
270
|
-
def fetch_all_remote_specs(remote)
|
271
|
-
old_sources = Bundler.rubygems.sources
|
272
|
-
Bundler.rubygems.sources = [remote.uri.to_s]
|
273
|
-
# Fetch all specs, minus prerelease specs
|
274
|
-
spec_list = fetch_specs(true, false)
|
275
|
-
# Then fetch the prerelease specs
|
276
|
-
fetch_prerelease_specs.each {|k, v| spec_list[k].concat(v) }
|
277
|
-
|
278
|
-
spec_list.values.first
|
279
|
-
ensure
|
280
|
-
Bundler.rubygems.sources = old_sources
|
281
|
-
end
|
282
|
-
|
283
235
|
def with_build_args(args)
|
284
236
|
ext_lock.synchronize do
|
285
237
|
old_args = build_args
|
@@ -292,22 +244,11 @@ module Bundler
|
|
292
244
|
end
|
293
245
|
end
|
294
246
|
|
295
|
-
def install_with_build_args(args)
|
296
|
-
with_build_args(args) { yield }
|
297
|
-
end
|
298
|
-
|
299
|
-
def gem_from_path(path, policy = nil)
|
300
|
-
require "rubygems/format"
|
301
|
-
Gem::Format.from_file_by_path(path, policy)
|
302
|
-
end
|
303
|
-
|
304
247
|
def spec_from_gem(path, policy = nil)
|
305
248
|
require "rubygems/security"
|
306
|
-
|
249
|
+
require_relative "psyched_yaml"
|
307
250
|
gem_from_path(path, security_policies[policy]).spec
|
308
|
-
rescue Gem::
|
309
|
-
raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
|
310
|
-
rescue Exception, Gem::Exception, Gem::Security::Exception => e
|
251
|
+
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
|
311
252
|
if e.is_a?(Gem::Security::Exception) ||
|
312
253
|
e.message =~ /unknown trust policy|unsigned gem/i ||
|
313
254
|
e.message =~ /couldn't verify (meta)?data signature/i
|
@@ -319,23 +260,10 @@ module Bundler
|
|
319
260
|
end
|
320
261
|
end
|
321
262
|
|
322
|
-
def build(spec, skip_validation = false)
|
323
|
-
require "rubygems/builder"
|
324
|
-
Gem::Builder.new(spec).build
|
325
|
-
end
|
326
|
-
|
327
263
|
def build_gem(gem_dir, spec)
|
328
264
|
build(spec)
|
329
265
|
end
|
330
266
|
|
331
|
-
def download_gem(spec, uri, path)
|
332
|
-
uri = Bundler.settings.mirror_for(uri)
|
333
|
-
fetcher = Gem::RemoteFetcher.new(configuration[:http_proxy])
|
334
|
-
Bundler::Retry.new("download gem from #{uri}").attempts do
|
335
|
-
fetcher.download(spec, uri, path)
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
267
|
def security_policy_keys
|
340
268
|
%w[High Medium Low AlmostNo No].map {|level| "#{level}Security" }
|
341
269
|
end
|
@@ -359,14 +287,6 @@ module Bundler
|
|
359
287
|
end
|
360
288
|
end
|
361
289
|
|
362
|
-
def binstubs_call_gem?
|
363
|
-
true
|
364
|
-
end
|
365
|
-
|
366
|
-
def stubs_provide_full_functionality?
|
367
|
-
false
|
368
|
-
end
|
369
|
-
|
370
290
|
def replace_gem(specs, specs_by_name)
|
371
291
|
reverse_rubygems_kernel_mixin
|
372
292
|
|
@@ -375,7 +295,6 @@ module Bundler
|
|
375
295
|
kernel = (class << ::Kernel; self; end)
|
376
296
|
[kernel, ::Kernel].each do |kernel_class|
|
377
297
|
redefine_method(kernel_class, :gem) do |dep, *reqs|
|
378
|
-
executables ||= specs.map(&:executables).flatten if ::Bundler.rubygems.binstubs_call_gem?
|
379
298
|
if executables && executables.include?(File.basename(caller.first.split(":").first))
|
380
299
|
break
|
381
300
|
end
|
@@ -391,8 +310,13 @@ module Bundler
|
|
391
310
|
end
|
392
311
|
|
393
312
|
message = if spec.nil?
|
313
|
+
target_file = begin
|
314
|
+
Bundler.default_gemfile.basename
|
315
|
+
rescue GemfileNotFound
|
316
|
+
"inline Gemfile"
|
317
|
+
end
|
394
318
|
"#{dep.name} is not part of the bundle." \
|
395
|
-
" Add it to your #{
|
319
|
+
" Add it to your #{target_file}."
|
396
320
|
else
|
397
321
|
"can't activate #{dep}, already activated #{spec.full_name}. " \
|
398
322
|
"Make sure all dependencies are added to Gemfile."
|
@@ -408,68 +332,50 @@ module Bundler
|
|
408
332
|
raise e
|
409
333
|
end
|
410
334
|
|
411
|
-
# backwards compatibility shim, see https://github.com/
|
335
|
+
# backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
|
412
336
|
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
|
413
337
|
end
|
414
338
|
end
|
415
339
|
|
416
|
-
def stub_source_index(specs)
|
417
|
-
Gem::SourceIndex.send(:alias_method, :old_initialize, :initialize)
|
418
|
-
redefine_method(Gem::SourceIndex, :initialize) do |*args|
|
419
|
-
@gems = {}
|
420
|
-
# You're looking at this thinking: Oh! This is how I make those
|
421
|
-
# rubygems deprecations go away!
|
422
|
-
#
|
423
|
-
# You'd be correct BUT using of this method in production code
|
424
|
-
# must be approved by the rubygems team itself!
|
425
|
-
#
|
426
|
-
# This is your warning. If you use this and don't have approval
|
427
|
-
# we can't protect you.
|
428
|
-
#
|
429
|
-
Deprecate.skip_during do
|
430
|
-
self.spec_dirs = *args
|
431
|
-
add_specs(*specs)
|
432
|
-
end
|
433
|
-
end
|
434
|
-
end
|
435
|
-
|
436
340
|
# Used to make bin stubs that are not created by bundler work
|
437
341
|
# under bundler. The new Gem.bin_path only considers gems in
|
438
342
|
# +specs+
|
439
|
-
def replace_bin_path(
|
343
|
+
def replace_bin_path(specs_by_name)
|
440
344
|
gem_class = (class << Gem; self; end)
|
441
345
|
|
442
346
|
redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
|
443
347
|
exec_name = args.first
|
348
|
+
raise ArgumentError, "you must supply exec_name" unless exec_name
|
444
349
|
|
445
350
|
spec_with_name = specs_by_name[gem_name]
|
446
|
-
|
447
|
-
|
448
|
-
spec_with_name
|
449
|
-
else
|
450
|
-
specs.find {|s| s.executables.include?(exec_name) }
|
451
|
-
end
|
452
|
-
else
|
453
|
-
spec_with_name
|
454
|
-
end
|
351
|
+
matching_specs_by_exec_name = specs_by_name.values.select {|s| s.executables.include?(exec_name) }
|
352
|
+
spec = matching_specs_by_exec_name.delete(spec_with_name)
|
455
353
|
|
456
|
-
unless spec
|
354
|
+
unless spec || !matching_specs_by_exec_name.empty?
|
457
355
|
message = "can't find executable #{exec_name} for gem #{gem_name}"
|
458
|
-
if
|
356
|
+
if spec_with_name.nil?
|
459
357
|
message += ". #{gem_name} is not currently included in the bundle, " \
|
460
358
|
"perhaps you meant to add it to your #{Bundler.default_gemfile.basename}?"
|
461
359
|
end
|
462
360
|
raise Gem::Exception, message
|
463
361
|
end
|
464
362
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
Bundler::SharedHelpers.major_deprecation 2,
|
363
|
+
unless spec
|
364
|
+
spec = matching_specs_by_exec_name.shift
|
365
|
+
warn \
|
469
366
|
"Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \
|
470
367
|
"You should run `bundle binstub #{gem_name}` " \
|
471
368
|
"to work around a system/bundle conflict."
|
472
369
|
end
|
370
|
+
|
371
|
+
unless matching_specs_by_exec_name.empty?
|
372
|
+
conflicting_names = matching_specs_by_exec_name.map(&:name).join(", ")
|
373
|
+
warn \
|
374
|
+
"The `#{exec_name}` executable in the `#{spec.name}` gem is being loaded, but it's also present in other gems (#{conflicting_names}).\n" \
|
375
|
+
"If you meant to run the executable for another gem, make sure you use a project specific binstub (`bundle binstub <gem_name>`).\n" \
|
376
|
+
"If you plan to use multiple conflicting executables, generate binstubs for them and disambiguate their names."
|
377
|
+
end
|
378
|
+
|
473
379
|
spec
|
474
380
|
end
|
475
381
|
|
@@ -499,75 +405,35 @@ module Bundler
|
|
499
405
|
end
|
500
406
|
end
|
501
407
|
|
502
|
-
# Because Bundler has a static view of what specs are available,
|
503
|
-
# we don't #refresh, so stub it out.
|
504
|
-
def replace_refresh
|
505
|
-
gem_class = (class << Gem; self; end)
|
506
|
-
redefine_method(gem_class, :refresh) {}
|
507
|
-
end
|
508
|
-
|
509
408
|
# Replace or hook into RubyGems to provide a bundlerized view
|
510
409
|
# of the world.
|
511
410
|
def replace_entrypoints(specs)
|
512
|
-
specs_by_name = specs
|
513
|
-
h[s.name] = s
|
514
|
-
h
|
515
|
-
end
|
411
|
+
specs_by_name = add_default_gems_to(specs)
|
516
412
|
|
517
413
|
replace_gem(specs, specs_by_name)
|
518
414
|
stub_rubygems(specs)
|
519
|
-
replace_bin_path(
|
520
|
-
replace_refresh
|
415
|
+
replace_bin_path(specs_by_name)
|
521
416
|
|
522
417
|
Gem.clear_paths
|
523
418
|
end
|
524
419
|
|
525
|
-
#
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
/^\d+$/ =~ s ? s.to_i : s
|
531
|
-
end
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
# This backport fixes the marshaling of @segments.
|
536
|
-
def backport_yaml_initialize
|
537
|
-
redefine_method(Gem::Version, :yaml_initialize) do |_, map|
|
538
|
-
@version = map["version"]
|
539
|
-
@segments = nil
|
540
|
-
@hash = nil
|
541
|
-
end
|
542
|
-
end
|
543
|
-
|
544
|
-
# This backports base_dir which replaces installation path
|
545
|
-
# RubyGems 1.8+
|
546
|
-
def backport_base_dir
|
547
|
-
redefine_method(Gem::Specification, :base_dir) do
|
548
|
-
return Gem.dir unless loaded_from
|
549
|
-
File.dirname File.dirname loaded_from
|
550
|
-
end
|
551
|
-
end
|
552
|
-
|
553
|
-
def backport_cache_file
|
554
|
-
redefine_method(Gem::Specification, :cache_dir) do
|
555
|
-
@cache_dir ||= File.join base_dir, "cache"
|
420
|
+
# Add default gems not already present in specs, and return them as a hash.
|
421
|
+
def add_default_gems_to(specs)
|
422
|
+
specs_by_name = specs.reduce({}) do |h, s|
|
423
|
+
h[s.name] = s
|
424
|
+
h
|
556
425
|
end
|
557
426
|
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
427
|
+
Bundler.rubygems.default_stubs.each do |stub|
|
428
|
+
default_spec = stub.to_spec
|
429
|
+
default_spec_name = default_spec.name
|
430
|
+
next if specs_by_name.key?(default_spec_name)
|
562
431
|
|
563
|
-
|
564
|
-
|
565
|
-
@spec_dir ||= File.join base_dir, "specifications"
|
432
|
+
specs << default_spec
|
433
|
+
specs_by_name[default_spec_name] = default_spec
|
566
434
|
end
|
567
435
|
|
568
|
-
|
569
|
-
@spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
|
570
|
-
end
|
436
|
+
specs_by_name
|
571
437
|
end
|
572
438
|
|
573
439
|
def undo_replacements
|
@@ -613,286 +479,155 @@ module Bundler
|
|
613
479
|
end
|
614
480
|
end
|
615
481
|
|
616
|
-
|
617
|
-
|
618
|
-
def initialize
|
619
|
-
super
|
620
|
-
backport_base_dir
|
621
|
-
backport_cache_file
|
622
|
-
backport_spec_file
|
623
|
-
backport_yaml_initialize
|
624
|
-
end
|
625
|
-
|
626
|
-
def stub_rubygems(specs)
|
627
|
-
# RubyGems versions lower than 1.7 use SourceIndex#from_gems_in
|
628
|
-
source_index_class = (class << Gem::SourceIndex; self; end)
|
629
|
-
redefine_method(source_index_class, :from_gems_in) do |*args|
|
630
|
-
Gem::SourceIndex.new.tap do |source_index|
|
631
|
-
source_index.spec_dirs = *args
|
632
|
-
source_index.add_specs(*specs)
|
633
|
-
end
|
634
|
-
end
|
635
|
-
end
|
482
|
+
def stub_rubygems(specs)
|
483
|
+
Gem::Specification.all = specs
|
636
484
|
|
637
|
-
|
638
|
-
Gem.
|
639
|
-
end
|
640
|
-
|
641
|
-
def find_name(name)
|
642
|
-
Gem.source_index.find_name(name)
|
643
|
-
end
|
644
|
-
|
645
|
-
def validate(spec)
|
646
|
-
# These versions of RubyGems always validate in "packaging" mode,
|
647
|
-
# which is too strict for the kinds of checks we care about. As a
|
648
|
-
# result, validation is disabled on versions of RubyGems below 1.7.
|
485
|
+
Gem.post_reset do
|
486
|
+
Gem::Specification.all = specs
|
649
487
|
end
|
650
488
|
|
651
|
-
|
489
|
+
redefine_method((class << Gem; self; end), :finish_resolve) do |*|
|
652
490
|
[]
|
653
491
|
end
|
654
|
-
|
655
|
-
def reset
|
656
|
-
end
|
657
492
|
end
|
658
493
|
|
659
|
-
|
660
|
-
|
661
|
-
def initialize
|
662
|
-
super
|
663
|
-
backport_segment_generation
|
664
|
-
end
|
494
|
+
def plain_specs
|
495
|
+
Gem::Specification._all
|
665
496
|
end
|
666
497
|
|
667
|
-
|
668
|
-
|
669
|
-
def stub_rubygems(specs)
|
670
|
-
stub_source_index(specs)
|
671
|
-
end
|
672
|
-
|
673
|
-
def validate(spec)
|
674
|
-
# Missing summary is downgraded to a warning in later versions,
|
675
|
-
# so we set it to an empty string to prevent an exception here.
|
676
|
-
spec.summary ||= ""
|
677
|
-
RubygemsIntegration.instance_method(:validate).bind(self).call(spec)
|
678
|
-
end
|
498
|
+
def plain_specs=(specs)
|
499
|
+
Gem::Specification.all = specs
|
679
500
|
end
|
680
501
|
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
end
|
692
|
-
|
693
|
-
def all_specs
|
694
|
-
Gem::Specification.to_a
|
695
|
-
end
|
696
|
-
|
697
|
-
def find_name(name)
|
698
|
-
Gem::Specification.find_all_by_name name
|
699
|
-
end
|
502
|
+
def fetch_specs(remote, name)
|
503
|
+
require "rubygems/remote_fetcher"
|
504
|
+
path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
|
505
|
+
fetcher = gem_remote_fetcher
|
506
|
+
fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
|
507
|
+
string = fetcher.fetch_path(path)
|
508
|
+
Bundler.load_marshal(string)
|
509
|
+
rescue Gem::RemoteFetcher::FetchError
|
510
|
+
# it's okay for prerelease to fail
|
511
|
+
raise unless name == "prerelease_specs"
|
700
512
|
end
|
701
513
|
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
# you call Gem::Installer#install with an :install_dir set. We have to
|
706
|
-
# change it back for our sudo mode to work.
|
707
|
-
def preserve_paths
|
708
|
-
old_dir = gem_dir
|
709
|
-
old_path = gem_path
|
710
|
-
yield
|
711
|
-
Gem.use_paths(old_dir, old_path)
|
712
|
-
end
|
713
|
-
end
|
514
|
+
def fetch_all_remote_specs(remote)
|
515
|
+
specs = fetch_specs(remote, "specs")
|
516
|
+
pres = fetch_specs(remote, "prerelease_specs") || []
|
714
517
|
|
715
|
-
|
716
|
-
class MoreModern < Modern
|
717
|
-
# RubyGems 1.8.20 and adds the skip_validation parameter, so that's
|
718
|
-
# when we start passing it through.
|
719
|
-
def build(spec, skip_validation = false)
|
720
|
-
require "rubygems/builder"
|
721
|
-
Gem::Builder.new(spec).build(skip_validation)
|
722
|
-
end
|
518
|
+
specs.concat(pres)
|
723
519
|
end
|
724
520
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
redefine_method((class << Gem; self; end), :finish_resolve) do |*|
|
735
|
-
[]
|
736
|
-
end
|
737
|
-
end
|
738
|
-
|
739
|
-
def all_specs
|
740
|
-
Gem::Specification.to_a
|
741
|
-
end
|
742
|
-
|
743
|
-
def find_name(name)
|
744
|
-
Gem::Specification.find_all_by_name name
|
745
|
-
end
|
746
|
-
|
747
|
-
def fetch_specs(source, remote, name)
|
748
|
-
path = source + "#{name}.#{Gem.marshal_version}.gz"
|
749
|
-
fetcher = gem_remote_fetcher
|
750
|
-
fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri
|
751
|
-
string = fetcher.fetch_path(path)
|
752
|
-
Bundler.load_marshal(string)
|
753
|
-
rescue Gem::RemoteFetcher::FetchError => e
|
754
|
-
# it's okay for prerelease to fail
|
755
|
-
raise e unless name == "prerelease_specs"
|
756
|
-
end
|
521
|
+
def download_gem(spec, uri, cache_dir)
|
522
|
+
require "rubygems/remote_fetcher"
|
523
|
+
uri = Bundler.settings.mirror_for(uri)
|
524
|
+
fetcher = gem_remote_fetcher
|
525
|
+
fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
|
526
|
+
Bundler::Retry.new("download gem from #{uri}").attempts do
|
527
|
+
gem_file_name = spec.file_name
|
528
|
+
local_gem_path = File.join cache_dir, gem_file_name
|
529
|
+
return if File.exist? local_gem_path
|
757
530
|
|
758
|
-
|
759
|
-
|
531
|
+
begin
|
532
|
+
remote_gem_path = uri + "gems/#{gem_file_name}"
|
533
|
+
remote_gem_path = remote_gem_path.to_s if provides?("< 3.2.0.rc.1")
|
760
534
|
|
761
|
-
|
762
|
-
|
535
|
+
SharedHelpers.filesystem_access(local_gem_path) do
|
536
|
+
fetcher.cache_update_path remote_gem_path, local_gem_path
|
537
|
+
end
|
538
|
+
rescue Gem::RemoteFetcher::FetchError
|
539
|
+
raise if spec.original_platform == spec.platform
|
763
540
|
|
764
|
-
|
765
|
-
|
541
|
+
original_gem_file_name = "#{spec.original_name}.gem"
|
542
|
+
raise if gem_file_name == original_gem_file_name
|
766
543
|
|
767
|
-
|
768
|
-
|
769
|
-
fetcher = gem_remote_fetcher
|
770
|
-
fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri
|
771
|
-
Bundler::Retry.new("download gem from #{uri}").attempts do
|
772
|
-
fetcher.download(spec, uri, path)
|
544
|
+
gem_file_name = original_gem_file_name
|
545
|
+
retry
|
773
546
|
end
|
774
547
|
end
|
548
|
+
rescue Gem::RemoteFetcher::FetchError => e
|
549
|
+
raise Bundler::HTTPError, "Could not download gem from #{uri} due to underlying error <#{e.message}>"
|
550
|
+
end
|
775
551
|
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
end
|
552
|
+
def gem_remote_fetcher
|
553
|
+
require "rubygems/remote_fetcher"
|
554
|
+
proxy = configuration[:http_proxy]
|
555
|
+
Gem::RemoteFetcher.new(proxy)
|
556
|
+
end
|
782
557
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
558
|
+
def gem_from_path(path, policy = nil)
|
559
|
+
require "rubygems/package"
|
560
|
+
p = Gem::Package.new(path)
|
561
|
+
p.security_policy = policy if policy
|
562
|
+
p
|
563
|
+
end
|
789
564
|
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
565
|
+
def build(spec, skip_validation = false)
|
566
|
+
require "rubygems/package"
|
567
|
+
Gem::Package.build(spec, skip_validation)
|
568
|
+
end
|
794
569
|
|
795
|
-
|
796
|
-
|
797
|
-
|
570
|
+
def repository_subdirectories
|
571
|
+
Gem::REPOSITORY_SUBDIRECTORIES
|
572
|
+
end
|
798
573
|
|
799
|
-
|
800
|
-
|
801
|
-
|
574
|
+
def install_with_build_args(args)
|
575
|
+
yield
|
576
|
+
end
|
802
577
|
|
803
|
-
|
804
|
-
|
805
|
-
end
|
578
|
+
def path_separator
|
579
|
+
Gem.path_separator
|
806
580
|
end
|
807
581
|
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
super
|
812
|
-
backport_ext_builder_monitor
|
582
|
+
def all_specs
|
583
|
+
Gem::Specification.stubs.map do |stub|
|
584
|
+
StubSpecification.from_stub(stub)
|
813
585
|
end
|
586
|
+
end
|
814
587
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
588
|
+
def backport_ext_builder_monitor
|
589
|
+
# So we can avoid requiring "rubygems/ext" in its entirety
|
590
|
+
Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
|
591
|
+
module Ext
|
819
592
|
end
|
820
|
-
|
593
|
+
RUBY
|
821
594
|
|
822
|
-
|
823
|
-
# So we can avoid requiring "rubygems/ext" in its entirety
|
824
|
-
Gem.module_eval <<-RB, __FILE__, __LINE__ + 1
|
825
|
-
module Ext
|
826
|
-
end
|
827
|
-
RB
|
828
|
-
|
829
|
-
require "rubygems/ext/builder"
|
595
|
+
require "rubygems/ext/builder"
|
830
596
|
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
end
|
835
|
-
|
836
|
-
remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
|
837
|
-
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
|
838
|
-
end
|
839
|
-
end
|
840
|
-
|
841
|
-
if Gem::Specification.respond_to?(:stubs_for)
|
842
|
-
def find_name(name)
|
843
|
-
Gem::Specification.stubs_for(name).map(&:to_spec)
|
844
|
-
end
|
845
|
-
else
|
846
|
-
def find_name(name)
|
847
|
-
Gem::Specification.stubs.find_all do |spec|
|
848
|
-
spec.name == name
|
849
|
-
end.map(&:to_spec)
|
597
|
+
Gem::Ext::Builder.class_eval do
|
598
|
+
unless const_defined?(:CHDIR_MONITOR)
|
599
|
+
const_set(:CHDIR_MONITOR, EXT_LOCK)
|
850
600
|
end
|
851
|
-
end
|
852
601
|
|
853
|
-
|
854
|
-
|
855
|
-
require "bundler/gemdeps"
|
856
|
-
runtime = Bundler.setup
|
857
|
-
Bundler.ui = nil
|
858
|
-
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
859
|
-
[Gemdeps.new(runtime), activated_spec_names]
|
602
|
+
remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
|
603
|
+
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
|
860
604
|
end
|
605
|
+
end
|
861
606
|
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
false
|
866
|
-
end
|
607
|
+
def find_name(name)
|
608
|
+
Gem::Specification.stubs_for(name).map(&:to_spec)
|
609
|
+
end
|
867
610
|
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
611
|
+
if Gem::Specification.respond_to?(:default_stubs)
|
612
|
+
def default_stubs
|
613
|
+
Gem::Specification.default_stubs("*.gemspec")
|
614
|
+
end
|
615
|
+
else
|
616
|
+
def default_stubs
|
617
|
+
Gem::Specification.send(:default_stubs, "*.gemspec")
|
875
618
|
end
|
876
619
|
end
|
620
|
+
|
621
|
+
def use_gemdeps(gemfile)
|
622
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
|
623
|
+
require_relative "gemdeps"
|
624
|
+
runtime = Bundler.setup
|
625
|
+
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
626
|
+
[Gemdeps.new(runtime), activated_spec_names]
|
627
|
+
end
|
877
628
|
end
|
878
629
|
|
879
630
|
def self.rubygems
|
880
|
-
@rubygems ||=
|
881
|
-
RubygemsIntegration::MoreFuture.new
|
882
|
-
elsif RubygemsIntegration.provides?(">= 1.99.99")
|
883
|
-
RubygemsIntegration::Future.new
|
884
|
-
elsif RubygemsIntegration.provides?(">= 1.8.20")
|
885
|
-
RubygemsIntegration::MoreModern.new
|
886
|
-
elsif RubygemsIntegration.provides?(">= 1.8.5")
|
887
|
-
RubygemsIntegration::Modern.new
|
888
|
-
elsif RubygemsIntegration.provides?(">= 1.8.0")
|
889
|
-
RubygemsIntegration::AlmostModern.new
|
890
|
-
elsif RubygemsIntegration.provides?(">= 1.7.0")
|
891
|
-
RubygemsIntegration::Transitional.new
|
892
|
-
elsif RubygemsIntegration.provides?(">= 1.4.0")
|
893
|
-
RubygemsIntegration::Legacy.new
|
894
|
-
else # RubyGems 1.3.6 and 1.3.7
|
895
|
-
RubygemsIntegration::Ancient.new
|
896
|
-
end
|
631
|
+
@rubygems ||= RubygemsIntegration.new
|
897
632
|
end
|
898
633
|
end
|