bundler 1.17.3 → 2.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3354 -1258
- data/LICENSE.md +18 -19
- data/README.md +10 -15
- data/bundler.gemspec +15 -33
- data/exe/bundle +8 -10
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +5 -13
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/checksum.rb +254 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +29 -15
- data/lib/bundler/cli/binstubs.rb +13 -5
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +7 -5
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +50 -14
- data/lib/bundler/cli/config.rb +171 -86
- data/lib/bundler/cli/console.rb +3 -6
- data/lib/bundler/cli/doctor.rb +29 -12
- data/lib/bundler/cli/exec.rb +9 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +268 -53
- data/lib/bundler/cli/info.rb +51 -18
- data/lib/bundler/cli/init.rb +7 -3
- data/lib/bundler/cli/inject.rb +2 -2
- data/lib/bundler/cli/install.rb +55 -73
- data/lib/bundler/cli/issue.rb +9 -8
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +56 -26
- data/lib/bundler/cli/open.rb +10 -7
- data/lib/bundler/cli/outdated.rb +159 -128
- data/lib/bundler/cli/platform.rb +8 -6
- data/lib/bundler/cli/plugin.rb +23 -12
- data/lib/bundler/cli/pristine.rb +39 -26
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +7 -7
- data/lib/bundler/cli/update.rb +51 -19
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +399 -390
- data/lib/bundler/compact_index_client/cache.rb +55 -77
- data/lib/bundler/compact_index_client/cache_file.rb +148 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +32 -0
- data/lib/bundler/compact_index_client/parser.rb +84 -0
- data/lib/bundler/compact_index_client/updater.rb +72 -84
- data/lib/bundler/compact_index_client.rb +61 -73
- data/lib/bundler/constants.rb +9 -2
- data/lib/bundler/current_ruby.rb +20 -21
- data/lib/bundler/definition.rb +663 -505
- data/lib/bundler/dependency.rb +38 -71
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +171 -152
- data/lib/bundler/endpoint_specification.rb +43 -17
- data/lib/bundler/env.rb +11 -18
- data/lib/bundler/environment_preserver.rb +17 -8
- data/lib/bundler/errors.rb +115 -14
- data/lib/bundler/feature_flag.rb +15 -39
- data/lib/bundler/fetcher/base.rb +12 -12
- data/lib/bundler/fetcher/compact_index.rb +41 -47
- data/lib/bundler/fetcher/dependency.rb +4 -8
- data/lib/bundler/fetcher/downloader.rb +27 -20
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/lib/bundler/fetcher/index.rb +6 -33
- data/lib/bundler/fetcher.rb +109 -90
- data/lib/bundler/force_platform.rb +16 -0
- data/lib/bundler/friendly_errors.rb +50 -55
- data/lib/bundler/gem_helper.rb +81 -46
- data/lib/bundler/gem_helpers.rb +78 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +68 -109
- data/lib/bundler/graph.rb +11 -11
- data/lib/bundler/index.rb +74 -82
- data/lib/bundler/injector.rb +58 -26
- data/lib/bundler/inline.rb +59 -35
- data/lib/bundler/installer/gem_installer.rb +29 -29
- data/lib/bundler/installer/parallel_installer.rb +38 -68
- data/lib/bundler/installer/standalone.rb +76 -16
- data/lib/bundler/installer.rb +60 -135
- data/lib/bundler/lazy_specification.rb +161 -63
- data/lib/bundler/lockfile_generator.rb +14 -5
- data/lib/bundler/lockfile_parser.rb +150 -109
- data/lib/bundler/man/bundle-add.1 +76 -0
- data/lib/bundler/man/bundle-add.1.ronn +87 -0
- data/{man → lib/bundler/man}/bundle-binstubs.1 +15 -22
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +8 -7
- data/lib/bundler/man/bundle-cache.1 +68 -0
- data/lib/bundler/man/bundle-cache.1.ronn +108 -0
- data/{man → lib/bundler/man}/bundle-check.1 +7 -14
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +7 -2
- data/{man → lib/bundler/man}/bundle-clean.1 +4 -11
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +80 -260
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +104 -98
- data/lib/bundler/man/bundle-console.1 +33 -0
- data/lib/bundler/man/bundle-console.1.ronn +39 -0
- data/{man → lib/bundler/man}/bundle-doctor.1 +5 -19
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +1 -1
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +20 -78
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +12 -10
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +87 -0
- data/lib/bundler/man/bundle-gem.1.ronn +149 -0
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +17 -0
- data/lib/bundler/man/bundle-info.1.ronn +21 -0
- data/{man → lib/bundler/man}/bundle-init.1 +8 -13
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +5 -2
- data/lib/bundler/man/bundle-inject.1 +31 -0
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +12 -2
- data/{man → lib/bundler/man}/bundle-install.1 +65 -155
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +66 -57
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/{man → lib/bundler/man}/bundle-list.1 +9 -24
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +10 -7
- data/{man → lib/bundler/man}/bundle-lock.1 +25 -34
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +25 -4
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +10 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +23 -75
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +21 -22
- data/lib/bundler/man/bundle-platform.1 +49 -0
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/lib/bundler/man/bundle-plugin.1 +58 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +5 -16
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +4 -14
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +7 -11
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +4 -0
- data/{man → lib/bundler/man}/bundle-update.1 +35 -148
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +21 -12
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/{man → lib/bundler/man}/bundle-viz.1 +9 -18
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +9 -3
- data/{man → lib/bundler/man}/bundle.1 +19 -53
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +14 -9
- data/{man → lib/bundler/man}/gemfile.5 +139 -356
- data/{man → lib/bundler/man}/gemfile.5.ronn +134 -97
- data/{man → lib/bundler/man}/index.txt +9 -1
- data/lib/bundler/match_metadata.rb +17 -0
- data/lib/bundler/match_platform.rb +2 -3
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/mirror.rb +10 -12
- data/lib/bundler/plugin/api/source.rb +34 -18
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/events.rb +24 -0
- data/lib/bundler/plugin/index.rb +44 -9
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/path.rb +18 -0
- data/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/lib/bundler/plugin/installer.rb +63 -27
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +131 -45
- data/lib/bundler/process_lock.rb +10 -14
- data/lib/bundler/remote_specification.rb +22 -10
- data/lib/bundler/resolver/base.rb +118 -0
- data/lib/bundler/resolver/candidate.rb +82 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +90 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +60 -68
- data/lib/bundler/resolver.rb +454 -303
- data/lib/bundler/retry.rb +6 -6
- data/lib/bundler/ruby_dsl.rb +51 -7
- data/lib/bundler/ruby_version.rb +23 -38
- data/lib/bundler/rubygems_ext.rb +357 -98
- data/lib/bundler/rubygems_gem_installer.rb +131 -65
- data/lib/bundler/rubygems_integration.rb +149 -591
- data/lib/bundler/runtime.rb +51 -51
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +206 -0
- data/lib/bundler/settings.rb +271 -135
- data/lib/bundler/setup.rb +23 -12
- data/lib/bundler/shared_helpers.rb +127 -117
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +326 -127
- data/lib/bundler/source/git.rb +207 -88
- data/lib/bundler/source/metadata.rb +19 -18
- data/lib/bundler/source/path/installer.rb +11 -32
- data/lib/bundler/source/path.rb +39 -38
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +223 -255
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +33 -11
- data/lib/bundler/source_list.rb +131 -66
- data/lib/bundler/source_map.rb +71 -0
- data/lib/bundler/spec_set.rb +239 -94
- data/lib/bundler/stub_specification.rb +77 -39
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +23 -19
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +104 -46
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +18 -16
- data/lib/bundler/templates/newgem/Rakefile.tt +44 -6
- data/lib/bundler/templates/newgem/bin/console.tt +1 -4
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +25 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +37 -0
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +18 -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 +37 -40
- data/lib/bundler/templates/newgem/rubocop.yml.tt +8 -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 +3 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/test_newgem.rb.tt} +3 -1
- 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/ui/rg_proxy.rb +2 -2
- data/lib/bundler/ui/shell.rb +64 -23
- data/lib/bundler/ui/silent.rb +33 -6
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +11 -5
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/.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 +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +175 -0
- data/lib/bundler/vendor/fileutils/.document +1 -0
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1490 -432
- data/lib/bundler/vendor/net-http-persistent/.document +1 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -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 +362 -484
- data/lib/bundler/vendor/pub_grub/.document +1 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/securerandom/.document +1 -0
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/bundler/vendor/thor/.document +1 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +4 -3
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +8 -18
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +27 -20
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +34 -13
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +47 -28
- data/lib/bundler/vendor/thor/lib/thor/base.rb +200 -54
- data/lib/bundler/vendor/thor/lib/thor/command.rb +34 -18
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +74 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +15 -4
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +2 -1
- 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/argument.rb +17 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +35 -15
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +45 -13
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +86 -13
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +51 -40
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +99 -148
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -43
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -49
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/util.rb +26 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +182 -17
- data/lib/bundler/vendor/tsort/.document +1 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/.document +1 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +876 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1578 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +125 -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 +22 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +1 -42
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_securerandom.rb +12 -0
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +21 -0
- data/lib/bundler/version.rb +5 -20
- data/lib/bundler/vlad.rb +3 -3
- data/lib/bundler/worker.rb +26 -15
- data/lib/bundler/yaml_serializer.rb +21 -13
- data/lib/bundler.rb +364 -230
- metadata +186 -218
- 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/dep_proxy.rb +0 -48
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -37
- 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/gems.rb +0 -8
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -3
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -7
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -81
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -136
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -223
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -101
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -837
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -12
- 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/lib/bundler/version_ranges.rb +0 -76
- data/man/bundle-add.1 +0 -58
- data/man/bundle-add.1.txt +0 -52
- data/man/bundle-add.ronn +0 -40
- 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 +0 -80
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-gem.ronn +0 -78
- data/man/bundle-info.1 +0 -20
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-info.ronn +0 -17
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1 +0 -33
- 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 +0 -32
- 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-package.ronn +0 -72
- data/man/bundle-platform.1 +0 -61
- 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 -116
- data/man/gemfile.5.txt +0 -653
- /data/lib/bundler/{ssl_certs → man}/.document +0 -0
data/lib/bundler.rb
CHANGED
@@ -1,77 +1,101 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
require "bundler/vendored_fileutils"
|
3
|
+
require_relative "bundler/vendored_fileutils"
|
6
4
|
require "pathname"
|
7
5
|
require "rbconfig"
|
8
|
-
require "thread"
|
9
|
-
|
10
|
-
require "bundler/errors"
|
11
|
-
require "bundler/environment_preserver"
|
12
|
-
require "bundler/plugin"
|
13
|
-
require "bundler/rubygems_ext"
|
14
|
-
require "bundler/rubygems_integration"
|
15
|
-
require "bundler/version"
|
16
|
-
require "bundler/constants"
|
17
|
-
require "bundler/current_ruby"
|
18
|
-
require "bundler/build_metadata"
|
19
6
|
|
7
|
+
require_relative "bundler/errors"
|
8
|
+
require_relative "bundler/environment_preserver"
|
9
|
+
require_relative "bundler/plugin"
|
10
|
+
require_relative "bundler/rubygems_ext"
|
11
|
+
require_relative "bundler/rubygems_integration"
|
12
|
+
require_relative "bundler/version"
|
13
|
+
require_relative "bundler/current_ruby"
|
14
|
+
require_relative "bundler/build_metadata"
|
15
|
+
|
16
|
+
# Bundler provides a consistent environment for Ruby projects by
|
17
|
+
# tracking and installing the exact gems and versions that are needed.
|
18
|
+
#
|
19
|
+
# Bundler is a part of Ruby's standard library.
|
20
|
+
#
|
21
|
+
# Bundler is used by creating _gemfiles_ listing all the project dependencies
|
22
|
+
# and (optionally) their versions and then using
|
23
|
+
#
|
24
|
+
# require 'bundler/setup'
|
25
|
+
#
|
26
|
+
# or Bundler.setup to setup environment where only specified gems and their
|
27
|
+
# specified versions could be used.
|
28
|
+
#
|
29
|
+
# See {Bundler website}[https://bundler.io/docs.html] for extensive documentation
|
30
|
+
# on gemfiles creation and Bundler usage.
|
31
|
+
#
|
32
|
+
# As a standard library inside project, Bundler could be used for introspection
|
33
|
+
# of loaded and required modules.
|
34
|
+
#
|
20
35
|
module Bundler
|
21
|
-
environment_preserver = EnvironmentPreserver.
|
36
|
+
environment_preserver = EnvironmentPreserver.from_env
|
22
37
|
ORIGINAL_ENV = environment_preserver.restore
|
23
|
-
|
24
|
-
SUDO_MUTEX = Mutex.new
|
25
|
-
|
26
|
-
autoload :
|
27
|
-
autoload :
|
28
|
-
autoload :
|
29
|
-
autoload :
|
30
|
-
autoload :
|
31
|
-
autoload :
|
32
|
-
autoload :
|
33
|
-
autoload :
|
34
|
-
autoload :
|
35
|
-
autoload :
|
36
|
-
autoload :
|
37
|
-
autoload :
|
38
|
-
autoload :
|
39
|
-
autoload :
|
40
|
-
autoload :
|
41
|
-
autoload :
|
42
|
-
autoload :
|
43
|
-
autoload :
|
44
|
-
autoload :
|
45
|
-
autoload :
|
46
|
-
autoload :
|
47
|
-
autoload :
|
48
|
-
autoload :
|
49
|
-
autoload :
|
50
|
-
autoload :
|
51
|
-
autoload :
|
52
|
-
autoload :
|
53
|
-
autoload :
|
54
|
-
autoload :
|
55
|
-
autoload :
|
56
|
-
autoload :
|
57
|
-
autoload :
|
58
|
-
autoload :
|
59
|
-
autoload :
|
60
|
-
autoload :
|
61
|
-
autoload :
|
62
|
-
autoload :
|
38
|
+
environment_preserver.replace_with_backup
|
39
|
+
SUDO_MUTEX = Thread::Mutex.new
|
40
|
+
|
41
|
+
autoload :Checksum, File.expand_path("bundler/checksum", __dir__)
|
42
|
+
autoload :CLI, File.expand_path("bundler/cli", __dir__)
|
43
|
+
autoload :CIDetector, File.expand_path("bundler/ci_detector", __dir__)
|
44
|
+
autoload :CompactIndexClient, File.expand_path("bundler/compact_index_client", __dir__)
|
45
|
+
autoload :Definition, File.expand_path("bundler/definition", __dir__)
|
46
|
+
autoload :Dependency, File.expand_path("bundler/dependency", __dir__)
|
47
|
+
autoload :Deprecate, File.expand_path("bundler/deprecate", __dir__)
|
48
|
+
autoload :Digest, File.expand_path("bundler/digest", __dir__)
|
49
|
+
autoload :Dsl, File.expand_path("bundler/dsl", __dir__)
|
50
|
+
autoload :EndpointSpecification, File.expand_path("bundler/endpoint_specification", __dir__)
|
51
|
+
autoload :Env, File.expand_path("bundler/env", __dir__)
|
52
|
+
autoload :Fetcher, File.expand_path("bundler/fetcher", __dir__)
|
53
|
+
autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
|
54
|
+
autoload :FREEBSD, File.expand_path("bundler/constants", __dir__)
|
55
|
+
autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
|
56
|
+
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
57
|
+
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
|
58
|
+
autoload :Graph, File.expand_path("bundler/graph", __dir__)
|
59
|
+
autoload :Index, File.expand_path("bundler/index", __dir__)
|
60
|
+
autoload :Injector, File.expand_path("bundler/injector", __dir__)
|
61
|
+
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
62
|
+
autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
|
63
|
+
autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
|
64
|
+
autoload :MatchRemoteMetadata, File.expand_path("bundler/match_remote_metadata", __dir__)
|
65
|
+
autoload :Materialization, File.expand_path("bundler/materialization", __dir__)
|
66
|
+
autoload :NULL, File.expand_path("bundler/constants", __dir__)
|
67
|
+
autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
|
68
|
+
autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
|
69
|
+
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
|
70
|
+
autoload :Retry, File.expand_path("bundler/retry", __dir__)
|
71
|
+
autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
|
72
|
+
autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
|
73
|
+
autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
|
74
|
+
autoload :SelfManager, File.expand_path("bundler/self_manager", __dir__)
|
75
|
+
autoload :Settings, File.expand_path("bundler/settings", __dir__)
|
76
|
+
autoload :SharedHelpers, File.expand_path("bundler/shared_helpers", __dir__)
|
77
|
+
autoload :Source, File.expand_path("bundler/source", __dir__)
|
78
|
+
autoload :SourceList, File.expand_path("bundler/source_list", __dir__)
|
79
|
+
autoload :SourceMap, File.expand_path("bundler/source_map", __dir__)
|
80
|
+
autoload :SpecSet, File.expand_path("bundler/spec_set", __dir__)
|
81
|
+
autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
|
82
|
+
autoload :UI, File.expand_path("bundler/ui", __dir__)
|
83
|
+
autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
|
84
|
+
autoload :URINormalizer, File.expand_path("bundler/uri_normalizer", __dir__)
|
85
|
+
autoload :WINDOWS, File.expand_path("bundler/constants", __dir__)
|
86
|
+
autoload :SafeMarshal, File.expand_path("bundler/safe_marshal", __dir__)
|
63
87
|
|
64
88
|
class << self
|
65
89
|
def configure
|
66
|
-
@
|
90
|
+
@configure ||= configure_gem_home_and_path
|
67
91
|
end
|
68
92
|
|
69
93
|
def ui
|
70
|
-
(defined?(@ui) && @ui) || (self.ui = UI::
|
94
|
+
(defined?(@ui) && @ui) || (self.ui = UI::Shell.new)
|
71
95
|
end
|
72
96
|
|
73
97
|
def ui=(ui)
|
74
|
-
Bundler.rubygems.ui =
|
98
|
+
Bundler.rubygems.ui = UI::RGProxy.new(ui)
|
75
99
|
@ui = ui
|
76
100
|
end
|
77
101
|
|
@@ -80,6 +104,15 @@ module Bundler
|
|
80
104
|
@bundle_path ||= Pathname.new(configured_bundle_path.path).expand_path(root)
|
81
105
|
end
|
82
106
|
|
107
|
+
def create_bundle_path
|
108
|
+
mkdir_p(bundle_path) unless bundle_path.exist?
|
109
|
+
|
110
|
+
@bundle_path = bundle_path.realpath
|
111
|
+
rescue Errno::EEXIST
|
112
|
+
raise PathError, "Could not install to path `#{bundle_path}` " \
|
113
|
+
"because a file already exists at that path. Either remove or rename the file so the directory can be created."
|
114
|
+
end
|
115
|
+
|
83
116
|
def configured_bundle_path
|
84
117
|
@configured_bundle_path ||= settings.path.tap(&:validate!)
|
85
118
|
end
|
@@ -89,11 +122,38 @@ module Bundler
|
|
89
122
|
@bin_path ||= begin
|
90
123
|
path = settings[:bin] || "bin"
|
91
124
|
path = Pathname.new(path).expand_path(root).expand_path
|
92
|
-
|
125
|
+
mkdir_p(path)
|
93
126
|
path
|
94
127
|
end
|
95
128
|
end
|
96
129
|
|
130
|
+
# Turns on the Bundler runtime. After +Bundler.setup+ call, all +load+ or
|
131
|
+
# +require+ of the gems would be allowed only if they are part of
|
132
|
+
# the Gemfile or Ruby's standard library. If the versions specified
|
133
|
+
# in Gemfile, only those versions would be loaded.
|
134
|
+
#
|
135
|
+
# Assuming Gemfile
|
136
|
+
#
|
137
|
+
# gem 'first_gem', '= 1.0'
|
138
|
+
# group :test do
|
139
|
+
# gem 'second_gem', '= 1.0'
|
140
|
+
# end
|
141
|
+
#
|
142
|
+
# The code using Bundler.setup works as follows:
|
143
|
+
#
|
144
|
+
# require 'third_gem' # allowed, required from global gems
|
145
|
+
# require 'first_gem' # allowed, loads the last installed version
|
146
|
+
# Bundler.setup
|
147
|
+
# require 'fourth_gem' # fails with LoadError
|
148
|
+
# require 'second_gem' # loads exactly version 1.0
|
149
|
+
#
|
150
|
+
# +Bundler.setup+ can be called only once, all subsequent calls are no-op.
|
151
|
+
#
|
152
|
+
# If _groups_ list is provided, only gems from specified groups would
|
153
|
+
# be allowed (gems specified outside groups belong to special +:default+ group).
|
154
|
+
#
|
155
|
+
# To require all gems from Gemfile (or only some groups), see Bundler.require.
|
156
|
+
#
|
97
157
|
def setup(*groups)
|
98
158
|
# Return if all groups are already loaded
|
99
159
|
return @setup if defined?(@setup) && @setup
|
@@ -110,6 +170,47 @@ module Bundler
|
|
110
170
|
end
|
111
171
|
end
|
112
172
|
|
173
|
+
def auto_switch
|
174
|
+
self_manager.restart_with_locked_bundler_if_needed
|
175
|
+
end
|
176
|
+
|
177
|
+
# Automatically install dependencies if Bundler.settings[:auto_install] exists.
|
178
|
+
# This is set through config cmd `bundle config set --global auto_install 1`.
|
179
|
+
#
|
180
|
+
# Note that this method `nil`s out the global Definition object, so it
|
181
|
+
# should be called first, before you instantiate anything like an
|
182
|
+
# `Installer` that'll keep a reference to the old one instead.
|
183
|
+
def auto_install
|
184
|
+
return unless settings[:auto_install]
|
185
|
+
|
186
|
+
begin
|
187
|
+
definition.specs
|
188
|
+
rescue GemNotFound, GitError
|
189
|
+
ui.info "Automatically installing missing gems."
|
190
|
+
reset!
|
191
|
+
CLI::Install.new({}).run
|
192
|
+
reset!
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
# Setups Bundler environment (see Bundler.setup) if it is not already set,
|
197
|
+
# and loads all gems from groups specified. Unlike ::setup, can be called
|
198
|
+
# multiple times with different groups (if they were allowed by setup).
|
199
|
+
#
|
200
|
+
# Assuming Gemfile
|
201
|
+
#
|
202
|
+
# gem 'first_gem', '= 1.0'
|
203
|
+
# group :test do
|
204
|
+
# gem 'second_gem', '= 1.0'
|
205
|
+
# end
|
206
|
+
#
|
207
|
+
# The code will work as follows:
|
208
|
+
#
|
209
|
+
# Bundler.setup # allow all groups
|
210
|
+
# Bundler.require(:default) # requires only first_gem
|
211
|
+
# # ...later
|
212
|
+
# Bundler.require(:test) # requires second_gem
|
213
|
+
#
|
113
214
|
def require(*groups)
|
114
215
|
setup(*groups).require(*groups)
|
115
216
|
end
|
@@ -119,7 +220,7 @@ module Bundler
|
|
119
220
|
end
|
120
221
|
|
121
222
|
def environment
|
122
|
-
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load"
|
223
|
+
SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", print_caller_location: true
|
123
224
|
load
|
124
225
|
end
|
125
226
|
|
@@ -127,19 +228,21 @@ module Bundler
|
|
127
228
|
#
|
128
229
|
# @param unlock [Hash, Boolean, nil] Gems that have been requested
|
129
230
|
# to be updated or true if all gems should be updated
|
231
|
+
# @param lockfile [Pathname] Path to Gemfile.lock
|
130
232
|
# @return [Bundler::Definition]
|
131
|
-
def definition(unlock = nil)
|
233
|
+
def definition(unlock = nil, lockfile = default_lockfile)
|
132
234
|
@definition = nil if unlock
|
133
235
|
@definition ||= begin
|
134
236
|
configure
|
135
|
-
Definition.build(default_gemfile,
|
237
|
+
Definition.build(default_gemfile, lockfile, unlock)
|
136
238
|
end
|
137
239
|
end
|
138
240
|
|
139
241
|
def frozen_bundle?
|
140
|
-
frozen = settings[:
|
141
|
-
|
142
|
-
|
242
|
+
frozen = settings[:frozen]
|
243
|
+
return frozen unless frozen.nil?
|
244
|
+
|
245
|
+
settings[:deployment]
|
143
246
|
end
|
144
247
|
|
145
248
|
def locked_gems
|
@@ -153,7 +256,7 @@ module Bundler
|
|
153
256
|
end
|
154
257
|
|
155
258
|
def ruby_scope
|
156
|
-
"#{Bundler.rubygems.ruby_engine}/#{
|
259
|
+
"#{Bundler.rubygems.ruby_engine}/#{RbConfig::CONFIG["ruby_version"]}"
|
157
260
|
end
|
158
261
|
|
159
262
|
def user_home
|
@@ -170,9 +273,9 @@ module Bundler
|
|
170
273
|
end
|
171
274
|
|
172
275
|
if warning
|
173
|
-
|
174
|
-
user_home = tmp_home_path
|
175
|
-
Bundler.ui.warn "
|
276
|
+
Bundler.ui.warn "#{warning}\n"
|
277
|
+
user_home = tmp_home_path
|
278
|
+
Bundler.ui.warn "Bundler will use `#{user_home}' as your home directory temporarily.\n"
|
176
279
|
user_home
|
177
280
|
else
|
178
281
|
Pathname.new(home)
|
@@ -180,37 +283,22 @@ module Bundler
|
|
180
283
|
end
|
181
284
|
end
|
182
285
|
|
183
|
-
def tmp_home_path(login, warning)
|
184
|
-
login ||= "unknown"
|
185
|
-
Kernel.send(:require, "tmpdir")
|
186
|
-
path = Pathname.new(Dir.tmpdir).join("bundler", "home")
|
187
|
-
SharedHelpers.filesystem_access(path) do |tmp_home_path|
|
188
|
-
unless tmp_home_path.exist?
|
189
|
-
tmp_home_path.mkpath
|
190
|
-
tmp_home_path.chmod(0o777)
|
191
|
-
end
|
192
|
-
tmp_home_path.join(login).tap(&:mkpath)
|
193
|
-
end
|
194
|
-
rescue RuntimeError => e
|
195
|
-
raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}")
|
196
|
-
end
|
197
|
-
|
198
286
|
def user_bundle_path(dir = "home")
|
199
287
|
env_var, fallback = case dir
|
200
288
|
when "home"
|
201
|
-
["BUNDLE_USER_HOME", Pathname.new(user_home).join(".bundle")]
|
289
|
+
["BUNDLE_USER_HOME", proc { Pathname.new(user_home).join(".bundle") }]
|
202
290
|
when "cache"
|
203
|
-
["BUNDLE_USER_CACHE", user_bundle_path.join("cache")]
|
291
|
+
["BUNDLE_USER_CACHE", proc { user_bundle_path.join("cache") }]
|
204
292
|
when "config"
|
205
|
-
["BUNDLE_USER_CONFIG", user_bundle_path.join("config")]
|
293
|
+
["BUNDLE_USER_CONFIG", proc { user_bundle_path.join("config") }]
|
206
294
|
when "plugin"
|
207
|
-
["BUNDLE_USER_PLUGIN", user_bundle_path.join("plugin")]
|
295
|
+
["BUNDLE_USER_PLUGIN", proc { user_bundle_path.join("plugin") }]
|
208
296
|
else
|
209
297
|
raise BundlerError, "Unknown user path requested: #{dir}"
|
210
298
|
end
|
211
299
|
# `fallback` will already be a Pathname, but Pathname.new() is
|
212
300
|
# idempotent so it's OK
|
213
|
-
Pathname.new(ENV.fetch(env_var, fallback))
|
301
|
+
Pathname.new(ENV.fetch(env_var, &fallback))
|
214
302
|
end
|
215
303
|
|
216
304
|
def user_cache
|
@@ -241,7 +329,13 @@ module Bundler
|
|
241
329
|
|
242
330
|
def app_config_path
|
243
331
|
if app_config = ENV["BUNDLE_APP_CONFIG"]
|
244
|
-
Pathname.new(app_config)
|
332
|
+
app_config_pathname = Pathname.new(app_config)
|
333
|
+
|
334
|
+
if app_config_pathname.absolute?
|
335
|
+
app_config_pathname
|
336
|
+
else
|
337
|
+
app_config_pathname.expand_path(root)
|
338
|
+
end
|
245
339
|
else
|
246
340
|
root.join(".bundle")
|
247
341
|
end
|
@@ -259,20 +353,12 @@ module Bundler
|
|
259
353
|
|
260
354
|
def rm_rf(path)
|
261
355
|
FileUtils.remove_entry_secure(path) if path && File.exist?(path)
|
262
|
-
rescue ArgumentError
|
263
|
-
message = <<EOF
|
264
|
-
It is a security vulnerability to allow your home directory to be world-writable, and bundler can not continue.
|
265
|
-
You should probably consider fixing this issue by running `chmod o-w ~` on *nix.
|
266
|
-
Please refer to http://ruby-doc.org/stdlib-2.1.2/libdoc/fileutils/rdoc/FileUtils.html#method-c-remove_entry_secure for details.
|
267
|
-
EOF
|
268
|
-
File.world_writable?(path) ? Bundler.ui.warn(message) : raise
|
269
|
-
raise PathError, "Please fix the world-writable issue with your #{path} directory"
|
270
356
|
end
|
271
357
|
|
272
358
|
def settings
|
273
359
|
@settings ||= Settings.new(app_config_path)
|
274
360
|
rescue GemfileNotFound
|
275
|
-
@settings = Settings.new
|
361
|
+
@settings = Settings.new
|
276
362
|
end
|
277
363
|
|
278
364
|
# @return [Hash] Environment present before Bundler was activated
|
@@ -280,45 +366,92 @@ EOF
|
|
280
366
|
ORIGINAL_ENV.clone
|
281
367
|
end
|
282
368
|
|
283
|
-
# @deprecated Use `
|
284
|
-
# @return [Hash] Environment with all bundler-related variables removed
|
369
|
+
# @deprecated Use `unbundled_env` instead
|
285
370
|
def clean_env
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
if env.key?("RUBYOPT")
|
296
|
-
env["RUBYOPT"] = env["RUBYOPT"].sub "-rbundler/setup", ""
|
297
|
-
end
|
371
|
+
message =
|
372
|
+
"`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
|
373
|
+
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
|
374
|
+
removed_message =
|
375
|
+
"`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \
|
376
|
+
"If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
|
377
|
+
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
|
378
|
+
unbundled_env
|
379
|
+
end
|
298
380
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
end
|
381
|
+
# @return [Hash] Environment with all bundler-related variables removed
|
382
|
+
def unbundled_env
|
383
|
+
unbundle_env(original_env)
|
384
|
+
end
|
304
385
|
|
305
|
-
|
386
|
+
# Remove all bundler-related variables from ENV
|
387
|
+
def unbundle_env!
|
388
|
+
ENV.replace(unbundle_env(ENV))
|
306
389
|
end
|
307
390
|
|
391
|
+
# Run block with environment present before Bundler was activated
|
308
392
|
def with_original_env
|
309
393
|
with_env(original_env) { yield }
|
310
394
|
end
|
311
395
|
|
396
|
+
# @deprecated Use `with_unbundled_env` instead
|
312
397
|
def with_clean_env
|
313
|
-
|
398
|
+
message =
|
399
|
+
"`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
|
400
|
+
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
|
401
|
+
removed_message =
|
402
|
+
"`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \
|
403
|
+
"If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
|
404
|
+
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
|
405
|
+
with_env(unbundled_env) { yield }
|
406
|
+
end
|
407
|
+
|
408
|
+
# Run block with all bundler-related variables removed
|
409
|
+
def with_unbundled_env
|
410
|
+
with_env(unbundled_env) { yield }
|
314
411
|
end
|
315
412
|
|
413
|
+
# Run subcommand with the environment present before Bundler was activated
|
414
|
+
def original_system(*args)
|
415
|
+
with_original_env { Kernel.system(*args) }
|
416
|
+
end
|
417
|
+
|
418
|
+
# @deprecated Use `unbundled_system` instead
|
316
419
|
def clean_system(*args)
|
317
|
-
|
420
|
+
message =
|
421
|
+
"`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
|
422
|
+
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
|
423
|
+
removed_message =
|
424
|
+
"`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \
|
425
|
+
"If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
|
426
|
+
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
|
427
|
+
with_env(unbundled_env) { Kernel.system(*args) }
|
428
|
+
end
|
429
|
+
|
430
|
+
# Run subcommand in an environment with all bundler related variables removed
|
431
|
+
def unbundled_system(*args)
|
432
|
+
with_unbundled_env { Kernel.system(*args) }
|
433
|
+
end
|
434
|
+
|
435
|
+
# Run a `Kernel.exec` to a subcommand with the environment present before Bundler was activated
|
436
|
+
def original_exec(*args)
|
437
|
+
with_original_env { Kernel.exec(*args) }
|
318
438
|
end
|
319
439
|
|
440
|
+
# @deprecated Use `unbundled_exec` instead
|
320
441
|
def clean_exec(*args)
|
321
|
-
|
442
|
+
message =
|
443
|
+
"`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
|
444
|
+
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
|
445
|
+
removed_message =
|
446
|
+
"`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \
|
447
|
+
"If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
|
448
|
+
Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
|
449
|
+
with_env(unbundled_env) { Kernel.exec(*args) }
|
450
|
+
end
|
451
|
+
|
452
|
+
# Run a `Kernel.exec` to a subcommand in an environment with all bundler related variables removed
|
453
|
+
def unbundled_exec(*args)
|
454
|
+
with_env(unbundled_env) { Kernel.exec(*args) }
|
322
455
|
end
|
323
456
|
|
324
457
|
def local_platform
|
@@ -343,87 +476,44 @@ EOF
|
|
343
476
|
# system binaries. If you put '-n foo' in your .gemrc, RubyGems will
|
344
477
|
# install binstubs there instead. Unfortunately, RubyGems doesn't expose
|
345
478
|
# that directory at all, so rather than parse .gemrc ourselves, we allow
|
346
|
-
# the directory to be set as well, via `bundle config bindir foo`.
|
479
|
+
# the directory to be set as well, via `bundle config set --local bindir foo`.
|
347
480
|
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
|
348
481
|
end
|
349
482
|
|
350
|
-
def
|
351
|
-
|
483
|
+
def preferred_gemfile_name
|
484
|
+
Bundler.settings[:init_gems_rb] ? "gems.rb" : "Gemfile"
|
352
485
|
end
|
353
486
|
|
354
|
-
def
|
355
|
-
|
356
|
-
|
357
|
-
sudo_present = which "sudo" if settings.allow_sudo?
|
358
|
-
|
359
|
-
if sudo_present
|
360
|
-
# the bundle path and subdirectories need to be writable for RubyGems
|
361
|
-
# to be able to unpack and install gems without exploding
|
362
|
-
path = bundle_path
|
363
|
-
path = path.parent until path.exist?
|
364
|
-
|
365
|
-
# bins are written to a different location on OS X
|
366
|
-
bin_dir = Pathname.new(Bundler.system_bindir)
|
367
|
-
bin_dir = bin_dir.parent until bin_dir.exist?
|
368
|
-
|
369
|
-
# if any directory is not writable, we need sudo
|
370
|
-
files = [path, bin_dir] | Dir[bundle_path.join("build_info/*").to_s] | Dir[bundle_path.join("*").to_s]
|
371
|
-
unwritable_files = files.reject {|f| File.writable?(f) }
|
372
|
-
sudo_needed = !unwritable_files.empty?
|
373
|
-
if sudo_needed
|
374
|
-
Bundler.ui.warn "Following files may not be writable, so sudo is needed:\n #{unwritable_files.map(&:to_s).sort.join("\n ")}"
|
375
|
-
end
|
376
|
-
end
|
377
|
-
|
378
|
-
@requires_sudo_ran = true
|
379
|
-
@requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
|
487
|
+
def use_system_gems?
|
488
|
+
configured_bundle_path.use_system_gems?
|
380
489
|
end
|
381
490
|
|
382
|
-
def mkdir_p(path
|
383
|
-
|
384
|
-
|
385
|
-
else
|
386
|
-
SharedHelpers.filesystem_access(path, :write) do |p|
|
387
|
-
FileUtils.mkdir_p(p)
|
388
|
-
end
|
491
|
+
def mkdir_p(path)
|
492
|
+
SharedHelpers.filesystem_access(path, :create) do |p|
|
493
|
+
FileUtils.mkdir_p(p)
|
389
494
|
end
|
390
495
|
end
|
391
496
|
|
392
497
|
def which(executable)
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
498
|
+
executable_path = find_executable(executable)
|
499
|
+
return executable_path if executable_path
|
500
|
+
|
501
|
+
if (paths = ENV["PATH"])
|
502
|
+
quote = '"'
|
397
503
|
paths.split(File::PATH_SEPARATOR).find do |path|
|
398
504
|
path = path[1..-2] if path.start_with?(quote) && path.end_with?(quote)
|
399
|
-
executable_path = File.expand_path(executable, path)
|
400
|
-
return executable_path if
|
505
|
+
executable_path = find_executable(File.expand_path(executable, path))
|
506
|
+
return executable_path if executable_path
|
401
507
|
end
|
402
508
|
end
|
403
509
|
end
|
404
510
|
|
405
|
-
def
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
You can cancel this installation and run:
|
410
|
-
|
411
|
-
bundle install --path vendor/bundle
|
412
|
-
|
413
|
-
to install the gems into ./vendor/bundle/, or you can enter your password
|
414
|
-
and install the bundled gems to RubyGems using sudo.
|
415
|
-
|
416
|
-
Password:
|
417
|
-
PROMPT
|
418
|
-
|
419
|
-
unless @prompted_for_sudo ||= system(%(sudo -k -p "#{prompt}" true))
|
420
|
-
raise SudoNotPermittedError,
|
421
|
-
"Bundler requires sudo access to install at the moment. " \
|
422
|
-
"Try installing again, granting Bundler sudo access when prompted, or installing into a different path."
|
423
|
-
end
|
511
|
+
def find_executable(path)
|
512
|
+
extensions = RbConfig::CONFIG["EXECUTABLE_EXTS"]&.split
|
513
|
+
extensions = [RbConfig::CONFIG["EXEEXT"]] unless extensions&.any?
|
514
|
+
candidates = extensions.map {|ext| "#{path}#{ext}" }
|
424
515
|
|
425
|
-
|
426
|
-
end
|
516
|
+
candidates.find {|candidate| File.file?(candidate) && File.executable?(candidate) }
|
427
517
|
end
|
428
518
|
|
429
519
|
def read_file(file)
|
@@ -432,10 +522,17 @@ EOF
|
|
432
522
|
end
|
433
523
|
end
|
434
524
|
|
435
|
-
def
|
436
|
-
|
437
|
-
|
438
|
-
|
525
|
+
def safe_load_marshal(data)
|
526
|
+
if Gem.respond_to?(:load_safe_marshal)
|
527
|
+
Gem.load_safe_marshal
|
528
|
+
begin
|
529
|
+
Gem::SafeMarshal.safe_load(data)
|
530
|
+
rescue Gem::SafeMarshal::Reader::Error, Gem::SafeMarshal::Visitors::ToRuby::Error => e
|
531
|
+
raise MarshalError, "#{e.class}: #{e.message}"
|
532
|
+
end
|
533
|
+
else
|
534
|
+
load_marshal(data, marshal_proc: SafeMarshal.proc)
|
535
|
+
end
|
439
536
|
end
|
440
537
|
|
441
538
|
def load_gemspec(file, validate = false)
|
@@ -444,21 +541,13 @@ EOF
|
|
444
541
|
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
|
445
542
|
# Protect against caching side-effected gemspecs by returning a
|
446
543
|
# new instance each time.
|
447
|
-
@gemspec_cache[key]
|
544
|
+
@gemspec_cache[key]&.dup
|
448
545
|
end
|
449
546
|
|
450
547
|
def load_gemspec_uncached(file, validate = false)
|
451
548
|
path = Pathname.new(file)
|
452
549
|
contents = read_file(file)
|
453
|
-
spec =
|
454
|
-
eval_yaml_gemspec(path, contents)
|
455
|
-
else
|
456
|
-
# Eval the gemspec from its parent directory, because some gemspecs
|
457
|
-
# depend on "./" relative paths.
|
458
|
-
SharedHelpers.chdir(path.dirname.to_s) do
|
459
|
-
eval_gemspec(path, contents)
|
460
|
-
end
|
461
|
-
end
|
550
|
+
spec = eval_gemspec(path, contents)
|
462
551
|
return unless spec
|
463
552
|
spec.loaded_from = path.expand_path.to_s
|
464
553
|
Bundler.rubygems.validate(spec) if validate
|
@@ -471,7 +560,7 @@ EOF
|
|
471
560
|
|
472
561
|
def git_present?
|
473
562
|
return @git_present if defined?(@git_present)
|
474
|
-
@git_present = Bundler.which("git")
|
563
|
+
@git_present = Bundler.which("git")
|
475
564
|
end
|
476
565
|
|
477
566
|
def feature_flag
|
@@ -484,11 +573,16 @@ EOF
|
|
484
573
|
reset_rubygems!
|
485
574
|
end
|
486
575
|
|
576
|
+
def reset_settings_and_root!
|
577
|
+
@settings = nil
|
578
|
+
@root = nil
|
579
|
+
end
|
580
|
+
|
487
581
|
def reset_paths!
|
488
582
|
@bin_path = nil
|
489
583
|
@bundler_major_version = nil
|
490
584
|
@bundle_path = nil
|
491
|
-
@
|
585
|
+
@configure = nil
|
492
586
|
@configured_bundle_path = nil
|
493
587
|
@definition = nil
|
494
588
|
@load = nil
|
@@ -506,53 +600,93 @@ EOF
|
|
506
600
|
@rubygems = nil
|
507
601
|
end
|
508
602
|
|
509
|
-
|
603
|
+
def configure_gem_home_and_path(path = bundle_path)
|
604
|
+
configure_gem_path
|
605
|
+
configure_gem_home(path)
|
606
|
+
Bundler.rubygems.clear_paths
|
607
|
+
end
|
608
|
+
|
609
|
+
def self_manager
|
610
|
+
@self_manager ||= begin
|
611
|
+
require_relative "bundler/self_manager"
|
612
|
+
Bundler::SelfManager.new
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
private
|
617
|
+
|
618
|
+
def unbundle_env(env)
|
619
|
+
if env.key?("BUNDLER_ORIG_MANPATH")
|
620
|
+
env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
|
621
|
+
end
|
622
|
+
|
623
|
+
env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
|
624
|
+
env.delete("BUNDLER_SETUP")
|
625
|
+
|
626
|
+
if env.key?("RUBYOPT")
|
627
|
+
rubyopt = env["RUBYOPT"].split(" ")
|
628
|
+
rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}")
|
629
|
+
rubyopt.delete("-rbundler/setup")
|
630
|
+
env["RUBYOPT"] = rubyopt.join(" ")
|
631
|
+
end
|
632
|
+
|
633
|
+
if env.key?("RUBYLIB")
|
634
|
+
rubylib = env["RUBYLIB"].split(File::PATH_SEPARATOR)
|
635
|
+
rubylib.delete(__dir__)
|
636
|
+
env["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
|
637
|
+
end
|
638
|
+
|
639
|
+
env
|
640
|
+
end
|
641
|
+
|
642
|
+
def load_marshal(data, marshal_proc: nil)
|
643
|
+
Marshal.load(data, marshal_proc)
|
644
|
+
rescue TypeError => e
|
645
|
+
raise MarshalError, "#{e.class}: #{e.message}"
|
646
|
+
end
|
510
647
|
|
511
648
|
def eval_yaml_gemspec(path, contents)
|
512
|
-
Kernel.
|
649
|
+
Kernel.require "psych"
|
513
650
|
|
514
|
-
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
|
515
|
-
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
|
516
651
|
Gem::Specification.from_yaml(contents)
|
517
|
-
rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
518
|
-
eval_gemspec(path, contents)
|
519
652
|
end
|
520
653
|
|
521
654
|
def eval_gemspec(path, contents)
|
522
|
-
|
655
|
+
if contents.start_with?("---") # YAML header
|
656
|
+
eval_yaml_gemspec(path, contents)
|
657
|
+
else
|
658
|
+
# Eval the gemspec from its parent directory, because some gemspecs
|
659
|
+
# depend on "./" relative paths.
|
660
|
+
SharedHelpers.chdir(path.dirname.to_s) do
|
661
|
+
eval(contents, TOPLEVEL_BINDING.dup, path.expand_path.to_s)
|
662
|
+
end
|
663
|
+
end
|
523
664
|
rescue ScriptError, StandardError => e
|
524
665
|
msg = "There was an error while loading `#{path.basename}`: #{e.message}"
|
525
666
|
|
526
|
-
|
527
|
-
msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
|
528
|
-
end
|
529
|
-
|
530
|
-
raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
|
667
|
+
raise GemspecError, Dsl::DSLError.new(msg, path.to_s, e.backtrace, contents)
|
531
668
|
end
|
532
669
|
|
533
|
-
def
|
534
|
-
|
535
|
-
configure_gem_home
|
536
|
-
bundle_path
|
537
|
-
end
|
538
|
-
|
539
|
-
def configure_gem_path(env = ENV)
|
540
|
-
blank_home = env["GEM_HOME"].nil? || env["GEM_HOME"].empty?
|
541
|
-
if !use_system_gems?
|
670
|
+
def configure_gem_path
|
671
|
+
unless use_system_gems?
|
542
672
|
# this needs to be empty string to cause
|
543
673
|
# PathSupport.split_gem_path to only load up the
|
544
674
|
# Bundler --path setting as the GEM_PATH.
|
545
|
-
|
546
|
-
elsif blank_home
|
547
|
-
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
|
548
|
-
paths = possibles.flatten.compact.uniq.reject(&:empty?)
|
549
|
-
env["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
675
|
+
Bundler::SharedHelpers.set_env "GEM_PATH", ""
|
550
676
|
end
|
551
677
|
end
|
552
678
|
|
553
|
-
def configure_gem_home
|
554
|
-
Bundler::SharedHelpers.set_env "GEM_HOME",
|
555
|
-
|
679
|
+
def configure_gem_home(path)
|
680
|
+
Bundler::SharedHelpers.set_env "GEM_HOME", path.to_s
|
681
|
+
end
|
682
|
+
|
683
|
+
def tmp_home_path
|
684
|
+
Kernel.send(:require, "tmpdir")
|
685
|
+
SharedHelpers.filesystem_access(Dir.tmpdir) do
|
686
|
+
path = Bundler.tmp
|
687
|
+
at_exit { Bundler.rm_rf(path) }
|
688
|
+
path
|
689
|
+
end
|
556
690
|
end
|
557
691
|
|
558
692
|
# @param env [Hash]
|