bundler 2.1.4 → 2.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2164 -1430
- data/README.md +7 -9
- data/bundler.gemspec +5 -6
- data/exe/bundle +10 -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 +1 -1
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/cache.rb +3 -8
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +30 -3
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +25 -6
- data/lib/bundler/cli/exec.rb +5 -10
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +219 -28
- data/lib/bundler/cli/info.rb +38 -6
- data/lib/bundler/cli/init.rb +3 -3
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +20 -52
- data/lib/bundler/cli/issue.rb +5 -4
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/outdated.rb +95 -75
- data/lib/bundler/cli/platform.rb +1 -1
- 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.rb +101 -81
- data/lib/bundler/compact_index_client/cache.rb +6 -23
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +13 -22
- data/lib/bundler/compact_index_client.rb +3 -9
- data/lib/bundler/current_ruby.rb +6 -4
- data/lib/bundler/definition.rb +201 -385
- data/lib/bundler/dep_proxy.rb +16 -9
- data/lib/bundler/dependency.rb +23 -14
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +71 -74
- data/lib/bundler/endpoint_specification.rb +22 -12
- data/lib/bundler/env.rb +2 -2
- data/lib/bundler/environment_preserver.rb +29 -2
- data/lib/bundler/errors.rb +20 -3
- data/lib/bundler/feature_flag.rb +0 -8
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +11 -16
- data/lib/bundler/fetcher/downloader.rb +10 -7
- data/lib/bundler/fetcher/index.rb +2 -30
- data/lib/bundler/fetcher.rb +18 -23
- data/lib/bundler/friendly_errors.rb +25 -43
- data/lib/bundler/gem_helper.rb +53 -31
- data/lib/bundler/gem_helpers.rb +36 -25
- data/lib/bundler/gem_version_promoter.rb +4 -4
- data/lib/bundler/graph.rb +1 -1
- data/lib/bundler/index.rb +9 -9
- data/lib/bundler/injector.rb +33 -6
- data/lib/bundler/inline.rb +3 -2
- data/lib/bundler/installer/gem_installer.rb +7 -25
- data/lib/bundler/installer/parallel_installer.rb +46 -25
- data/lib/bundler/installer/standalone.rb +30 -10
- data/lib/bundler/installer.rb +36 -59
- data/lib/bundler/lazy_specification.rb +62 -26
- data/lib/bundler/lockfile_generator.rb +2 -2
- data/lib/bundler/lockfile_parser.rb +17 -46
- data/lib/bundler/man/.document +1 -0
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +5 -3
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +2 -4
- data/{man → lib/bundler/man}/bundle-cache.1 +1 -1
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man → lib/bundler/man}/bundle-config.1 +44 -45
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +59 -60
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man → lib/bundler/man}/bundle-exec.1 +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man → lib/bundler/man}/bundle-init.1 +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man → lib/bundler/man}/bundle-install.1 +31 -4
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +27 -5
- 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 +1 -1
- 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/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man → lib/bundler/man}/bundle.1 +1 -1
- data/{man → lib/bundler/man}/gemfile.5 +31 -5
- data/{man → lib/bundler/man}/gemfile.5.ronn +13 -5
- data/lib/bundler/mirror.rb +2 -2
- data/lib/bundler/plugin/api/source.rb +23 -7
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +13 -1
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/installer.rb +11 -11
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +56 -11
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +12 -2
- data/lib/bundler/resolver/spec_group.rb +58 -55
- data/lib/bundler/resolver.rb +176 -177
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +2 -15
- data/lib/bundler/rubygems_ext.rb +137 -28
- data/lib/bundler/rubygems_gem_installer.rb +69 -8
- data/lib/bundler/rubygems_integration.rb +69 -133
- data/lib/bundler/runtime.rb +22 -25
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +144 -65
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +12 -27
- data/lib/bundler/similarity_detector.rb +1 -1
- data/lib/bundler/source/git/git_proxy.rb +88 -84
- data/lib/bundler/source/git.rb +43 -23
- data/lib/bundler/source/metadata.rb +3 -7
- data/lib/bundler/source/path/installer.rb +10 -10
- data/lib/bundler/source/path.rb +10 -4
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/source/rubygems.rb +126 -116
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +22 -1
- data/lib/bundler/source_list.rb +101 -63
- data/lib/bundler/source_map.rb +71 -0
- data/lib/bundler/spec_set.rb +26 -41
- data/lib/bundler/stub_specification.rb +25 -7
- data/lib/bundler/templates/Executable +2 -4
- data/lib/bundler/templates/Executable.bundler +8 -8
- data/lib/bundler/templates/Executable.standalone +2 -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/Gemfile.tt +12 -1
- data/lib/bundler/templates/newgem/README.md.tt +9 -14
- data/lib/bundler/templates/newgem/Rakefile.tt +32 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +27 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -17
- 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 +6 -6
- 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 +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +37 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +34 -28
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +49 -47
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -1
- 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/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 +27 -6
- 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/tmpdir/lib/tmpdir.rb +154 -0
- 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 +17 -80
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/lib/bundler/vendored_persistent.rb +0 -7
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +20 -5
- data/lib/bundler/yaml_serializer.rb +1 -1
- data/lib/bundler.rb +64 -43
- metadata +94 -91
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -37
- 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/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.txt +0 -91
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -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-cache.ronn → lib/bundler/man/bundle-cache.1.ronn} +0 -0
- /data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- /data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- /data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- /data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.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-inject.ronn → lib/bundler/man/bundle-inject.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-platform.ronn → lib/bundler/man/bundle-platform.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
- /data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- /data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +0 -0
- /data/{man → lib/bundler/man}/index.txt +0 -0
data/lib/bundler/feature_flag.rb
CHANGED
@@ -27,25 +27,17 @@ module Bundler
|
|
27
27
|
|
28
28
|
(1..10).each {|v| define_method("bundler_#{v}_mode?") { major_version >= v } }
|
29
29
|
|
30
|
-
settings_flag(:allow_bundler_dependency_conflicts) { bundler_3_mode? }
|
31
30
|
settings_flag(:allow_offline_install) { bundler_3_mode? }
|
32
31
|
settings_flag(:auto_clean_without_path) { bundler_3_mode? }
|
33
|
-
settings_flag(:auto_config_jobs) { bundler_3_mode? }
|
34
32
|
settings_flag(:cache_all) { bundler_3_mode? }
|
35
33
|
settings_flag(:default_install_uses_path) { bundler_3_mode? }
|
36
|
-
settings_flag(:deployment_means_frozen) { bundler_3_mode? }
|
37
|
-
settings_flag(:disable_multisource) { bundler_3_mode? }
|
38
34
|
settings_flag(:forget_cli_options) { bundler_3_mode? }
|
39
35
|
settings_flag(:global_gem_cache) { bundler_3_mode? }
|
40
|
-
settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
|
41
36
|
settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
|
42
37
|
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
|
43
38
|
settings_flag(:print_only_version_number) { bundler_3_mode? }
|
44
39
|
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
|
45
|
-
settings_flag(:skip_default_git_sources) { bundler_3_mode? }
|
46
|
-
settings_flag(:specific_platform) { bundler_3_mode? }
|
47
40
|
settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
|
48
|
-
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
|
49
41
|
settings_flag(:update_requires_all_flag) { bundler_4_mode? }
|
50
42
|
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
|
51
43
|
|
data/lib/bundler/fetcher/base.rb
CHANGED
@@ -57,22 +57,17 @@ module Bundler
|
|
57
57
|
gem_info
|
58
58
|
end
|
59
59
|
|
60
|
-
def fetch_spec(spec)
|
61
|
-
spec -= [nil, "ruby", ""]
|
62
|
-
contents = compact_index_client.spec(*spec)
|
63
|
-
return nil if contents.nil?
|
64
|
-
contents.unshift(spec.first)
|
65
|
-
contents[3].map! {|d| Gem::Dependency.new(*d) }
|
66
|
-
EndpointSpecification.new(*contents)
|
67
|
-
end
|
68
|
-
compact_index_request :fetch_spec
|
69
|
-
|
70
60
|
def available?
|
71
|
-
|
72
|
-
|
73
|
-
|
61
|
+
unless SharedHelpers.md5_available?
|
62
|
+
Bundler.ui.debug("FIPS mode is enabled, bundler can't use the CompactIndex API")
|
63
|
+
return nil
|
64
|
+
end
|
65
|
+
if fetch_uri.scheme == "file"
|
66
|
+
Bundler.ui.debug("Using a local server, bundler won't use the CompactIndex API")
|
67
|
+
return false
|
68
|
+
end
|
74
69
|
# Read info file checksums out of /versions, so we can know if gems are up to date
|
75
|
-
|
70
|
+
compact_index_client.update_and_parse_checksums!
|
76
71
|
rescue CompactIndexClient::Updater::MisMatchedChecksumError => e
|
77
72
|
Bundler.ui.debug(e.message)
|
78
73
|
nil
|
@@ -83,7 +78,7 @@ module Bundler
|
|
83
78
|
true
|
84
79
|
end
|
85
80
|
|
86
|
-
|
81
|
+
private
|
87
82
|
|
88
83
|
def compact_index_client
|
89
84
|
@compact_index_client ||=
|
@@ -111,7 +106,7 @@ module Bundler
|
|
111
106
|
def bundle_worker(func = nil)
|
112
107
|
@bundle_worker ||= begin
|
113
108
|
worker_name = "Compact Index (#{display_uri.host})"
|
114
|
-
Bundler::Worker.new(Bundler.
|
109
|
+
Bundler::Worker.new(Bundler.settings.processor_count, worker_name, func)
|
115
110
|
end
|
116
111
|
@bundle_worker.tap do |worker|
|
117
112
|
worker.instance_variable_set(:@func, func) if func
|
@@ -14,8 +14,10 @@ module Bundler
|
|
14
14
|
def fetch(uri, headers = {}, counter = 0)
|
15
15
|
raise HTTPError, "Too many redirects" if counter >= redirect_limit
|
16
16
|
|
17
|
+
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
18
|
+
|
17
19
|
response = request(uri, headers)
|
18
|
-
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{
|
20
|
+
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{filtered_uri}")
|
19
21
|
|
20
22
|
case response
|
21
23
|
when Net::HTTPSuccess, Net::HTTPNotModified
|
@@ -40,7 +42,7 @@ module Bundler
|
|
40
42
|
raise BadAuthenticationError, uri.host if uri.userinfo
|
41
43
|
raise AuthenticationRequiredError, uri.host
|
42
44
|
when Net::HTTPNotFound
|
43
|
-
raise FallbackError, "Net::HTTPNotFound: #{
|
45
|
+
raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}"
|
44
46
|
else
|
45
47
|
raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
|
46
48
|
end
|
@@ -49,7 +51,9 @@ module Bundler
|
|
49
51
|
def request(uri, headers)
|
50
52
|
validate_uri_scheme!(uri)
|
51
53
|
|
52
|
-
|
54
|
+
filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
|
55
|
+
|
56
|
+
Bundler.ui.debug "HTTP GET #{filtered_uri}"
|
53
57
|
req = Net::HTTP::Get.new uri.request_uri, headers
|
54
58
|
if uri.user
|
55
59
|
user = CGI.unescape(uri.user)
|
@@ -64,17 +68,16 @@ module Bundler
|
|
64
68
|
raise CertificateFailureError.new(uri)
|
65
69
|
rescue *HTTP_ERRORS => e
|
66
70
|
Bundler.ui.trace e
|
67
|
-
|
68
|
-
when /host down:/, /getaddrinfo: nodename nor servname provided/
|
71
|
+
if e.is_a?(SocketError) || e.message =~ /host down:/
|
69
72
|
raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
|
70
73
|
"connection and try again."
|
71
74
|
else
|
72
|
-
raise HTTPError, "Network error while fetching #{
|
75
|
+
raise HTTPError, "Network error while fetching #{filtered_uri}" \
|
73
76
|
" (#{e})"
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
77
|
-
|
80
|
+
private
|
78
81
|
|
79
82
|
def validate_uri_scheme!(uri)
|
80
83
|
return if uri.scheme =~ /\Ahttps?\z/
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "base"
|
4
|
-
require "rubygems/remote_fetcher"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class Fetcher
|
8
7
|
class Index < Base
|
9
8
|
def specs(_gem_names)
|
10
9
|
Bundler.rubygems.fetch_all_remote_specs(remote)
|
11
|
-
rescue Gem::RemoteFetcher::FetchError
|
10
|
+
rescue Gem::RemoteFetcher::FetchError => e
|
12
11
|
case e.message
|
13
12
|
when /certificate verify failed/
|
14
13
|
raise CertificateFailureError.new(display_uri)
|
@@ -19,36 +18,9 @@ module Bundler
|
|
19
18
|
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
|
20
19
|
raise AuthenticationRequiredError, remote_uri
|
21
20
|
else
|
22
|
-
|
23
|
-
raise HTTPError, "Could not fetch specs from #{display_uri}"
|
21
|
+
raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
|
24
22
|
end
|
25
23
|
end
|
26
|
-
|
27
|
-
def fetch_spec(spec)
|
28
|
-
spec -= [nil, "ruby", ""]
|
29
|
-
spec_file_name = "#{spec.join "-"}.gemspec"
|
30
|
-
|
31
|
-
uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
32
|
-
if uri.scheme == "file"
|
33
|
-
path = Bundler.rubygems.correct_for_windows_path(uri.path)
|
34
|
-
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
|
35
|
-
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
36
|
-
Bundler.load_gemspec(cached_spec_path)
|
37
|
-
else
|
38
|
-
Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
|
39
|
-
end
|
40
|
-
rescue MarshalError
|
41
|
-
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
|
42
|
-
"Your network or your gem server is probably having issues right now."
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
# cached gem specification path, if one exists
|
48
|
-
def gemspec_cached_path(spec_file_name)
|
49
|
-
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
|
50
|
-
paths.find {|path| File.file? path }
|
51
|
-
end
|
52
24
|
end
|
53
25
|
end
|
54
26
|
end
|
data/lib/bundler/fetcher.rb
CHANGED
@@ -28,7 +28,8 @@ module Bundler
|
|
28
28
|
" is a chance you are experiencing a man-in-the-middle attack, but" \
|
29
29
|
" most likely your system doesn't have the CA certificates needed" \
|
30
30
|
" for verification. For information about OpenSSL certificates, see" \
|
31
|
-
"
|
31
|
+
" https://railsapps.github.io/openssl-certificate-verify-failed.html." \
|
32
|
+
" To connect without using SSL, edit your Gemfile" \
|
32
33
|
" sources and change 'https' to 'http'."
|
33
34
|
end
|
34
35
|
end
|
@@ -47,7 +48,8 @@ module Bundler
|
|
47
48
|
remote_uri = filter_uri(remote_uri)
|
48
49
|
super "Authentication is required for #{remote_uri}.\n" \
|
49
50
|
"Please supply credentials for this source. You can do this by running:\n" \
|
50
|
-
"
|
51
|
+
"`bundle config set --global #{remote_uri} username:password`\n" \
|
52
|
+
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
|
51
53
|
end
|
52
54
|
end
|
53
55
|
# This error is raised if HTTP authentication is provided, but incorrect.
|
@@ -69,8 +71,8 @@ module Bundler
|
|
69
71
|
:HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze
|
70
72
|
FAIL_ERRORS = begin
|
71
73
|
fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError]
|
72
|
-
fail_errors << Gem::Requirement::BadRequirementError
|
73
|
-
fail_errors.concat(NET_ERRORS.map {|e|
|
74
|
+
fail_errors << Gem::Requirement::BadRequirementError
|
75
|
+
fail_errors.concat(NET_ERRORS.map {|e| Net.const_get(e) })
|
74
76
|
end.freeze
|
75
77
|
|
76
78
|
class << self
|
@@ -120,7 +122,6 @@ module Bundler
|
|
120
122
|
|
121
123
|
# return the specs in the bundler format as an index
|
122
124
|
def specs(gem_names, source)
|
123
|
-
old = Bundler.rubygems.sources
|
124
125
|
index = Bundler::Index.new
|
125
126
|
|
126
127
|
if Bundler::Fetcher.disable_endpoint
|
@@ -128,18 +129,15 @@ module Bundler
|
|
128
129
|
specs = fetchers.last.specs(gem_names)
|
129
130
|
else
|
130
131
|
specs = []
|
131
|
-
fetchers
|
132
|
-
|
133
|
-
break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
|
134
|
-
fetchers.delete(f)
|
132
|
+
@fetchers = fetchers.drop_while do |f|
|
133
|
+
!f.available? || (f.api_fetcher? && !gem_names) || !specs = f.specs(gem_names)
|
135
134
|
end
|
136
135
|
@use_api = false if fetchers.none?(&:api_fetcher?)
|
137
136
|
end
|
138
137
|
|
139
138
|
specs.each do |name, version, platform, dependencies, metadata|
|
140
|
-
next if name == "bundler"
|
141
139
|
spec = if dependencies
|
142
|
-
EndpointSpecification.new(name, version, platform, dependencies, metadata)
|
140
|
+
EndpointSpecification.new(name, version, platform, self, dependencies, metadata)
|
143
141
|
else
|
144
142
|
RemoteSpecification.new(name, version, platform, self)
|
145
143
|
end
|
@@ -152,8 +150,6 @@ module Bundler
|
|
152
150
|
rescue CertificateFailureError
|
153
151
|
Bundler.ui.info "" if gem_names && use_api # newline after dots
|
154
152
|
raise
|
155
|
-
ensure
|
156
|
-
Bundler.rubygems.sources = old
|
157
153
|
end
|
158
154
|
|
159
155
|
def use_api
|
@@ -216,7 +212,7 @@ module Bundler
|
|
216
212
|
"#<#{self.class}:0x#{object_id} uri=#{uri}>"
|
217
213
|
end
|
218
214
|
|
219
|
-
|
215
|
+
private
|
220
216
|
|
221
217
|
FETCHERS = [CompactIndex, Dependency, Index].freeze
|
222
218
|
|
@@ -229,6 +225,8 @@ module Bundler
|
|
229
225
|
"BUILDBOX" => "buildbox",
|
230
226
|
"GO_SERVER_URL" => "go",
|
231
227
|
"SNAP_CI" => "snap",
|
228
|
+
"GITLAB_CI" => "gitlab",
|
229
|
+
"GITHUB_ACTIONS" => "github",
|
232
230
|
"CI_NAME" => ENV["CI_NAME"],
|
233
231
|
"CI" => "ci",
|
234
232
|
}
|
@@ -243,7 +241,7 @@ module Bundler
|
|
243
241
|
raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
|
244
242
|
|
245
243
|
con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
|
246
|
-
if gem_proxy =
|
244
|
+
if gem_proxy = Gem.configuration[:http_proxy]
|
247
245
|
con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
|
248
246
|
end
|
249
247
|
|
@@ -254,8 +252,8 @@ module Bundler
|
|
254
252
|
end
|
255
253
|
|
256
254
|
ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
|
257
|
-
(
|
258
|
-
|
255
|
+
(Gem.configuration.ssl_client_cert if
|
256
|
+
Gem.configuration.respond_to?(:ssl_client_cert))
|
259
257
|
if ssl_client_cert
|
260
258
|
pem = File.read(ssl_client_cert)
|
261
259
|
con.cert = OpenSSL::X509::Certificate.new(pem)
|
@@ -273,8 +271,7 @@ module Bundler
|
|
273
271
|
# cached gem specification path, if one exists
|
274
272
|
def gemspec_cached_path(spec_file_name)
|
275
273
|
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
|
276
|
-
paths
|
277
|
-
paths.first
|
274
|
+
paths.find {|path| File.file? path }
|
278
275
|
end
|
279
276
|
|
280
277
|
HTTP_ERRORS = [
|
@@ -287,8 +284,8 @@ module Bundler
|
|
287
284
|
def bundler_cert_store
|
288
285
|
store = OpenSSL::X509::Store.new
|
289
286
|
ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
|
290
|
-
(
|
291
|
-
|
287
|
+
(Gem.configuration.ssl_ca_cert if
|
288
|
+
Gem.configuration.respond_to?(:ssl_ca_cert))
|
292
289
|
if ssl_ca_cert
|
293
290
|
if File.directory? ssl_ca_cert
|
294
291
|
store.add_path ssl_ca_cert
|
@@ -302,8 +299,6 @@ module Bundler
|
|
302
299
|
store
|
303
300
|
end
|
304
301
|
|
305
|
-
private
|
306
|
-
|
307
302
|
def remote_uri
|
308
303
|
@remote.uri
|
309
304
|
end
|
@@ -4,7 +4,19 @@ require_relative "vendored_thor"
|
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
module FriendlyErrors
|
7
|
-
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def enable!
|
10
|
+
@disabled = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def disabled?
|
14
|
+
@disabled
|
15
|
+
end
|
16
|
+
|
17
|
+
def disable!
|
18
|
+
@disabled = true
|
19
|
+
end
|
8
20
|
|
9
21
|
def log_error(error)
|
10
22
|
case error
|
@@ -23,13 +35,7 @@ module Bundler
|
|
23
35
|
Bundler.ui.error error.message
|
24
36
|
when LoadError
|
25
37
|
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
|
26
|
-
Bundler.ui.error "\nCould not load OpenSSL."
|
27
|
-
Bundler.ui.warn <<-WARN, :wrap => true
|
28
|
-
You must recompile Ruby with OpenSSL support or change the sources in your \
|
29
|
-
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
|
30
|
-
using RVM are available at https://rvm.io/packages/openssl.
|
31
|
-
WARN
|
32
|
-
Bundler.ui.trace error
|
38
|
+
Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
|
33
39
|
when Interrupt
|
34
40
|
Bundler.ui.error "\nQuitting..."
|
35
41
|
Bundler.ui.trace error
|
@@ -43,8 +49,6 @@ module Bundler
|
|
43
49
|
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
|
44
50
|
else request_issue_report_for(error)
|
45
51
|
end
|
46
|
-
rescue StandardError
|
47
|
-
raise error
|
48
52
|
end
|
49
53
|
|
50
54
|
def exit_status(error)
|
@@ -57,36 +61,8 @@ module Bundler
|
|
57
61
|
end
|
58
62
|
|
59
63
|
def request_issue_report_for(e)
|
60
|
-
Bundler.ui.
|
64
|
+
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, nil
|
61
65
|
--- ERROR REPORT TEMPLATE -------------------------------------------------------
|
62
|
-
# Error Report
|
63
|
-
|
64
|
-
## Questions
|
65
|
-
|
66
|
-
Please fill out answers to these questions, it'll help us figure out
|
67
|
-
why things are going wrong.
|
68
|
-
|
69
|
-
- **What did you do?**
|
70
|
-
|
71
|
-
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
|
72
|
-
|
73
|
-
- **What did you expect to happen?**
|
74
|
-
|
75
|
-
I expected Bundler to...
|
76
|
-
|
77
|
-
- **What happened instead?**
|
78
|
-
|
79
|
-
Instead, what happened was...
|
80
|
-
|
81
|
-
- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**
|
82
|
-
|
83
|
-
I tried...
|
84
|
-
|
85
|
-
- **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**
|
86
|
-
|
87
|
-
...
|
88
|
-
|
89
|
-
## Backtrace
|
90
66
|
|
91
67
|
```
|
92
68
|
#{e.class}: #{e.message}
|
@@ -100,13 +76,12 @@ module Bundler
|
|
100
76
|
|
101
77
|
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
|
102
78
|
|
103
|
-
Bundler.ui.
|
79
|
+
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, :yellow
|
104
80
|
|
105
81
|
First, try this link to see if there are any existing issue reports for this error:
|
106
82
|
#{issues_url(e)}
|
107
83
|
|
108
|
-
If there aren't any reports for this error yet, please
|
109
|
-
https://github.com/bundler/bundler/issues/new
|
84
|
+
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
|
110
85
|
EOS
|
111
86
|
end
|
112
87
|
|
@@ -114,16 +89,23 @@ module Bundler
|
|
114
89
|
message = exception.message.lines.first.tr(":", " ").chomp
|
115
90
|
message = message.split("-").first if exception.is_a?(Errno)
|
116
91
|
require "cgi"
|
117
|
-
"https://github.com/
|
92
|
+
"https://github.com/rubygems/rubygems/search?q=" \
|
118
93
|
"#{CGI.escape(message)}&type=Issues"
|
119
94
|
end
|
95
|
+
|
96
|
+
def new_issue_url
|
97
|
+
"https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md"
|
98
|
+
end
|
120
99
|
end
|
121
100
|
|
122
101
|
def self.with_friendly_errors
|
102
|
+
FriendlyErrors.enable!
|
123
103
|
yield
|
124
104
|
rescue SignalException
|
125
105
|
raise
|
126
106
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
107
|
+
raise if FriendlyErrors.disabled?
|
108
|
+
|
127
109
|
FriendlyErrors.log_error(e)
|
128
110
|
exit FriendlyErrors.exit_status(e)
|
129
111
|
end
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -15,6 +15,10 @@ module Bundler
|
|
15
15
|
new(opts[:dir], opts[:name]).install
|
16
16
|
end
|
17
17
|
|
18
|
+
def tag_prefix=(prefix)
|
19
|
+
instance.tag_prefix = prefix
|
20
|
+
end
|
21
|
+
|
18
22
|
def gemspec(&block)
|
19
23
|
gemspec = instance.gemspec
|
20
24
|
block.call(gemspec) if block
|
@@ -24,12 +28,15 @@ module Bundler
|
|
24
28
|
|
25
29
|
attr_reader :spec_path, :base, :gemspec
|
26
30
|
|
31
|
+
attr_writer :tag_prefix
|
32
|
+
|
27
33
|
def initialize(base = nil, name = nil)
|
28
|
-
@base = (base
|
29
|
-
gemspecs = name ? [File.join(base, "#{name}.gemspec")] :
|
34
|
+
@base = File.expand_path(base || SharedHelpers.pwd)
|
35
|
+
gemspecs = name ? [File.join(@base, "#{name}.gemspec")] : Gem::Util.glob_files_in_dir("{,*}.gemspec", @base)
|
30
36
|
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
|
31
37
|
@spec_path = gemspecs.first
|
32
38
|
@gemspec = Bundler.load_gemspec(@spec_path)
|
39
|
+
@tag_prefix = ""
|
33
40
|
end
|
34
41
|
|
35
42
|
def install
|
@@ -40,6 +47,11 @@ module Bundler
|
|
40
47
|
built_gem_path = build_gem
|
41
48
|
end
|
42
49
|
|
50
|
+
desc "Generate SHA512 checksum if #{name}-#{version}.gem into the checksums directory."
|
51
|
+
task "build:checksum" => "build" do
|
52
|
+
build_checksum(built_gem_path)
|
53
|
+
end
|
54
|
+
|
43
55
|
desc "Build and install #{name}-#{version}.gem into system gems."
|
44
56
|
task "install" => "build" do
|
45
57
|
install_gem(built_gem_path)
|
@@ -64,7 +76,7 @@ module Bundler
|
|
64
76
|
tag_version { git_push(args[:remote]) } unless already_tagged?
|
65
77
|
end
|
66
78
|
|
67
|
-
task "release:rubygem_push" do
|
79
|
+
task "release:rubygem_push" => "build" do
|
68
80
|
rubygem_push(built_gem_path) if gem_push?
|
69
81
|
end
|
70
82
|
|
@@ -73,7 +85,7 @@ module Bundler
|
|
73
85
|
|
74
86
|
def build_gem
|
75
87
|
file_name = nil
|
76
|
-
sh(
|
88
|
+
sh([*gem_command, "build", "-V", spec_path]) do
|
77
89
|
file_name = File.basename(built_gem_path)
|
78
90
|
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
|
79
91
|
FileUtils.mv(built_gem_path, "pkg")
|
@@ -84,36 +96,54 @@ module Bundler
|
|
84
96
|
|
85
97
|
def install_gem(built_gem_path = nil, local = false)
|
86
98
|
built_gem_path ||= build_gem
|
87
|
-
cmd =
|
88
|
-
cmd
|
89
|
-
|
90
|
-
unless status.success?
|
91
|
-
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output"
|
92
|
-
end
|
99
|
+
cmd = [*gem_command, "install", built_gem_path.to_s]
|
100
|
+
cmd << "--local" if local
|
101
|
+
sh(cmd)
|
93
102
|
Bundler.ui.confirm "#{name} (#{version}) installed."
|
94
103
|
end
|
95
104
|
|
96
|
-
|
105
|
+
def build_checksum(built_gem_path = nil)
|
106
|
+
built_gem_path ||= build_gem
|
107
|
+
SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
|
108
|
+
file_name = "#{File.basename(built_gem_path)}.sha512"
|
109
|
+
require "digest/sha2"
|
110
|
+
checksum = ::Digest::SHA512.file(built_gem_path).hexdigest
|
111
|
+
target = File.join(base, "checksums", file_name)
|
112
|
+
File.write(target, checksum + "\n")
|
113
|
+
Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
|
114
|
+
end
|
115
|
+
|
116
|
+
protected
|
97
117
|
|
98
118
|
def rubygem_push(path)
|
99
|
-
cmd =
|
119
|
+
cmd = [*gem_command, "push", path]
|
100
120
|
cmd << "--key" << gem_key if gem_key
|
101
121
|
cmd << "--host" << allowed_push_host if allowed_push_host
|
102
|
-
unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file?
|
103
|
-
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
|
104
|
-
end
|
105
122
|
sh_with_input(cmd)
|
106
123
|
Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}"
|
107
124
|
end
|
108
125
|
|
109
126
|
def built_gem_path
|
110
|
-
|
127
|
+
Gem::Util.glob_files_in_dir("#{name}-*.gem", base).sort_by {|f| File.mtime(f) }.last
|
111
128
|
end
|
112
129
|
|
113
|
-
def git_push(remote =
|
114
|
-
|
115
|
-
|
116
|
-
|
130
|
+
def git_push(remote = nil)
|
131
|
+
remote ||= default_remote
|
132
|
+
sh("git push #{remote} refs/heads/#{current_branch}".shellsplit)
|
133
|
+
sh("git push #{remote} refs/tags/#{version_tag}".shellsplit)
|
134
|
+
Bundler.ui.confirm "Pushed git commits and release tag."
|
135
|
+
end
|
136
|
+
|
137
|
+
def default_remote
|
138
|
+
remote_for_branch, status = sh_with_status(%W[git config --get branch.#{current_branch}.remote])
|
139
|
+
return "origin" unless status.success?
|
140
|
+
|
141
|
+
remote_for_branch.strip
|
142
|
+
end
|
143
|
+
|
144
|
+
def current_branch
|
145
|
+
# We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
|
146
|
+
sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
|
117
147
|
end
|
118
148
|
|
119
149
|
def allowed_push_host
|
@@ -128,13 +158,6 @@ module Bundler
|
|
128
158
|
allowed_push_host || env_rubygems_host || "rubygems.org"
|
129
159
|
end
|
130
160
|
|
131
|
-
def perform_git_push(options = "")
|
132
|
-
cmd = "git push #{options}"
|
133
|
-
out, status = sh_with_status(cmd.shellsplit)
|
134
|
-
return if status.success?
|
135
|
-
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n"
|
136
|
-
end
|
137
|
-
|
138
161
|
def already_tagged?
|
139
162
|
return false unless sh(%w[git tag]).split(/\n/).include?(version_tag)
|
140
163
|
Bundler.ui.confirm "Tag #{version_tag} has already been created."
|
@@ -168,7 +191,7 @@ module Bundler
|
|
168
191
|
end
|
169
192
|
|
170
193
|
def version_tag
|
171
|
-
"v#{version}"
|
194
|
+
"#{@tag_prefix}v#{version}"
|
172
195
|
end
|
173
196
|
|
174
197
|
def name
|
@@ -185,8 +208,7 @@ module Bundler
|
|
185
208
|
def sh(cmd, &block)
|
186
209
|
out, status = sh_with_status(cmd, &block)
|
187
210
|
unless status.success?
|
188
|
-
|
189
|
-
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
211
|
+
raise("Running `#{cmd.shelljoin}` failed with the following output:\n\n#{out}\n")
|
190
212
|
end
|
191
213
|
out
|
192
214
|
end
|
@@ -210,7 +232,7 @@ module Bundler
|
|
210
232
|
end
|
211
233
|
|
212
234
|
def gem_command
|
213
|
-
ENV["GEM_COMMAND"]
|
235
|
+
ENV["GEM_COMMAND"]&.shellsplit || ["gem"]
|
214
236
|
end
|
215
237
|
end
|
216
238
|
end
|