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,282 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "digest/sha1"
|
3
|
+
|
4
|
+
module Bundler
|
5
|
+
class Runtime < Environment
|
6
|
+
include SharedHelpers
|
7
|
+
|
8
|
+
def setup(*groups)
|
9
|
+
groups.map!(&:to_sym)
|
10
|
+
|
11
|
+
# Has to happen first
|
12
|
+
clean_load_path
|
13
|
+
|
14
|
+
specs = groups.any? ? @definition.specs_for(groups) : requested_specs
|
15
|
+
|
16
|
+
SharedHelpers.set_bundle_environment
|
17
|
+
Bundler.rubygems.replace_entrypoints(specs)
|
18
|
+
|
19
|
+
# Activate the specs
|
20
|
+
load_paths = specs.map do |spec|
|
21
|
+
unless spec.loaded_from
|
22
|
+
raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it."
|
23
|
+
end
|
24
|
+
|
25
|
+
if (activated_spec = Bundler.rubygems.loaded_specs(spec.name)) && activated_spec.version != spec.version
|
26
|
+
e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
|
27
|
+
"but your Gemfile requires #{spec.name} #{spec.version}. Prepending " \
|
28
|
+
"`bundle exec` to your command may solve this."
|
29
|
+
e.name = spec.name
|
30
|
+
if e.respond_to?(:requirement=)
|
31
|
+
e.requirement = Gem::Requirement.new(spec.version.to_s)
|
32
|
+
else
|
33
|
+
e.version_requirement = Gem::Requirement.new(spec.version.to_s)
|
34
|
+
end
|
35
|
+
raise e
|
36
|
+
end
|
37
|
+
|
38
|
+
Bundler.rubygems.mark_loaded(spec)
|
39
|
+
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
|
40
|
+
end.reverse.flatten
|
41
|
+
|
42
|
+
# See Gem::Specification#add_self_to_load_path (since RubyGems 1.8)
|
43
|
+
if insert_index = Bundler.rubygems.load_path_insert_index
|
44
|
+
# Gem directories must come after -I and ENV['RUBYLIB']
|
45
|
+
$LOAD_PATH.insert(insert_index, *load_paths)
|
46
|
+
else
|
47
|
+
# We are probably testing in core, -I and RUBYLIB don't apply
|
48
|
+
$LOAD_PATH.unshift(*load_paths)
|
49
|
+
end
|
50
|
+
|
51
|
+
setup_manpath
|
52
|
+
|
53
|
+
lock(:preserve_unknown_sections => true)
|
54
|
+
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
REQUIRE_ERRORS = [
|
59
|
+
/^no such file to load -- (.+)$/i,
|
60
|
+
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
|
61
|
+
/^Missing API definition file in (.+)$/i,
|
62
|
+
/^cannot load such file -- (.+)$/i,
|
63
|
+
/^dlopen\([^)]*\): Library not loaded: (.+)$/i,
|
64
|
+
].freeze
|
65
|
+
|
66
|
+
def require(*groups)
|
67
|
+
groups.map!(&:to_sym)
|
68
|
+
groups = [:default] if groups.empty?
|
69
|
+
|
70
|
+
@definition.dependencies.each do |dep|
|
71
|
+
# Skip the dependency if it is not in any of the requested groups, or
|
72
|
+
# not for the current platform, or doesn't match the gem constraints.
|
73
|
+
next unless (dep.groups & groups).any? && dep.should_include?
|
74
|
+
|
75
|
+
required_file = nil
|
76
|
+
|
77
|
+
begin
|
78
|
+
# Loop through all the specified autorequires for the
|
79
|
+
# dependency. If there are none, use the dependency's name
|
80
|
+
# as the autorequire.
|
81
|
+
Array(dep.autorequire || dep.name).each do |file|
|
82
|
+
# Allow `require: true` as an alias for `require: <name>`
|
83
|
+
file = dep.name if file == true
|
84
|
+
required_file = file
|
85
|
+
begin
|
86
|
+
Kernel.require file
|
87
|
+
rescue => e
|
88
|
+
raise e if e.is_a?(LoadError) # we handle this a little later
|
89
|
+
raise Bundler::GemRequireError.new e,
|
90
|
+
"There was an error while trying to load the gem '#{file}'."
|
91
|
+
end
|
92
|
+
end
|
93
|
+
rescue LoadError => e
|
94
|
+
REQUIRE_ERRORS.find {|r| r =~ e.message }
|
95
|
+
raise if dep.autorequire || $1 != required_file
|
96
|
+
|
97
|
+
if dep.autorequire.nil? && dep.name.include?("-")
|
98
|
+
begin
|
99
|
+
namespaced_file = dep.name.tr("-", "/")
|
100
|
+
Kernel.require namespaced_file
|
101
|
+
rescue LoadError => e
|
102
|
+
REQUIRE_ERRORS.find {|r| r =~ e.message }
|
103
|
+
raise if $1 != namespaced_file
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
alias_method :gems, :specs
|
111
|
+
|
112
|
+
def cache(custom_path = nil)
|
113
|
+
cache_path = Bundler.app_cache(custom_path)
|
114
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
115
|
+
FileUtils.mkdir_p(p)
|
116
|
+
end unless File.exist?(cache_path)
|
117
|
+
|
118
|
+
Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
|
119
|
+
|
120
|
+
specs.each do |spec|
|
121
|
+
next if spec.name == "bundler"
|
122
|
+
next if spec.source.is_a?(Source::Gemspec)
|
123
|
+
spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
|
124
|
+
spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
|
125
|
+
end
|
126
|
+
|
127
|
+
Dir[cache_path.join("*/.git")].each do |git_dir|
|
128
|
+
FileUtils.rm_rf(git_dir)
|
129
|
+
FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
|
130
|
+
end
|
131
|
+
|
132
|
+
prune_cache(cache_path) unless Bundler.settings[:no_prune]
|
133
|
+
end
|
134
|
+
|
135
|
+
def prune_cache(cache_path)
|
136
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
137
|
+
FileUtils.mkdir_p(p)
|
138
|
+
end unless File.exist?(cache_path)
|
139
|
+
resolve = @definition.resolve
|
140
|
+
prune_gem_cache(resolve, cache_path)
|
141
|
+
prune_git_and_path_cache(resolve, cache_path)
|
142
|
+
end
|
143
|
+
|
144
|
+
def clean(dry_run = false)
|
145
|
+
gem_bins = Dir["#{Gem.dir}/bin/*"]
|
146
|
+
git_dirs = Dir["#{Gem.dir}/bundler/gems/*"]
|
147
|
+
git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"]
|
148
|
+
gem_dirs = Dir["#{Gem.dir}/gems/*"]
|
149
|
+
gem_files = Dir["#{Gem.dir}/cache/*.gem"]
|
150
|
+
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
|
151
|
+
spec_gem_paths = []
|
152
|
+
# need to keep git sources around
|
153
|
+
spec_git_paths = @definition.spec_git_paths
|
154
|
+
spec_git_cache_dirs = []
|
155
|
+
spec_gem_executables = []
|
156
|
+
spec_cache_paths = []
|
157
|
+
spec_gemspec_paths = []
|
158
|
+
specs.each do |spec|
|
159
|
+
spec_gem_paths << spec.full_gem_path
|
160
|
+
# need to check here in case gems are nested like for the rails git repo
|
161
|
+
md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
|
162
|
+
spec_git_paths << md[1] if md
|
163
|
+
spec_gem_executables << spec.executables.collect do |executable|
|
164
|
+
e = "#{Bundler.rubygems.gem_bindir}/#{executable}"
|
165
|
+
[e, "#{e}.bat"]
|
166
|
+
end
|
167
|
+
spec_cache_paths << spec.cache_file
|
168
|
+
spec_gemspec_paths << spec.spec_file
|
169
|
+
spec_git_cache_dirs << spec.source.cache_path.to_s if spec.source.is_a?(Bundler::Source::Git)
|
170
|
+
end
|
171
|
+
spec_gem_paths.uniq!
|
172
|
+
spec_gem_executables.flatten!
|
173
|
+
|
174
|
+
stale_gem_bins = gem_bins - spec_gem_executables
|
175
|
+
stale_git_dirs = git_dirs - spec_git_paths - ["#{Gem.dir}/bundler/gems/extensions"]
|
176
|
+
stale_git_cache_dirs = git_cache_dirs - spec_git_cache_dirs
|
177
|
+
stale_gem_dirs = gem_dirs - spec_gem_paths
|
178
|
+
stale_gem_files = gem_files - spec_cache_paths
|
179
|
+
stale_gemspec_files = gemspec_files - spec_gemspec_paths
|
180
|
+
|
181
|
+
removed_stale_gem_dirs = stale_gem_dirs.collect {|dir| remove_dir(dir, dry_run) }
|
182
|
+
removed_stale_git_dirs = stale_git_dirs.collect {|dir| remove_dir(dir, dry_run) }
|
183
|
+
output = removed_stale_gem_dirs + removed_stale_git_dirs
|
184
|
+
|
185
|
+
unless dry_run
|
186
|
+
stale_files = stale_gem_bins + stale_gem_files + stale_gemspec_files
|
187
|
+
stale_files.each do |file|
|
188
|
+
SharedHelpers.filesystem_access(File.dirname(file)) do |_p|
|
189
|
+
FileUtils.rm(file) if File.exist?(file)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
stale_git_cache_dirs.each do |cache_dir|
|
193
|
+
SharedHelpers.filesystem_access(cache_dir) do |dir|
|
194
|
+
FileUtils.rm_rf(dir) if File.exist?(dir)
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
output
|
200
|
+
end
|
201
|
+
|
202
|
+
private
|
203
|
+
|
204
|
+
def prune_gem_cache(resolve, cache_path)
|
205
|
+
cached = Dir["#{cache_path}/*.gem"]
|
206
|
+
|
207
|
+
cached = cached.delete_if do |path|
|
208
|
+
spec = Bundler.rubygems.spec_from_gem path
|
209
|
+
|
210
|
+
resolve.any? do |s|
|
211
|
+
s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
if cached.any?
|
216
|
+
Bundler.ui.info "Removing outdated .gem files from #{Bundler.settings.app_cache_path}"
|
217
|
+
|
218
|
+
cached.each do |path|
|
219
|
+
Bundler.ui.info " * #{File.basename(path)}"
|
220
|
+
File.delete(path)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def prune_git_and_path_cache(resolve, cache_path)
|
226
|
+
cached = Dir["#{cache_path}/*/.bundlecache"]
|
227
|
+
|
228
|
+
cached = cached.delete_if do |path|
|
229
|
+
name = File.basename(File.dirname(path))
|
230
|
+
|
231
|
+
resolve.any? do |s|
|
232
|
+
source = s.source
|
233
|
+
source.respond_to?(:app_cache_dirname) && source.app_cache_dirname == name
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
if cached.any?
|
238
|
+
Bundler.ui.info "Removing outdated git and path gems from #{Bundler.settings.app_cache_path}"
|
239
|
+
|
240
|
+
cached.each do |path|
|
241
|
+
path = File.dirname(path)
|
242
|
+
Bundler.ui.info " * #{File.basename(path)}"
|
243
|
+
FileUtils.rm_rf(path)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def setup_manpath
|
249
|
+
# Store original MANPATH for restoration later in with_clean_env()
|
250
|
+
ENV["BUNDLE_ORIG_MANPATH"] = ENV["MANPATH"]
|
251
|
+
|
252
|
+
# Add man/ subdirectories from activated bundles to MANPATH for man(1)
|
253
|
+
manuals = $LOAD_PATH.map do |path|
|
254
|
+
man_subdir = path.sub(/lib$/, "man")
|
255
|
+
man_subdir unless Dir[man_subdir + "/man?/"].empty?
|
256
|
+
end.compact
|
257
|
+
|
258
|
+
return if manuals.empty?
|
259
|
+
ENV["MANPATH"] = manuals.concat(
|
260
|
+
ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR)
|
261
|
+
).uniq.join(File::PATH_SEPARATOR)
|
262
|
+
end
|
263
|
+
|
264
|
+
def remove_dir(dir, dry_run)
|
265
|
+
full_name = Pathname.new(dir).basename.to_s
|
266
|
+
|
267
|
+
parts = full_name.split("-")
|
268
|
+
name = parts[0..-2].join("-")
|
269
|
+
version = parts.last
|
270
|
+
output = "#{name} (#{version})"
|
271
|
+
|
272
|
+
if dry_run
|
273
|
+
Bundler.ui.info "Would have removed #{output}"
|
274
|
+
else
|
275
|
+
Bundler.ui.info "Removing #{output}"
|
276
|
+
FileUtils.rm_rf(dir)
|
277
|
+
end
|
278
|
+
|
279
|
+
output
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
@@ -0,0 +1,259 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "uri"
|
3
|
+
|
4
|
+
module Bundler
|
5
|
+
class Settings
|
6
|
+
BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning no_install plugins).freeze
|
7
|
+
NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze
|
8
|
+
DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }.freeze
|
9
|
+
|
10
|
+
def initialize(root = nil)
|
11
|
+
@root = root
|
12
|
+
@local_config = load_config(local_config_file)
|
13
|
+
@global_config = load_config(global_config_file)
|
14
|
+
end
|
15
|
+
|
16
|
+
def [](name)
|
17
|
+
key = key_for(name)
|
18
|
+
value = (@local_config[key] || ENV[key] || @global_config[key] || DEFAULT_CONFIG[name])
|
19
|
+
|
20
|
+
case
|
21
|
+
when value.nil?
|
22
|
+
nil
|
23
|
+
when is_bool(name) || value == "false"
|
24
|
+
to_bool(value)
|
25
|
+
when is_num(name)
|
26
|
+
value.to_i
|
27
|
+
else
|
28
|
+
value
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def []=(key, value)
|
33
|
+
local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
|
34
|
+
set_key(key, value, @local_config, local_config_file)
|
35
|
+
end
|
36
|
+
|
37
|
+
alias_method :set_local, :[]=
|
38
|
+
|
39
|
+
def delete(key)
|
40
|
+
@local_config.delete(key_for(key))
|
41
|
+
end
|
42
|
+
|
43
|
+
def set_global(key, value)
|
44
|
+
set_key(key, value, @global_config, global_config_file)
|
45
|
+
end
|
46
|
+
|
47
|
+
def all
|
48
|
+
env_keys = ENV.keys.select {|k| k =~ /BUNDLE_.*/ }
|
49
|
+
|
50
|
+
keys = @global_config.keys | @local_config.keys | env_keys
|
51
|
+
|
52
|
+
keys.map do |key|
|
53
|
+
key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def local_overrides
|
58
|
+
repos = {}
|
59
|
+
all.each do |k|
|
60
|
+
repos[$'] = self[k] if k =~ /^local\./
|
61
|
+
end
|
62
|
+
repos
|
63
|
+
end
|
64
|
+
|
65
|
+
def mirror_for(uri)
|
66
|
+
uri = URI(uri.to_s) unless uri.is_a?(URI)
|
67
|
+
gem_mirrors.for(uri.to_s).uri
|
68
|
+
end
|
69
|
+
|
70
|
+
def credentials_for(uri)
|
71
|
+
self[uri.to_s] || self[uri.host]
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_mirrors
|
75
|
+
all.inject(Mirrors.new) do |mirrors, k|
|
76
|
+
mirrors.parse(k, self[k]) if k =~ /^mirror\./
|
77
|
+
mirrors
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def locations(key)
|
82
|
+
key = key_for(key)
|
83
|
+
locations = {}
|
84
|
+
locations[:local] = @local_config[key] if @local_config.key?(key)
|
85
|
+
locations[:env] = ENV[key] if ENV[key]
|
86
|
+
locations[:global] = @global_config[key] if @global_config.key?(key)
|
87
|
+
locations[:default] = DEFAULT_CONFIG[key] if DEFAULT_CONFIG.key?(key)
|
88
|
+
locations
|
89
|
+
end
|
90
|
+
|
91
|
+
def pretty_values_for(exposed_key)
|
92
|
+
key = key_for(exposed_key)
|
93
|
+
|
94
|
+
locations = []
|
95
|
+
if @local_config.key?(key)
|
96
|
+
locations << "Set for your local app (#{local_config_file}): #{@local_config[key].inspect}"
|
97
|
+
end
|
98
|
+
|
99
|
+
if value = ENV[key]
|
100
|
+
locations << "Set via #{key}: #{value.inspect}"
|
101
|
+
end
|
102
|
+
|
103
|
+
if @global_config.key?(key)
|
104
|
+
locations << "Set for the current user (#{global_config_file}): #{@global_config[key].inspect}"
|
105
|
+
end
|
106
|
+
|
107
|
+
return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
|
108
|
+
locations
|
109
|
+
end
|
110
|
+
|
111
|
+
def without=(array)
|
112
|
+
set_array(:without, array)
|
113
|
+
end
|
114
|
+
|
115
|
+
def with=(array)
|
116
|
+
set_array(:with, array)
|
117
|
+
end
|
118
|
+
|
119
|
+
def without
|
120
|
+
get_array(:without)
|
121
|
+
end
|
122
|
+
|
123
|
+
def with
|
124
|
+
get_array(:with)
|
125
|
+
end
|
126
|
+
|
127
|
+
# @local_config["BUNDLE_PATH"] should be prioritized over ENV["BUNDLE_PATH"]
|
128
|
+
def path
|
129
|
+
key = key_for(:path)
|
130
|
+
path = ENV[key] || @global_config[key]
|
131
|
+
return path if path && !@local_config.key?(key)
|
132
|
+
|
133
|
+
if path = self[:path]
|
134
|
+
"#{path}/#{Bundler.ruby_scope}"
|
135
|
+
else
|
136
|
+
Bundler.rubygems.gem_dir
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def allow_sudo?
|
141
|
+
!@local_config.key?(key_for(:path))
|
142
|
+
end
|
143
|
+
|
144
|
+
def ignore_config?
|
145
|
+
ENV["BUNDLE_IGNORE_CONFIG"]
|
146
|
+
end
|
147
|
+
|
148
|
+
def app_cache_path
|
149
|
+
@app_cache_path ||= begin
|
150
|
+
path = self[:cache_path] || "vendor/cache"
|
151
|
+
raise InvalidOption, "Cache path must be relative to the bundle path" if path.start_with?("/")
|
152
|
+
path
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
private
|
157
|
+
|
158
|
+
def key_for(key)
|
159
|
+
key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
160
|
+
key = key.to_s.gsub(".", "__").upcase
|
161
|
+
"BUNDLE_#{key}"
|
162
|
+
end
|
163
|
+
|
164
|
+
def parent_setting_for(name)
|
165
|
+
split_specfic_setting_for(name)[0]
|
166
|
+
end
|
167
|
+
|
168
|
+
def specfic_gem_for(name)
|
169
|
+
split_specfic_setting_for(name)[1]
|
170
|
+
end
|
171
|
+
|
172
|
+
def split_specfic_setting_for(name)
|
173
|
+
name.split(".")
|
174
|
+
end
|
175
|
+
|
176
|
+
def is_bool(name)
|
177
|
+
BOOL_KEYS.include?(name.to_s) || BOOL_KEYS.include?(parent_setting_for(name.to_s))
|
178
|
+
end
|
179
|
+
|
180
|
+
def to_bool(value)
|
181
|
+
!(value.nil? || value == "" || value =~ /^(false|f|no|n|0)$/i || value == false)
|
182
|
+
end
|
183
|
+
|
184
|
+
def is_num(value)
|
185
|
+
NUMBER_KEYS.include?(value.to_s)
|
186
|
+
end
|
187
|
+
|
188
|
+
def get_array(key)
|
189
|
+
self[key] ? self[key].split(":").map(&:to_sym) : []
|
190
|
+
end
|
191
|
+
|
192
|
+
def set_array(key, array)
|
193
|
+
self[key] = (array.empty? ? nil : array.join(":")) if array
|
194
|
+
end
|
195
|
+
|
196
|
+
def set_key(key, value, hash, file)
|
197
|
+
key = key_for(key)
|
198
|
+
|
199
|
+
unless hash[key] == value
|
200
|
+
hash[key] = value
|
201
|
+
hash.delete(key) if value.nil?
|
202
|
+
SharedHelpers.filesystem_access(file) do |p|
|
203
|
+
FileUtils.mkdir_p(p.dirname)
|
204
|
+
require "bundler/yaml_serializer"
|
205
|
+
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
value
|
210
|
+
end
|
211
|
+
|
212
|
+
def global_config_file
|
213
|
+
if ENV["BUNDLE_CONFIG"] && !ENV["BUNDLE_CONFIG"].empty?
|
214
|
+
Pathname.new(ENV["BUNDLE_CONFIG"])
|
215
|
+
else
|
216
|
+
Bundler.user_bundle_path.join("config")
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def local_config_file
|
221
|
+
Pathname.new(@root).join("config") if @root
|
222
|
+
end
|
223
|
+
|
224
|
+
CONFIG_REGEX = %r{ # rubocop:disable Style/RegexpLiteral
|
225
|
+
^
|
226
|
+
(BUNDLE_.+):\s # the key
|
227
|
+
(?: !\s)? # optional exclamation mark found with ruby 1.9.3
|
228
|
+
(['"]?) # optional opening quote
|
229
|
+
(.* # contents of the value
|
230
|
+
(?: # optionally, up until the next key
|
231
|
+
(\n(?!BUNDLE).+)*
|
232
|
+
)
|
233
|
+
)
|
234
|
+
\2 # matching closing quote
|
235
|
+
$
|
236
|
+
}xo
|
237
|
+
|
238
|
+
def load_config(config_file)
|
239
|
+
SharedHelpers.filesystem_access(config_file, :read) do
|
240
|
+
valid_file = config_file && config_file.exist? && !config_file.size.zero?
|
241
|
+
return {} if ignore_config? || !valid_file
|
242
|
+
require "bundler/yaml_serializer"
|
243
|
+
YAMLSerializer.load config_file.read
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# TODO: duplicates Rubygems#normalize_uri
|
248
|
+
# TODO: is this the correct place to validate mirror URIs?
|
249
|
+
def self.normalize_uri(uri)
|
250
|
+
uri = uri.to_s
|
251
|
+
uri = "#{uri}/" unless uri =~ %r{/\Z}
|
252
|
+
uri = URI(uri)
|
253
|
+
unless uri.absolute?
|
254
|
+
raise ArgumentError, "Gem sources must be absolute. You provided '#{uri}'."
|
255
|
+
end
|
256
|
+
uri
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|