bundler 2.1.4 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2468 -1430
- data/README.md +8 -10
- data/bundler.gemspec +10 -13
- data/exe/bundle +7 -8
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +3 -11
- data/lib/bundler/cli/add.rb +2 -2
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/cache.rb +3 -8
- data/lib/bundler/cli/check.rb +5 -3
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +32 -3
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/console.rb +3 -3
- data/lib/bundler/cli/doctor.rb +23 -6
- data/lib/bundler/cli/exec.rb +5 -10
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +258 -45
- data/lib/bundler/cli/info.rb +38 -6
- data/lib/bundler/cli/init.rb +7 -3
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +27 -57
- data/lib/bundler/cli/issue.rb +5 -4
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +11 -4
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/outdated.rb +106 -79
- data/lib/bundler/cli/platform.rb +2 -2
- data/lib/bundler/cli/plugin.rb +10 -0
- data/lib/bundler/cli/pristine.rb +5 -0
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +20 -9
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +149 -85
- data/lib/bundler/compact_index_client/cache.rb +7 -24
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +56 -51
- data/lib/bundler/compact_index_client.rb +3 -9
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +17 -6
- data/lib/bundler/definition.rb +343 -440
- data/lib/bundler/dependency.rb +23 -77
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +77 -85
- data/lib/bundler/endpoint_specification.rb +20 -14
- data/lib/bundler/env.rb +3 -3
- data/lib/bundler/environment_preserver.rb +30 -2
- data/lib/bundler/errors.rb +31 -14
- data/lib/bundler/feature_flag.rb +0 -9
- data/lib/bundler/fetcher/base.rb +7 -9
- data/lib/bundler/fetcher/compact_index.rb +20 -27
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +11 -11
- data/lib/bundler/fetcher/index.rb +2 -30
- data/lib/bundler/fetcher.rb +24 -29
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +45 -49
- data/lib/bundler/gem_helper.rb +53 -31
- data/lib/bundler/gem_helpers.rb +42 -24
- data/lib/bundler/gem_version_promoter.rb +54 -99
- data/lib/bundler/graph.rb +4 -4
- data/lib/bundler/index.rb +14 -52
- data/lib/bundler/injector.rb +40 -8
- data/lib/bundler/inline.rb +6 -15
- data/lib/bundler/installer/gem_installer.rb +19 -24
- data/lib/bundler/installer/parallel_installer.rb +32 -42
- data/lib/bundler/installer/standalone.rb +58 -11
- data/lib/bundler/installer.rb +47 -87
- data/lib/bundler/lazy_specification.rb +76 -35
- data/lib/bundler/lockfile_generator.rb +3 -3
- data/lib/bundler/lockfile_parser.rb +24 -49
- data/lib/bundler/man/.document +1 -0
- data/{man → lib/bundler/man}/bundle-add.1 +21 -5
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +16 -4
- data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
- data/{man → lib/bundler/man}/bundle-cache.1 +7 -1
- data/{man/bundle-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +7 -0
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +2 -2
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +65 -47
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +74 -65
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- 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/lib/bundler/man/bundle-gem.1 +105 -0
- data/lib/bundler/man/bundle-gem.1.ronn +117 -0
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +5 -2
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +3 -1
- data/{man → lib/bundler/man}/bundle-install.1 +35 -33
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +33 -34
- 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 → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man → lib/bundler/man}/bundle-outdated.1 +3 -10
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +1 -10
- data/{man → lib/bundler/man}/bundle-platform.1 +16 -6
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +14 -7
- data/lib/bundler/man/bundle-plugin.1 +81 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man → lib/bundler/man}/bundle-update.1 +5 -5
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +5 -4
- data/lib/bundler/man/bundle-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/{man → lib/bundler/man}/bundle-viz.1 +4 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +2 -0
- data/{man → lib/bundler/man}/bundle.1 +15 -10
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +12 -7
- data/{man → lib/bundler/man}/gemfile.5 +120 -83
- data/{man → lib/bundler/man}/gemfile.5.ronn +109 -88
- data/{man → lib/bundler/man}/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +13 -0
- data/lib/bundler/match_platform.rb +0 -1
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +7 -9
- data/lib/bundler/plugin/api/source.rb +25 -9
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +17 -5
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -9
- data/lib/bundler/plugin/installer.rb +11 -11
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +58 -11
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +15 -6
- data/lib/bundler/resolver/base.rb +46 -0
- data/lib/bundler/resolver/candidate.rb +92 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +63 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +49 -74
- data/lib/bundler/resolver.rb +320 -344
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +6 -19
- data/lib/bundler/rubygems_ext.rb +231 -32
- data/lib/bundler/rubygems_gem_installer.rb +89 -16
- data/lib/bundler/rubygems_integration.rb +72 -162
- data/lib/bundler/runtime.rb +23 -31
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +145 -72
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +19 -34
- data/lib/bundler/similarity_detector.rb +1 -1
- data/lib/bundler/source/git/git_proxy.rb +244 -114
- data/lib/bundler/source/git.rb +62 -46
- data/lib/bundler/source/metadata.rb +3 -8
- data/lib/bundler/source/path/installer.rb +11 -32
- data/lib/bundler/source/path.rb +15 -9
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/source/rubygems.rb +167 -199
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +25 -5
- data/lib/bundler/source_list.rb +112 -64
- data/lib/bundler/source_map.rb +71 -0
- data/lib/bundler/spec_set.rb +64 -61
- data/lib/bundler/stub_specification.rb +30 -10
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +10 -15
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- 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/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +15 -1
- data/lib/bundler/templates/newgem/README.md.tt +13 -16
- data/lib/bundler/templates/newgem/Rakefile.tt +33 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- 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.rb.tt → extconf-c.rb.tt} +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- 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 +34 -18
- 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 +3 -0
- data/lib/bundler/templates/newgem/test/{test_helper.rb.tt → minitest/test_helper.rb.tt} +2 -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/shell.rb +37 -14
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/uri_credentials_filter.rb +3 -1
- 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 +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +41 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +82 -189
- 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 +151 -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 +53 -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 +124 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +409 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +240 -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/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +9 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/base.rb +9 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +10 -5
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +28 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +28 -7
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +5 -13
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +452 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +76 -91
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +32 -13
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +14 -21
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +11 -17
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- 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 +3 -3
- data/lib/bundler/vendored_persistent.rb +1 -40
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/worker.rb +25 -12
- data/lib/bundler/yaml_serializer.rb +1 -1
- data/lib/bundler.rb +95 -108
- metadata +132 -118
- data/lib/bundler/dep_proxy.rb +0 -48
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -37
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- 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 -158
- 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/version_ranges.rb +0 -122
- data/man/bundle-add.1.txt +0 -58
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-cache.1.txt +0 -78
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -528
- 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.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 -401
- 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-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 -390
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -116
- data/man/gemfile.5.txt +0 -649
- /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- /data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +0 -0
- /data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- /data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- /data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- /data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- /data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
@@ -13,13 +13,13 @@ module Bundler
|
|
13
13
|
def root
|
14
14
|
gemfile = find_gemfile
|
15
15
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
16
|
-
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
16
|
+
Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_gemfile
|
20
20
|
gemfile = find_gemfile
|
21
21
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
22
|
-
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
22
|
+
Pathname.new(gemfile).tap {|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
23
23
|
end
|
24
24
|
|
25
25
|
def default_lockfile
|
@@ -28,7 +28,7 @@ module Bundler
|
|
28
28
|
case gemfile.basename.to_s
|
29
29
|
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
|
30
30
|
else Pathname.new("#{gemfile}.lock")
|
31
|
-
end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
31
|
+
end.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
32
32
|
end
|
33
33
|
|
34
34
|
def default_bundle_dir
|
@@ -100,7 +100,7 @@ module Bundler
|
|
100
100
|
#
|
101
101
|
# @see {Bundler::PermissionError}
|
102
102
|
def filesystem_access(path, action = :write, &block)
|
103
|
-
yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
|
103
|
+
yield(path.dup.tap {|x| x.untaint if RUBY_VERSION < "2.7" })
|
104
104
|
rescue Errno::EACCES
|
105
105
|
raise PermissionError.new(path, action)
|
106
106
|
rescue Errno::EAGAIN
|
@@ -109,7 +109,7 @@ module Bundler
|
|
109
109
|
raise VirtualProtocolError.new
|
110
110
|
rescue Errno::ENOSPC
|
111
111
|
raise NoSpaceOnDeviceError.new(path, action)
|
112
|
-
rescue
|
112
|
+
rescue Errno::ENOTSUP
|
113
113
|
raise OperationNotSupportedError.new(path, action)
|
114
114
|
rescue Errno::EEXIST, Errno::ENOENT
|
115
115
|
raise
|
@@ -117,13 +117,6 @@ module Bundler
|
|
117
117
|
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
|
118
118
|
end
|
119
119
|
|
120
|
-
def const_get_safely(constant_name, namespace)
|
121
|
-
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
|
122
|
-
namespace.constants.include?(constant_name.to_sym)
|
123
|
-
return nil unless const_in_namespace
|
124
|
-
namespace.const_get(constant_name)
|
125
|
-
end
|
126
|
-
|
127
120
|
def major_deprecation(major_version, message, print_caller_location: false)
|
128
121
|
if print_caller_location
|
129
122
|
caller_location = caller_locations(2, 2).first
|
@@ -148,17 +141,10 @@ module Bundler
|
|
148
141
|
end
|
149
142
|
return unless multiple_gemfiles
|
150
143
|
message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
|
151
|
-
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.
|
144
|
+
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked."
|
152
145
|
Bundler.ui.warn message
|
153
146
|
end
|
154
147
|
|
155
|
-
def trap(signal, override = false, &block)
|
156
|
-
prior = Signal.trap(signal) do
|
157
|
-
block.call
|
158
|
-
prior.call unless override
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
148
|
def ensure_same_dependencies(spec, old_deps, new_deps)
|
163
149
|
new_deps = new_deps.reject {|d| d.type == :development }
|
164
150
|
old_deps = old_deps.reject {|d| d.type == :development }
|
@@ -177,7 +163,7 @@ module Bundler
|
|
177
163
|
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
|
178
164
|
end
|
179
165
|
|
180
|
-
def pretty_dependency(dep
|
166
|
+
def pretty_dependency(dep)
|
181
167
|
msg = String.new(dep.name)
|
182
168
|
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
183
169
|
|
@@ -186,7 +172,6 @@ module Bundler
|
|
186
172
|
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
|
187
173
|
end
|
188
174
|
|
189
|
-
msg << " from the `#{dep.source}` source" if print_source && dep.source
|
190
175
|
msg
|
191
176
|
end
|
192
177
|
|
@@ -194,11 +179,11 @@ module Bundler
|
|
194
179
|
return @md5_available if defined?(@md5_available)
|
195
180
|
@md5_available = begin
|
196
181
|
require "openssl"
|
197
|
-
OpenSSL::Digest
|
182
|
+
::OpenSSL::Digest.digest("MD5", "")
|
198
183
|
true
|
199
184
|
rescue LoadError
|
200
185
|
true
|
201
|
-
rescue OpenSSL::Digest::DigestError
|
186
|
+
rescue ::OpenSSL::Digest::DigestError
|
202
187
|
false
|
203
188
|
end
|
204
189
|
end
|
@@ -212,7 +197,7 @@ module Bundler
|
|
212
197
|
filesystem_access(gemfile_path) {|g| File.open(g, "w") {|file| file.puts contents } }
|
213
198
|
end
|
214
199
|
|
215
|
-
|
200
|
+
private
|
216
201
|
|
217
202
|
def validate_bundle_path
|
218
203
|
path_separator = Bundler.rubygems.path_separator
|
@@ -250,10 +235,10 @@ module Bundler
|
|
250
235
|
|
251
236
|
def search_up(*names)
|
252
237
|
previous = nil
|
253
|
-
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
238
|
+
current = File.expand_path(SharedHelpers.pwd).tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
254
239
|
|
255
240
|
until !File.directory?(current) || current == previous
|
256
|
-
if ENV["
|
241
|
+
if ENV["BUNDLER_SPEC_RUN"]
|
257
242
|
# avoid stepping above the tmp directory when testing
|
258
243
|
gemspec = if ENV["GEM_COMMAND"]
|
259
244
|
# for Ruby Core
|
@@ -288,10 +273,10 @@ module Bundler
|
|
288
273
|
|
289
274
|
def set_bundle_variables
|
290
275
|
# bundler exe & lib folders have same root folder, typical gem installation
|
291
|
-
exe_file = File.expand_path("
|
276
|
+
exe_file = File.expand_path("../../exe/bundle", __dir__)
|
292
277
|
|
293
278
|
# for Ruby core repository testing
|
294
|
-
exe_file = File.expand_path("
|
279
|
+
exe_file = File.expand_path("../../libexec/bundle", __dir__) unless File.exist?(exe_file)
|
295
280
|
|
296
281
|
# bundler is a default gem, exe path is separate
|
297
282
|
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
|
@@ -299,6 +284,7 @@ module Bundler
|
|
299
284
|
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
300
285
|
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
|
301
286
|
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
287
|
+
Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__)
|
302
288
|
end
|
303
289
|
|
304
290
|
def set_path
|
@@ -323,16 +309,15 @@ module Bundler
|
|
323
309
|
end
|
324
310
|
|
325
311
|
def bundler_ruby_lib
|
326
|
-
|
312
|
+
File.expand_path("..", __dir__)
|
327
313
|
end
|
328
314
|
|
329
315
|
def clean_load_path
|
330
|
-
bundler_lib = bundler_ruby_lib
|
331
|
-
|
332
316
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
333
317
|
|
334
318
|
$LOAD_PATH.reject! do |p|
|
335
|
-
|
319
|
+
resolved_path = resolve_path(p)
|
320
|
+
next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
|
336
321
|
loaded_gem_paths.delete(p)
|
337
322
|
end
|
338
323
|
$LOAD_PATH.uniq!
|
@@ -340,7 +325,7 @@ module Bundler
|
|
340
325
|
|
341
326
|
def resolve_path(path)
|
342
327
|
expanded = File.expand_path(path)
|
343
|
-
return expanded unless File.
|
328
|
+
return expanded unless File.exist?(expanded)
|
344
329
|
|
345
330
|
File.realpath(expanded)
|
346
331
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "shellwords"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class Source
|
7
5
|
class Git
|
@@ -17,8 +15,8 @@ module Bundler
|
|
17
15
|
class GitNotAllowedError < GitError
|
18
16
|
def initialize(command)
|
19
17
|
msg = String.new
|
20
|
-
msg << "Bundler is trying to run
|
21
|
-
msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/
|
18
|
+
msg << "Bundler is trying to run `#{command}` at runtime. You probably need to run `bundle install`. However, "
|
19
|
+
msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md "
|
22
20
|
msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
|
23
21
|
super msg
|
24
22
|
end
|
@@ -27,21 +25,20 @@ module Bundler
|
|
27
25
|
class GitCommandError < GitError
|
28
26
|
attr_reader :command
|
29
27
|
|
30
|
-
def initialize(command, path
|
28
|
+
def initialize(command, path, extra_info = nil)
|
31
29
|
@command = command
|
32
30
|
|
33
31
|
msg = String.new
|
34
|
-
msg << "Git error: command
|
32
|
+
msg << "Git error: command `#{command}` in directory #{path} has failed."
|
35
33
|
msg << "\n#{extra_info}" if extra_info
|
36
|
-
msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist?
|
37
34
|
super msg
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
41
38
|
class MissingGitRevisionError < GitCommandError
|
42
|
-
def initialize(command,
|
39
|
+
def initialize(command, destination_path, ref, repo)
|
43
40
|
msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
|
44
|
-
super command,
|
41
|
+
super command, destination_path, msg
|
45
42
|
end
|
46
43
|
end
|
47
44
|
|
@@ -49,72 +46,59 @@ module Bundler
|
|
49
46
|
# All actions required by the Git source is encapsulated in this
|
50
47
|
# object.
|
51
48
|
class GitProxy
|
52
|
-
attr_accessor :path, :uri, :ref
|
49
|
+
attr_accessor :path, :uri, :branch, :tag, :ref, :explicit_ref
|
53
50
|
attr_writer :revision
|
54
51
|
|
55
|
-
def initialize(path, uri,
|
52
|
+
def initialize(path, uri, options = {}, revision = nil, git = nil)
|
56
53
|
@path = path
|
57
54
|
@uri = uri
|
58
|
-
@
|
55
|
+
@branch = options["branch"]
|
56
|
+
@tag = options["tag"]
|
57
|
+
@ref = options["ref"]
|
58
|
+
@explicit_ref = branch || tag || ref
|
59
59
|
@revision = revision
|
60
60
|
@git = git
|
61
|
-
|
61
|
+
@commit_ref = nil
|
62
62
|
end
|
63
63
|
|
64
64
|
def revision
|
65
|
-
|
66
|
-
|
67
|
-
begin
|
68
|
-
@revision ||= find_local_revision
|
69
|
-
rescue GitCommandError => e
|
70
|
-
raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
|
71
|
-
end
|
72
|
-
|
73
|
-
@revision
|
65
|
+
@revision ||= allowed_with_path { find_local_revision }
|
74
66
|
end
|
75
67
|
|
76
|
-
def
|
77
|
-
@
|
78
|
-
git("rev-parse --abbrev-ref HEAD").strip
|
68
|
+
def current_branch
|
69
|
+
@current_branch ||= allowed_with_path do
|
70
|
+
git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
|
79
71
|
end
|
80
72
|
end
|
81
73
|
|
82
74
|
def contains?(commit)
|
83
|
-
|
84
|
-
result, status = git_null("branch --contains
|
75
|
+
allowed_with_path do
|
76
|
+
result, status = git_null("branch", "--contains", commit, :dir => path)
|
85
77
|
status.success? && result =~ /^\* (.*)$/
|
86
78
|
end
|
87
79
|
end
|
88
80
|
|
89
81
|
def version
|
90
|
-
|
82
|
+
@version ||= full_version.match(/((\.?\d+)+).*/)[1]
|
91
83
|
end
|
92
84
|
|
93
85
|
def full_version
|
94
|
-
git("--version").sub(
|
86
|
+
@full_version ||= git("--version").sub(/git version\s*/, "").strip
|
95
87
|
end
|
96
88
|
|
97
89
|
def checkout
|
98
|
-
return if
|
99
|
-
extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
|
90
|
+
return if has_revision_cached?
|
100
91
|
|
101
|
-
Bundler.ui.info "Fetching #{
|
92
|
+
Bundler.ui.info "Fetching #{credential_filtered_uri}"
|
102
93
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
|
108
|
-
return unless extra_ref
|
109
|
-
end
|
94
|
+
extra_fetch_needed = clone_needs_extra_fetch?
|
95
|
+
unshallow_needed = clone_needs_unshallow?
|
96
|
+
return unless extra_fetch_needed || unshallow_needed
|
110
97
|
|
111
|
-
|
112
|
-
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
|
113
|
-
end
|
98
|
+
git_remote_fetch(unshallow_needed ? ["--unshallow"] : depth_args)
|
114
99
|
end
|
115
100
|
|
116
101
|
def copy_to(destination, submodules = false)
|
117
|
-
# method 1
|
118
102
|
unless File.exist?(destination.join(".git"))
|
119
103
|
begin
|
120
104
|
SharedHelpers.filesystem_access(destination.dirname) do |p|
|
@@ -123,135 +107,281 @@ module Bundler
|
|
123
107
|
SharedHelpers.filesystem_access(destination) do |p|
|
124
108
|
FileUtils.rm_rf(p)
|
125
109
|
end
|
126
|
-
|
110
|
+
git "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
|
127
111
|
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
|
128
112
|
rescue Errno::EEXIST => e
|
129
|
-
file_path = e.message[%r{.*?(
|
113
|
+
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
|
130
114
|
raise GitError, "Bundler could not install a gem because it needs to " \
|
131
115
|
"create a directory, but a file exists - #{file_path}. Please delete " \
|
132
116
|
"this file and try again."
|
133
117
|
end
|
134
118
|
end
|
135
|
-
# method 2
|
136
|
-
SharedHelpers.chdir(destination) do
|
137
|
-
git_retry %(fetch --force --quiet --tags "#{path}")
|
138
119
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
120
|
+
git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref
|
121
|
+
|
122
|
+
git "reset", "--hard", @revision, :dir => destination
|
123
|
+
|
124
|
+
if submodules
|
125
|
+
git_retry "submodule", "update", "--init", "--recursive", :dir => destination
|
126
|
+
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
|
127
|
+
inner_command = "git -C $toplevel submodule deinit --force $sm_path"
|
128
|
+
git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
144
133
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
134
|
+
def git_remote_fetch(args)
|
135
|
+
command = ["fetch", "--force", "--quiet", "--no-tags", *args, "--", configured_uri, refspec].compact
|
136
|
+
command_with_no_credentials = check_allowed(command)
|
137
|
+
|
138
|
+
Bundler::Retry.new("`#{command_with_no_credentials}` at #{path}", [MissingGitRevisionError]).attempts do
|
139
|
+
out, err, status = capture(command, path)
|
140
|
+
return out if status.success?
|
141
|
+
|
142
|
+
if err.include?("couldn't find remote ref")
|
143
|
+
raise MissingGitRevisionError.new(command_with_no_credentials, path, explicit_ref, credential_filtered_uri)
|
144
|
+
else
|
145
|
+
raise GitCommandError.new(command_with_no_credentials, path, err)
|
149
146
|
end
|
150
147
|
end
|
151
148
|
end
|
152
149
|
|
153
|
-
|
150
|
+
def clone_needs_extra_fetch?
|
151
|
+
return true if path.exist?
|
154
152
|
|
155
|
-
|
156
|
-
|
157
|
-
|
153
|
+
SharedHelpers.filesystem_access(path.dirname) do |p|
|
154
|
+
FileUtils.mkdir_p(p)
|
155
|
+
end
|
156
|
+
git_retry "clone", "--bare", "--no-hardlinks", "--quiet", *extra_clone_args, "--", configured_uri, path.to_s
|
157
|
+
|
158
|
+
extra_ref
|
159
|
+
end
|
158
160
|
|
159
|
-
|
160
|
-
|
161
|
+
def clone_needs_unshallow?
|
162
|
+
return false unless path.join("shallow").exist?
|
163
|
+
return true if full_clone?
|
164
|
+
|
165
|
+
@revision && @revision != head_revision
|
166
|
+
end
|
167
|
+
|
168
|
+
def extra_ref
|
169
|
+
return false if not_pinned?
|
170
|
+
return true unless full_clone?
|
171
|
+
|
172
|
+
ref.start_with?("refs/")
|
173
|
+
end
|
174
|
+
|
175
|
+
def depth
|
176
|
+
return @depth if defined?(@depth)
|
177
|
+
|
178
|
+
@depth = if !supports_fetching_unreachable_refs?
|
179
|
+
nil
|
180
|
+
elsif not_pinned? || pinned_to_full_sha?
|
181
|
+
1
|
182
|
+
elsif ref.include?("~")
|
183
|
+
parsed_depth = ref.split("~").last
|
184
|
+
parsed_depth.to_i + 1
|
161
185
|
end
|
186
|
+
end
|
162
187
|
|
163
|
-
|
188
|
+
def refspec
|
189
|
+
commit = pinned_to_full_sha? ? ref : @revision
|
190
|
+
|
191
|
+
if commit
|
192
|
+
@commit_ref = "refs/#{commit}-sha"
|
193
|
+
return "#{commit}:#{@commit_ref}"
|
194
|
+
end
|
195
|
+
|
196
|
+
reference = fully_qualified_ref
|
197
|
+
|
198
|
+
reference ||= if ref.include?("~")
|
199
|
+
ref.split("~").first
|
200
|
+
elsif ref.start_with?("refs/")
|
201
|
+
ref
|
202
|
+
else
|
203
|
+
"refs/*"
|
204
|
+
end
|
205
|
+
|
206
|
+
"#{reference}:#{reference}"
|
164
207
|
end
|
165
208
|
|
166
|
-
def
|
167
|
-
|
168
|
-
|
209
|
+
def fully_qualified_ref
|
210
|
+
if branch
|
211
|
+
"refs/heads/#{branch}"
|
212
|
+
elsif tag
|
213
|
+
"refs/tags/#{tag}"
|
214
|
+
elsif ref.nil?
|
215
|
+
"refs/heads/#{current_branch}"
|
169
216
|
end
|
170
217
|
end
|
171
218
|
|
172
|
-
def
|
173
|
-
|
174
|
-
|
219
|
+
def not_pinned?
|
220
|
+
branch || tag || ref.nil?
|
221
|
+
end
|
222
|
+
|
223
|
+
def pinned_to_full_sha?
|
224
|
+
ref =~ /\A\h{40}\z/
|
225
|
+
end
|
226
|
+
|
227
|
+
def git_null(*command, dir: nil)
|
228
|
+
check_allowed(command)
|
229
|
+
|
230
|
+
capture(command, dir, :ignore_err => true)
|
231
|
+
end
|
232
|
+
|
233
|
+
def git_retry(*command, dir: nil)
|
234
|
+
command_with_no_credentials = check_allowed(command)
|
175
235
|
|
176
|
-
|
177
|
-
|
236
|
+
Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do
|
237
|
+
git(*command, :dir => dir)
|
178
238
|
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def git(*command, dir: nil)
|
242
|
+
command_with_no_credentials = check_allowed(command)
|
243
|
+
|
244
|
+
out, err, status = capture(command, dir)
|
179
245
|
|
180
|
-
|
181
|
-
|
182
|
-
|
246
|
+
raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, err) unless status.success?
|
247
|
+
|
248
|
+
Bundler.ui.warn err unless err.empty?
|
249
|
+
|
250
|
+
out
|
183
251
|
end
|
184
252
|
|
185
253
|
def has_revision_cached?
|
186
|
-
return unless @revision
|
187
|
-
|
254
|
+
return unless @revision && path.exist?
|
255
|
+
git("cat-file", "-e", @revision, :dir => path)
|
188
256
|
true
|
189
257
|
rescue GitError
|
190
258
|
false
|
191
259
|
end
|
192
260
|
|
193
|
-
def
|
194
|
-
|
261
|
+
def find_local_revision
|
262
|
+
return head_revision if explicit_ref.nil?
|
263
|
+
|
264
|
+
find_revision_for(explicit_ref)
|
195
265
|
end
|
196
266
|
|
197
|
-
def
|
198
|
-
|
199
|
-
git("rev-parse --verify #{Shellwords.shellescape(ref)}", true).strip
|
200
|
-
end
|
267
|
+
def head_revision
|
268
|
+
verify("HEAD")
|
201
269
|
end
|
202
270
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
# Windows quoting requires double quotes only, with double quotes
|
208
|
-
# inside the string escaped by being doubled.
|
209
|
-
'"' + remote.gsub('"') { '""' } + '"'
|
210
|
-
else
|
211
|
-
# Bash requires single quoted strings, with the single quotes escaped
|
212
|
-
# by ending the string, escaping the quote, and restarting the string.
|
213
|
-
"'" + remote.gsub("'") { "'\\''" } + "'"
|
214
|
-
end
|
271
|
+
def find_revision_for(reference)
|
272
|
+
verify(reference)
|
273
|
+
rescue GitCommandError => e
|
274
|
+
raise MissingGitRevisionError.new(e.command, path, reference, credential_filtered_uri)
|
215
275
|
end
|
216
276
|
|
217
|
-
|
218
|
-
|
219
|
-
|
277
|
+
def verify(reference)
|
278
|
+
git("rev-parse", "--verify", reference, :dir => path).strip
|
279
|
+
end
|
280
|
+
|
281
|
+
# Adds credentials to the URI
|
282
|
+
def configured_uri
|
283
|
+
if /https?:/.match?(uri)
|
220
284
|
remote = Bundler::URI(uri)
|
221
285
|
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
222
286
|
remote.userinfo ||= config_auth
|
223
287
|
remote.to_s
|
288
|
+
elsif File.exist?(uri)
|
289
|
+
"file://#{uri}"
|
224
290
|
else
|
225
|
-
uri
|
291
|
+
uri.to_s
|
226
292
|
end
|
227
293
|
end
|
228
294
|
|
295
|
+
# Removes credentials from the URI
|
296
|
+
def credential_filtered_uri
|
297
|
+
URICredentialsFilter.credential_filtered_uri(uri)
|
298
|
+
end
|
299
|
+
|
229
300
|
def allow?
|
230
|
-
@git ? @git.allow_git_ops? : true
|
301
|
+
allowed = @git ? @git.allow_git_ops? : true
|
302
|
+
|
303
|
+
raise GitNotInstalledError.new if allowed && !Bundler.git_present?
|
304
|
+
|
305
|
+
allowed
|
231
306
|
end
|
232
307
|
|
233
|
-
def
|
308
|
+
def with_path(&blk)
|
234
309
|
checkout unless path.exist?
|
235
|
-
|
236
|
-
SharedHelpers.chdir(path, &blk)
|
310
|
+
blk.call
|
237
311
|
end
|
238
312
|
|
239
|
-
def
|
240
|
-
return
|
313
|
+
def allowed_with_path
|
314
|
+
return with_path { yield } if allow?
|
241
315
|
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
|
242
316
|
end
|
243
317
|
|
244
|
-
def
|
245
|
-
require "
|
246
|
-
|
247
|
-
|
248
|
-
|
318
|
+
def check_allowed(command)
|
319
|
+
require "shellwords"
|
320
|
+
command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
|
321
|
+
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
|
322
|
+
command_with_no_credentials
|
323
|
+
end
|
324
|
+
|
325
|
+
def capture(cmd, dir, ignore_err: false)
|
326
|
+
SharedHelpers.with_clean_git_env do
|
327
|
+
require "open3"
|
328
|
+
out, err, status = Open3.capture3(*capture3_args_for(cmd, dir))
|
329
|
+
|
330
|
+
filtered_out = URICredentialsFilter.credential_filtered_string(out, uri)
|
331
|
+
return [filtered_out, status] if ignore_err
|
332
|
+
|
333
|
+
filtered_err = URICredentialsFilter.credential_filtered_string(err, uri)
|
334
|
+
[filtered_out, filtered_err, status]
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def capture3_args_for(cmd, dir)
|
339
|
+
return ["git", *cmd] unless dir
|
340
|
+
|
341
|
+
if Bundler.feature_flag.bundler_3_mode? || supports_minus_c?
|
342
|
+
["git", "-C", dir.to_s, *cmd]
|
343
|
+
else
|
344
|
+
["git", *cmd, { :chdir => dir.to_s }]
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
348
|
+
def extra_clone_args
|
349
|
+
args = depth_args
|
350
|
+
return [] if args.empty?
|
351
|
+
|
352
|
+
args += ["--single-branch"]
|
353
|
+
args.unshift("--no-tags") if supports_cloning_with_no_tags?
|
354
|
+
|
355
|
+
args += ["--branch", branch || tag] if branch || tag
|
356
|
+
args
|
357
|
+
end
|
358
|
+
|
359
|
+
def depth_args
|
360
|
+
return [] if full_clone?
|
361
|
+
|
362
|
+
["--depth", depth.to_s]
|
363
|
+
end
|
364
|
+
|
365
|
+
def extra_fetch_args
|
366
|
+
extra_args = [path.to_s, *depth_args]
|
367
|
+
extra_args.push(@commit_ref)
|
368
|
+
extra_args
|
369
|
+
end
|
370
|
+
|
371
|
+
def full_clone?
|
372
|
+
depth.nil?
|
373
|
+
end
|
374
|
+
|
375
|
+
def supports_minus_c?
|
376
|
+
@supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
|
377
|
+
end
|
378
|
+
|
379
|
+
def supports_fetching_unreachable_refs?
|
380
|
+
@supports_fetching_unreachable_refs ||= Gem::Version.new(version) >= Gem::Version.new("2.5.0")
|
249
381
|
end
|
250
382
|
|
251
|
-
def
|
252
|
-
|
253
|
-
return_value, _, status = Open3.capture3(cmd)
|
254
|
-
[return_value, status]
|
383
|
+
def supports_cloning_with_no_tags?
|
384
|
+
@supports_cloning_with_no_tags ||= Gem::Version.new(version) >= Gem::Version.new("2.14.0-rc0")
|
255
385
|
end
|
256
386
|
end
|
257
387
|
end
|