bundler 2.3.12 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +367 -1
- data/README.md +2 -2
- data/bundler.gemspec +8 -10
- data/exe/bundle +1 -4
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/add.rb +1 -1
- data/lib/bundler/cli/binstubs.rb +5 -1
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/common.rb +3 -1
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -6
- data/lib/bundler/cli/gem.rb +62 -40
- data/lib/bundler/cli/init.rb +5 -1
- data/lib/bundler/cli/install.rb +7 -5
- data/lib/bundler/cli/lock.rb +8 -5
- data/lib/bundler/cli/open.rb +6 -4
- data/lib/bundler/cli/outdated.rb +13 -6
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +52 -7
- data/lib/bundler/compact_index_client/cache.rb +1 -1
- data/lib/bundler/compact_index_client/updater.rb +53 -39
- data/lib/bundler/constants.rb +1 -1
- data/lib/bundler/current_ruby.rb +15 -6
- data/lib/bundler/definition.rb +203 -110
- data/lib/bundler/dependency.rb +21 -84
- data/lib/bundler/digest.rb +1 -1
- data/lib/bundler/dsl.rb +13 -18
- data/lib/bundler/endpoint_specification.rb +6 -10
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +1 -0
- data/lib/bundler/errors.rb +15 -15
- data/lib/bundler/feature_flag.rb +0 -1
- data/lib/bundler/fetcher/base.rb +6 -8
- data/lib/bundler/fetcher/compact_index.rb +9 -11
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +2 -5
- data/lib/bundler/fetcher.rb +12 -12
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +21 -7
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_version_promoter.rb +53 -98
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +11 -49
- data/lib/bundler/injector.rb +8 -3
- data/lib/bundler/inline.rb +9 -21
- data/lib/bundler/installer/gem_installer.rb +14 -1
- data/lib/bundler/installer/parallel_installer.rb +0 -31
- data/lib/bundler/installer/standalone.rb +41 -10
- data/lib/bundler/installer.rb +18 -39
- data/lib/bundler/lazy_specification.rb +53 -48
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +9 -5
- data/lib/bundler/man/bundle-add.1 +13 -5
- data/lib/bundler/man/bundle-add.1.ronn +10 -4
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +7 -1
- data/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +2 -2
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +26 -7
- data/lib/bundler/man/bundle-config.1.ronn +17 -7
- data/lib/bundler/man/bundle-console.1 +53 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +6 -6
- data/lib/bundler/man/bundle-exec.1.ronn +6 -6
- data/lib/bundler/man/bundle-gem.1 +27 -37
- data/lib/bundler/man/bundle-gem.1.ronn +5 -5
- data/lib/bundler/man/bundle-help.1 +13 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +5 -2
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +5 -30
- data/lib/bundler/man/bundle-install.1.ronn +6 -29
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +22 -2
- data/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +16 -6
- data/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/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +1 -1
- data/lib/bundler/man/bundle-version.1 +35 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +4 -1
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +15 -10
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +92 -81
- data/lib/bundler/man/gemfile.5.ronn +98 -85
- data/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 +5 -7
- data/lib/bundler/plugin/api/source.rb +3 -3
- data/lib/bundler/plugin/index.rb +4 -4
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/rubygems.rb +0 -8
- data/lib/bundler/plugin.rb +2 -0
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +8 -9
- data/lib/bundler/resolver/base.rb +77 -0
- data/lib/bundler/resolver/candidate.rb +94 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +72 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +42 -70
- data/lib/bundler/resolver.rb +322 -326
- data/lib/bundler/ruby_dsl.rb +1 -1
- data/lib/bundler/ruby_version.rb +5 -5
- data/lib/bundler/rubygems_ext.rb +102 -12
- data/lib/bundler/rubygems_gem_installer.rb +32 -20
- data/lib/bundler/rubygems_integration.rb +12 -34
- data/lib/bundler/runtime.rb +1 -6
- data/lib/bundler/settings.rb +2 -8
- data/lib/bundler/shared_helpers.rb +7 -7
- data/lib/bundler/source/git/git_proxy.rb +193 -67
- data/lib/bundler/source/git.rb +21 -25
- data/lib/bundler/source/metadata.rb +1 -2
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +6 -6
- data/lib/bundler/source/rubygems.rb +75 -117
- data/lib/bundler/source.rb +3 -4
- data/lib/bundler/source_list.rb +12 -2
- data/lib/bundler/spec_set.rb +52 -34
- data/lib/bundler/stub_specification.rb +5 -3
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/Executable.bundler +4 -9
- data/lib/bundler/templates/Executable.standalone +2 -0
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +3 -0
- data/lib/bundler/templates/newgem/README.md.tt +6 -4
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -1
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -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 +10 -0
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
- data/lib/bundler/ui/shell.rb +35 -12
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +3 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +0 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +3 -1
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1350 -408
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- 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 +128 -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/lib/thor/shell/basic.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/common.rb +64 -16
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +27 -7
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -2
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +13 -7
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +10 -5
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +1 -2
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +3 -2
- data/lib/bundler/vendored_persistent.rb +1 -33
- data/lib/bundler/{vendored_tmpdir.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/worker.rb +5 -7
- data/lib/bundler.rb +35 -69
- metadata +45 -34
- data/lib/bundler/dep_proxy.rb +0 -55
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/molinillo/LICENSE +0 -9
- 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 -88
- 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 -164
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -149
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- 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 -11
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/lib/bundler/vendored_molinillo.rb +0 -4
- data/lib/bundler/version_ranges.rb +0 -122
- /data/lib/bundler/templates/newgem/ext/newgem/{extconf.rb.tt → extconf-c.rb.tt} +0 -0
@@ -31,7 +31,6 @@ module Bundler
|
|
31
31
|
msg = String.new
|
32
32
|
msg << "Git error: command `#{command}` in directory #{path} has failed."
|
33
33
|
msg << "\n#{extra_info}" if extra_info
|
34
|
-
msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path.exist?
|
35
34
|
super msg
|
36
35
|
end
|
37
36
|
end
|
@@ -47,23 +46,27 @@ module Bundler
|
|
47
46
|
# All actions required by the Git source is encapsulated in this
|
48
47
|
# object.
|
49
48
|
class GitProxy
|
50
|
-
attr_accessor :path, :uri, :ref
|
49
|
+
attr_accessor :path, :uri, :branch, :tag, :ref, :explicit_ref
|
51
50
|
attr_writer :revision
|
52
51
|
|
53
|
-
def initialize(path, uri,
|
52
|
+
def initialize(path, uri, options = {}, revision = nil, git = nil)
|
54
53
|
@path = path
|
55
54
|
@uri = uri
|
56
|
-
@
|
55
|
+
@branch = options["branch"]
|
56
|
+
@tag = options["tag"]
|
57
|
+
@ref = options["ref"]
|
58
|
+
@explicit_ref = branch || tag || ref
|
57
59
|
@revision = revision
|
58
60
|
@git = git
|
61
|
+
@commit_ref = nil
|
59
62
|
end
|
60
63
|
|
61
64
|
def revision
|
62
|
-
@revision ||= find_local_revision
|
65
|
+
@revision ||= allowed_with_path { find_local_revision }
|
63
66
|
end
|
64
67
|
|
65
|
-
def
|
66
|
-
@
|
68
|
+
def current_branch
|
69
|
+
@current_branch ||= allowed_with_path do
|
67
70
|
git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
|
68
71
|
end
|
69
72
|
end
|
@@ -76,36 +79,26 @@ module Bundler
|
|
76
79
|
end
|
77
80
|
|
78
81
|
def version
|
79
|
-
|
82
|
+
@version ||= full_version.match(/((\.?\d+)+).*/)[1]
|
80
83
|
end
|
81
84
|
|
82
85
|
def full_version
|
83
|
-
git("--version").sub(
|
86
|
+
@full_version ||= git("--version").sub(/git version\s*/, "").strip
|
84
87
|
end
|
85
88
|
|
86
89
|
def checkout
|
87
|
-
return if
|
88
|
-
extra_ref = "#{ref}:#{ref}" if ref && ref.start_with?("refs/")
|
90
|
+
return if has_revision_cached?
|
89
91
|
|
90
|
-
Bundler.ui.info "Fetching #{
|
92
|
+
Bundler.ui.info "Fetching #{credential_filtered_uri}"
|
91
93
|
|
92
|
-
|
94
|
+
extra_fetch_needed = clone_needs_extra_fetch?
|
95
|
+
unshallow_needed = clone_needs_unshallow?
|
96
|
+
return unless extra_fetch_needed || unshallow_needed
|
93
97
|
|
94
|
-
|
95
|
-
SharedHelpers.filesystem_access(path.dirname) do |p|
|
96
|
-
FileUtils.mkdir_p(p)
|
97
|
-
end
|
98
|
-
git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
|
99
|
-
return unless extra_ref
|
100
|
-
end
|
101
|
-
|
102
|
-
with_path do
|
103
|
-
git_retry(*["fetch", "--force", "--quiet", "--tags", "--", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
104
|
-
end
|
98
|
+
git_remote_fetch(unshallow_needed ? ["--unshallow"] : depth_args)
|
105
99
|
end
|
106
100
|
|
107
101
|
def copy_to(destination, submodules = false)
|
108
|
-
# method 1
|
109
102
|
unless File.exist?(destination.join(".git"))
|
110
103
|
begin
|
111
104
|
SharedHelpers.filesystem_access(destination.dirname) do |p|
|
@@ -114,7 +107,7 @@ module Bundler
|
|
114
107
|
SharedHelpers.filesystem_access(destination) do |p|
|
115
108
|
FileUtils.rm_rf(p)
|
116
109
|
end
|
117
|
-
|
110
|
+
git "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
|
118
111
|
File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
|
119
112
|
rescue Errno::EEXIST => e
|
120
113
|
file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
|
@@ -123,14 +116,10 @@ module Bundler
|
|
123
116
|
"this file and try again."
|
124
117
|
end
|
125
118
|
end
|
126
|
-
# method 2
|
127
|
-
git_retry "fetch", "--force", "--quiet", "--tags", path.to_s, :dir => destination
|
128
119
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
raise MissingGitRevisionError.new(e.command, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
|
133
|
-
end
|
120
|
+
git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref
|
121
|
+
|
122
|
+
git "reset", "--hard", @revision, :dir => destination
|
134
123
|
|
135
124
|
if submodules
|
136
125
|
git_retry "submodule", "update", "--init", "--recursive", :dir => destination
|
@@ -142,14 +131,103 @@ module Bundler
|
|
142
131
|
|
143
132
|
private
|
144
133
|
|
145
|
-
def
|
146
|
-
|
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)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def clone_needs_extra_fetch?
|
151
|
+
return true if path.exist?
|
152
|
+
|
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
|
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
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
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}"
|
207
|
+
end
|
147
208
|
|
148
|
-
|
149
|
-
|
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}"
|
150
216
|
end
|
217
|
+
end
|
218
|
+
|
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
|
151
226
|
|
152
|
-
|
227
|
+
def git_null(*command, dir: nil)
|
228
|
+
check_allowed(command)
|
229
|
+
|
230
|
+
capture(command, dir, :ignore_err => true)
|
153
231
|
end
|
154
232
|
|
155
233
|
def git_retry(*command, dir: nil)
|
@@ -163,49 +241,62 @@ module Bundler
|
|
163
241
|
def git(*command, dir: nil)
|
164
242
|
command_with_no_credentials = check_allowed(command)
|
165
243
|
|
166
|
-
out, status =
|
167
|
-
capture_and_filter_stderr(*capture3_args_for(command, dir))
|
168
|
-
end
|
244
|
+
out, err, status = capture(command, dir)
|
169
245
|
|
170
|
-
|
246
|
+
raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, err) unless status.success?
|
171
247
|
|
172
|
-
|
248
|
+
Bundler.ui.warn err unless err.empty?
|
173
249
|
|
174
|
-
|
250
|
+
out
|
175
251
|
end
|
176
252
|
|
177
253
|
def has_revision_cached?
|
178
|
-
return unless @revision
|
179
|
-
|
254
|
+
return unless @revision && path.exist?
|
255
|
+
git("cat-file", "-e", @revision, :dir => path)
|
180
256
|
true
|
181
257
|
rescue GitError
|
182
258
|
false
|
183
259
|
end
|
184
260
|
|
185
|
-
def
|
186
|
-
|
261
|
+
def find_local_revision
|
262
|
+
return head_revision if explicit_ref.nil?
|
263
|
+
|
264
|
+
find_revision_for(explicit_ref)
|
187
265
|
end
|
188
266
|
|
189
|
-
def
|
190
|
-
|
191
|
-
|
192
|
-
|
267
|
+
def head_revision
|
268
|
+
verify("HEAD")
|
269
|
+
end
|
270
|
+
|
271
|
+
def find_revision_for(reference)
|
272
|
+
verify(reference)
|
193
273
|
rescue GitCommandError => e
|
194
|
-
raise MissingGitRevisionError.new(e.command, path,
|
274
|
+
raise MissingGitRevisionError.new(e.command, path, reference, credential_filtered_uri)
|
275
|
+
end
|
276
|
+
|
277
|
+
def verify(reference)
|
278
|
+
git("rev-parse", "--verify", reference, :dir => path).strip
|
195
279
|
end
|
196
280
|
|
197
|
-
# Adds credentials to the URI
|
198
|
-
def
|
199
|
-
if /https
|
281
|
+
# Adds credentials to the URI
|
282
|
+
def configured_uri
|
283
|
+
if /https?:/.match?(uri)
|
200
284
|
remote = Bundler::URI(uri)
|
201
285
|
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
202
286
|
remote.userinfo ||= config_auth
|
203
287
|
remote.to_s
|
288
|
+
elsif File.exist?(uri)
|
289
|
+
"file://#{uri}"
|
204
290
|
else
|
205
|
-
uri
|
291
|
+
uri.to_s
|
206
292
|
end
|
207
293
|
end
|
208
294
|
|
295
|
+
# Removes credentials from the URI
|
296
|
+
def credential_filtered_uri
|
297
|
+
URICredentialsFilter.credential_filtered_uri(uri)
|
298
|
+
end
|
299
|
+
|
209
300
|
def allow?
|
210
301
|
allowed = @git ? @git.allow_git_ops? : true
|
211
302
|
|
@@ -231,17 +322,17 @@ module Bundler
|
|
231
322
|
command_with_no_credentials
|
232
323
|
end
|
233
324
|
|
234
|
-
def
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
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
|
240
332
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
[return_value, status]
|
333
|
+
filtered_err = URICredentialsFilter.credential_filtered_string(err, uri)
|
334
|
+
[filtered_out, filtered_err, status]
|
335
|
+
end
|
245
336
|
end
|
246
337
|
|
247
338
|
def capture3_args_for(cmd, dir)
|
@@ -254,9 +345,44 @@ module Bundler
|
|
254
345
|
end
|
255
346
|
end
|
256
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
|
+
|
257
375
|
def supports_minus_c?
|
258
376
|
@supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
|
259
377
|
end
|
378
|
+
|
379
|
+
def supports_fetching_unreachable_refs?
|
380
|
+
@supports_fetching_unreachable_refs ||= Gem::Version.new(version) >= Gem::Version.new("2.5.0")
|
381
|
+
end
|
382
|
+
|
383
|
+
def supports_cloning_with_no_tags?
|
384
|
+
@supports_cloning_with_no_tags ||= Gem::Version.new(version) >= Gem::Version.new("2.14.0-rc0")
|
385
|
+
end
|
260
386
|
end
|
261
387
|
end
|
262
388
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -64,7 +64,7 @@ module Bundler
|
|
64
64
|
at = if local?
|
65
65
|
path
|
66
66
|
elsif user_ref = options["ref"]
|
67
|
-
if
|
67
|
+
if /\A[a-z0-9]{4,}\z/i.match?(ref)
|
68
68
|
shortref_for_display(user_ref)
|
69
69
|
else
|
70
70
|
user_ref
|
@@ -72,7 +72,7 @@ module Bundler
|
|
72
72
|
elsif ref
|
73
73
|
ref
|
74
74
|
else
|
75
|
-
|
75
|
+
current_branch
|
76
76
|
end
|
77
77
|
|
78
78
|
rev = "at #{at}@#{shortref_for_display(revision)}"
|
@@ -102,13 +102,7 @@ module Bundler
|
|
102
102
|
@install_path ||= begin
|
103
103
|
git_scope = "#{base_name}-#{shortref_for_path(revision)}"
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
if !path.exist? && Bundler.requires_sudo?
|
108
|
-
Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope)
|
109
|
-
else
|
110
|
-
path
|
111
|
-
end
|
105
|
+
Bundler.install_path.join(git_scope)
|
112
106
|
end
|
113
107
|
end
|
114
108
|
|
@@ -132,7 +126,7 @@ module Bundler
|
|
132
126
|
path = Pathname.new(path)
|
133
127
|
path = path.expand_path(Bundler.root) unless path.relative?
|
134
128
|
|
135
|
-
unless
|
129
|
+
unless branch || Bundler.settings[:disable_local_branch_check]
|
136
130
|
raise GitError, "Cannot use local override for #{name} at #{path} because " \
|
137
131
|
":branch is not specified in Gemfile. Specify a branch or run " \
|
138
132
|
"`bundle config unset local.#{override_for(original_path)}` to remove the local override"
|
@@ -147,14 +141,14 @@ module Bundler
|
|
147
141
|
|
148
142
|
# Create a new git proxy without the cached revision
|
149
143
|
# so the Gemfile.lock always picks up the new revision.
|
150
|
-
@git_proxy = GitProxy.new(path, uri,
|
144
|
+
@git_proxy = GitProxy.new(path, uri, options)
|
151
145
|
|
152
|
-
if
|
146
|
+
if current_branch != branch && !Bundler.settings[:disable_local_branch_check]
|
153
147
|
raise GitError, "Local override for #{name} at #{path} is using branch " \
|
154
|
-
"#{
|
148
|
+
"#{current_branch} but Gemfile specifies #{branch}"
|
155
149
|
end
|
156
150
|
|
157
|
-
changed = cached_revision && cached_revision !=
|
151
|
+
changed = cached_revision && cached_revision != revision
|
158
152
|
|
159
153
|
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(cached_revision)
|
160
154
|
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \
|
@@ -181,7 +175,7 @@ module Bundler
|
|
181
175
|
def install(spec, options = {})
|
182
176
|
force = options[:force]
|
183
177
|
|
184
|
-
print_using_message "Using #{version_message(spec)} from #{self}"
|
178
|
+
print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
|
185
179
|
|
186
180
|
if (requires_checkout? && !@copied) || force
|
187
181
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
@@ -219,13 +213,11 @@ module Bundler
|
|
219
213
|
# across different projects, this cache will be shared.
|
220
214
|
# When using local git repos, this is set to the local repo.
|
221
215
|
def cache_path
|
222
|
-
@cache_path ||=
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
end.join("git", git_scope)
|
228
|
-
end
|
216
|
+
@cache_path ||= if Bundler.feature_flag.global_gem_cache?
|
217
|
+
Bundler.user_cache
|
218
|
+
else
|
219
|
+
Bundler.bundle_path.join("cache", "bundler")
|
220
|
+
end.join("git", git_scope)
|
229
221
|
end
|
230
222
|
|
231
223
|
def app_cache_dirname
|
@@ -236,6 +228,10 @@ module Bundler
|
|
236
228
|
git_proxy.revision
|
237
229
|
end
|
238
230
|
|
231
|
+
def current_branch
|
232
|
+
git_proxy.current_branch
|
233
|
+
end
|
234
|
+
|
239
235
|
def allow_git_ops?
|
240
236
|
@allow_remote || @allow_cached
|
241
237
|
end
|
@@ -299,7 +295,7 @@ module Bundler
|
|
299
295
|
end
|
300
296
|
|
301
297
|
def uri_hash
|
302
|
-
if
|
298
|
+
if %r{^\w+://(\w+@)?}.match?(uri)
|
303
299
|
# Downcase the domain component of the URI
|
304
300
|
# and strip off a trailing slash, if one is present
|
305
301
|
input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
@@ -321,7 +317,7 @@ module Bundler
|
|
321
317
|
end
|
322
318
|
|
323
319
|
def git_proxy
|
324
|
-
@git_proxy ||= GitProxy.new(cache_path, uri,
|
320
|
+
@git_proxy ||= GitProxy.new(cache_path, uri, options, cached_revision, self)
|
325
321
|
end
|
326
322
|
|
327
323
|
def fetch
|
@@ -336,7 +332,7 @@ module Bundler
|
|
336
332
|
|
337
333
|
def load_gemspec(file)
|
338
334
|
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
339
|
-
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
335
|
+
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap {|x| x.untaint if RUBY_VERSION < "2.7" }
|
340
336
|
StubSpecification.from_stub(stub)
|
341
337
|
end
|
342
338
|
|
@@ -5,7 +5,7 @@ module Bundler
|
|
5
5
|
class Metadata < Source
|
6
6
|
def specs
|
7
7
|
@specs ||= Index.build do |idx|
|
8
|
-
idx << Gem::Specification.new("Ruby\0",
|
8
|
+
idx << Gem::Specification.new("Ruby\0", Gem.ruby_version)
|
9
9
|
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.default
|
11
11
|
end
|
@@ -15,7 +15,6 @@ module Bundler
|
|
15
15
|
s.version = VERSION
|
16
16
|
s.license = "MIT"
|
17
17
|
s.platform = Gem::Platform::RUBY
|
18
|
-
s.source = self
|
19
18
|
s.authors = ["bundler team"]
|
20
19
|
s.bindir = "exe"
|
21
20
|
s.homepage = "https://bundler.io"
|
@@ -18,13 +18,7 @@ module Bundler
|
|
18
18
|
@build_args = options[:build_args] || Bundler.rubygems.build_args
|
19
19
|
@gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin"
|
20
20
|
@disable_extensions = options[:disable_extensions]
|
21
|
-
|
22
|
-
if Bundler.requires_sudo?
|
23
|
-
@tmp_dir = Bundler.tmp(spec.full_name).to_s
|
24
|
-
@bin_dir = "#{@tmp_dir}/bin"
|
25
|
-
else
|
26
|
-
@bin_dir = @gem_bin_dir
|
27
|
-
end
|
21
|
+
@bin_dir = @gem_bin_dir
|
28
22
|
end
|
29
23
|
|
30
24
|
def post_install
|
@@ -38,25 +32,10 @@ module Bundler
|
|
38
32
|
generate_bin unless spec.executables.empty?
|
39
33
|
|
40
34
|
run_hooks(:post_install)
|
41
|
-
ensure
|
42
|
-
Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo?
|
43
35
|
end
|
44
36
|
|
45
37
|
private
|
46
38
|
|
47
|
-
def generate_bin
|
48
|
-
super
|
49
|
-
|
50
|
-
if Bundler.requires_sudo?
|
51
|
-
SharedHelpers.filesystem_access(@gem_bin_dir) do |p|
|
52
|
-
Bundler.mkdir_p(p)
|
53
|
-
end
|
54
|
-
spec.executables.each do |exe|
|
55
|
-
Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
39
|
def run_hooks(type)
|
61
40
|
hooks_meth = "#{type}_hooks"
|
62
41
|
return unless Gem.respond_to?(hooks_meth)
|
data/lib/bundler/source/path.rb
CHANGED
@@ -82,7 +82,7 @@ module Bundler
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def install(spec, options = {})
|
85
|
-
using_message = "Using #{version_message(spec)} from #{self}"
|
85
|
+
using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
|
86
86
|
using_message += " and installing its executables" unless spec.executables.empty?
|
87
87
|
print_using_message using_message
|
88
88
|
generate_bin(spec, :disable_extensions => true)
|
@@ -224,13 +224,13 @@ module Bundler
|
|
224
224
|
|
225
225
|
# Some gem authors put absolute paths in their gemspec
|
226
226
|
# and we have to save them from themselves
|
227
|
-
spec.files = spec.files.map do |
|
228
|
-
next
|
229
|
-
next if File.directory?(
|
227
|
+
spec.files = spec.files.map do |path|
|
228
|
+
next path unless /\A#{Pathname::SEPARATOR_PAT}/.match?(path)
|
229
|
+
next if File.directory?(path)
|
230
230
|
begin
|
231
|
-
Pathname.new(
|
231
|
+
Pathname.new(path).relative_path_from(gem_dir).to_s
|
232
232
|
rescue ArgumentError
|
233
|
-
|
233
|
+
path
|
234
234
|
end
|
235
235
|
end.compact
|
236
236
|
|