bundler 2.5.22 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +83 -0
- data/bundler.gemspec +2 -2
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/add.rb +2 -0
- data/lib/bundler/cli/check.rb +2 -2
- data/lib/bundler/cli/console.rb +0 -4
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +1 -0
- data/lib/bundler/cli/gem.rb +1 -1
- data/lib/bundler/cli/info.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +4 -0
- data/lib/bundler/cli/lock.rb +20 -1
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli.rb +23 -53
- data/lib/bundler/compact_index_client/cache_file.rb +0 -5
- data/lib/bundler/compact_index_client/updater.rb +0 -11
- data/lib/bundler/definition.rb +143 -76
- data/lib/bundler/dependency.rb +1 -1
- data/lib/bundler/dsl.rb +33 -28
- data/lib/bundler/endpoint_specification.rb +10 -1
- data/lib/bundler/errors.rb +10 -0
- data/lib/bundler/feature_flag.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +1 -1
- data/lib/bundler/fetcher.rb +10 -3
- data/lib/bundler/gem_helpers.rb +21 -5
- data/lib/bundler/injector.rb +2 -2
- data/lib/bundler/inline.rb +12 -8
- data/lib/bundler/installer/standalone.rb +2 -2
- data/lib/bundler/installer.rb +4 -38
- data/lib/bundler/lazy_specification.rb +74 -26
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +9 -1
- data/lib/bundler/man/bundle-add.1 +17 -11
- data/lib/bundler/man/bundle-add.1.ronn +16 -10
- data/lib/bundler/man/bundle-binstubs.1 +7 -4
- data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
- data/lib/bundler/man/bundle-cache.1 +30 -2
- data/lib/bundler/man/bundle-cache.1.ronn +31 -2
- data/lib/bundler/man/bundle-check.1 +3 -3
- data/lib/bundler/man/bundle-check.1.ronn +4 -2
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +3 -5
- data/lib/bundler/man/bundle-config.1.ronn +2 -7
- data/lib/bundler/man/bundle-console.1 +2 -4
- data/lib/bundler/man/bundle-console.1.ronn +2 -7
- data/lib/bundler/man/bundle-doctor.1 +2 -2
- data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/lib/bundler/man/bundle-exec.1 +5 -2
- data/lib/bundler/man/bundle-exec.1.ronn +4 -1
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +17 -5
- data/lib/bundler/man/bundle-gem.1.ronn +27 -6
- data/lib/bundler/man/bundle-help.1 +1 -1
- data/lib/bundler/man/bundle-info.1 +5 -2
- data/lib/bundler/man/bundle-info.1.ronn +6 -2
- data/lib/bundler/man/bundle-init.1 +3 -3
- data/lib/bundler/man/bundle-init.1.ronn +3 -2
- data/lib/bundler/man/bundle-inject.1 +10 -2
- data/lib/bundler/man/bundle-inject.1.ronn +9 -1
- data/lib/bundler/man/bundle-install.1 +15 -12
- data/lib/bundler/man/bundle-install.1.ronn +22 -18
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-list.1.ronn +4 -1
- data/lib/bundler/man/bundle-lock.1 +21 -6
- data/lib/bundler/man/bundle-lock.1.ronn +25 -4
- data/lib/bundler/man/bundle-open.1 +2 -2
- data/lib/bundler/man/bundle-open.1.ronn +2 -1
- data/lib/bundler/man/bundle-outdated.1 +8 -5
- data/lib/bundler/man/bundle-outdated.1.ronn +8 -4
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-plugin.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-remove.1.ronn +1 -1
- data/lib/bundler/man/bundle-show.1 +5 -2
- data/lib/bundler/man/bundle-show.1.ronn +4 -0
- data/lib/bundler/man/bundle-update.1 +13 -7
- data/lib/bundler/man/bundle-update.1.ronn +14 -6
- data/lib/bundler/man/bundle-version.1 +1 -1
- data/lib/bundler/man/bundle-viz.1 +4 -4
- data/lib/bundler/man/bundle-viz.1.ronn +7 -3
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +1 -1
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/plugin/events.rb +24 -0
- data/lib/bundler/plugin/installer.rb +1 -1
- data/lib/bundler/plugin.rb +20 -1
- data/lib/bundler/process_lock.rb +10 -14
- data/lib/bundler/remote_specification.rb +6 -1
- data/lib/bundler/resolver/base.rb +6 -6
- data/lib/bundler/resolver/candidate.rb +2 -2
- data/lib/bundler/resolver/spec_group.rb +4 -3
- data/lib/bundler/resolver.rb +5 -5
- data/lib/bundler/rubygems_ext.rb +30 -27
- data/lib/bundler/rubygems_gem_installer.rb +3 -2
- data/lib/bundler/rubygems_integration.rb +23 -40
- data/lib/bundler/runtime.rb +27 -7
- data/lib/bundler/self_manager.rb +2 -3
- data/lib/bundler/settings.rb +6 -1
- data/lib/bundler/shared_helpers.rb +29 -17
- data/lib/bundler/source/git/git_proxy.rb +0 -6
- data/lib/bundler/source/git.rb +56 -31
- data/lib/bundler/source/metadata.rb +2 -3
- data/lib/bundler/source/path.rb +2 -2
- data/lib/bundler/source_list.rb +1 -1
- data/lib/bundler/spec_set.rb +81 -56
- data/lib/bundler/stub_specification.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +0 -3
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
- data/lib/bundler/uri_credentials_filter.rb +1 -1
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
- data/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
- 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 +11 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +37 -16
- data/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
- data/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +9 -9
- data/lib/bundler/vendored_securerandom.rb +0 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +38 -14
- metadata +18 -12
- data/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
- data/lib/bundler/vendor/securerandom/LICENSE.txt +0 -22
- data/lib/bundler/vendor/securerandom/lib/random/formatter.rb +0 -373
- data/lib/bundler/vendor/uri/LICENSE.txt +0 -22
@@ -23,7 +23,9 @@ module Bundler
|
|
23
23
|
FileUtils.mkdir_p gem_dir, mode: 0o755
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
SharedHelpers.filesystem_access(gem_dir, :write) do
|
27
|
+
extract_files
|
28
|
+
end
|
27
29
|
|
28
30
|
build_extensions if spec.extensions.any?
|
29
31
|
write_build_info_file
|
@@ -145,7 +147,6 @@ module Bundler
|
|
145
147
|
SharedHelpers.filesystem_access(extension_dir, :create) do
|
146
148
|
FileUtils.mkdir_p extension_dir
|
147
149
|
end
|
148
|
-
require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
|
149
150
|
end
|
150
151
|
|
151
152
|
def strict_rm_rf(dir)
|
@@ -20,10 +20,6 @@ module Bundler
|
|
20
20
|
Gem::Requirement.new(req_str).satisfied_by?(version)
|
21
21
|
end
|
22
22
|
|
23
|
-
def supports_bundler_trampolining?
|
24
|
-
provides?(">= 3.3.0.a")
|
25
|
-
end
|
26
|
-
|
27
23
|
def build_args
|
28
24
|
require "rubygems/command"
|
29
25
|
Gem::Command.build_args
|
@@ -34,6 +30,10 @@ module Bundler
|
|
34
30
|
Gem::Command.build_args = args
|
35
31
|
end
|
36
32
|
|
33
|
+
def set_target_rbconfig(path)
|
34
|
+
Gem.set_target_rbconfig(path)
|
35
|
+
end
|
36
|
+
|
37
37
|
def loaded_specs(name)
|
38
38
|
Gem.loaded_specs[name]
|
39
39
|
end
|
@@ -134,6 +134,18 @@ module Bundler
|
|
134
134
|
loaded_gem_paths.flatten
|
135
135
|
end
|
136
136
|
|
137
|
+
def load_plugins
|
138
|
+
Gem.load_plugins
|
139
|
+
end
|
140
|
+
|
141
|
+
def load_plugin_files(plugin_files)
|
142
|
+
Gem.load_plugin_files(plugin_files)
|
143
|
+
end
|
144
|
+
|
145
|
+
def load_env_plugins
|
146
|
+
Gem.load_env_plugins
|
147
|
+
end
|
148
|
+
|
137
149
|
def ui=(obj)
|
138
150
|
Gem::DefaultUserInteraction.ui = obj
|
139
151
|
end
|
@@ -220,9 +232,7 @@ module Bundler
|
|
220
232
|
end
|
221
233
|
end
|
222
234
|
|
223
|
-
# Used to
|
224
|
-
# under bundler. The new Gem.bin_path only considers gems in
|
225
|
-
# +specs+
|
235
|
+
# Used to give better error messages when activating specs outside of the current bundle
|
226
236
|
def replace_bin_path(specs_by_name)
|
227
237
|
gem_class = (class << Gem; self; end)
|
228
238
|
|
@@ -261,31 +271,6 @@ module Bundler
|
|
261
271
|
|
262
272
|
spec
|
263
273
|
end
|
264
|
-
|
265
|
-
redefine_method(gem_class, :activate_bin_path) do |name, *args|
|
266
|
-
exec_name = args.first
|
267
|
-
return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
|
268
|
-
|
269
|
-
# Copy of Rubygems activate_bin_path impl
|
270
|
-
requirement = args.last
|
271
|
-
spec = find_spec_for_exe name, exec_name, [requirement]
|
272
|
-
|
273
|
-
gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
|
274
|
-
gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
|
275
|
-
File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
|
276
|
-
end
|
277
|
-
|
278
|
-
redefine_method(gem_class, :bin_path) do |name, *args|
|
279
|
-
exec_name = args.first
|
280
|
-
return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle"
|
281
|
-
|
282
|
-
spec = find_spec_for_exe(name, *args)
|
283
|
-
exec_name ||= spec.default_executable
|
284
|
-
|
285
|
-
gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name)
|
286
|
-
gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name)
|
287
|
-
File.exist?(gem_bin) ? gem_bin : gem_from_path_bin
|
288
|
-
end
|
289
274
|
end
|
290
275
|
|
291
276
|
# Replace or hook into RubyGems to provide a bundlerized view
|
@@ -302,7 +287,7 @@ module Bundler
|
|
302
287
|
Gem::BUNDLED_GEMS.replace_require(specs) if Gem::BUNDLED_GEMS.respond_to?(:replace_require)
|
303
288
|
end
|
304
289
|
replace_gem(specs, specs_by_name)
|
305
|
-
stub_rubygems(
|
290
|
+
stub_rubygems(specs_by_name.values)
|
306
291
|
replace_bin_path(specs_by_name)
|
307
292
|
|
308
293
|
Gem.clear_paths
|
@@ -331,11 +316,7 @@ module Bundler
|
|
331
316
|
@replaced_methods.each do |(sym, klass), method|
|
332
317
|
redefine_method(klass, sym, method)
|
333
318
|
end
|
334
|
-
|
335
|
-
post_reset_hooks.reject! {|proc| proc.binding.source_location[0] == __FILE__ }
|
336
|
-
else
|
337
|
-
post_reset_hooks.reject! {|proc| proc.binding.eval("__FILE__") == __FILE__ }
|
338
|
-
end
|
319
|
+
post_reset_hooks.reject! {|proc| proc.binding.source_location[0] == __FILE__ }
|
339
320
|
@replaced_methods.clear
|
340
321
|
end
|
341
322
|
|
@@ -412,7 +393,9 @@ module Bundler
|
|
412
393
|
def download_gem(spec, uri, cache_dir, fetcher)
|
413
394
|
require "rubygems/remote_fetcher"
|
414
395
|
uri = Bundler.settings.mirror_for(uri)
|
415
|
-
|
396
|
+
redacted_uri = Gem::Uri.redact(uri)
|
397
|
+
|
398
|
+
Bundler::Retry.new("download gem from #{redacted_uri}").attempts do
|
416
399
|
gem_file_name = spec.file_name
|
417
400
|
local_gem_path = File.join cache_dir, gem_file_name
|
418
401
|
return if File.exist? local_gem_path
|
@@ -434,7 +417,7 @@ module Bundler
|
|
434
417
|
end
|
435
418
|
end
|
436
419
|
rescue Gem::RemoteFetcher::FetchError => e
|
437
|
-
raise Bundler::HTTPError, "Could not download gem from #{
|
420
|
+
raise Bundler::HTTPError, "Could not download gem from #{redacted_uri} due to underlying error <#{e.message}>"
|
438
421
|
end
|
439
422
|
|
440
423
|
def build(spec, skip_validation = false)
|
data/lib/bundler/runtime.rb
CHANGED
@@ -41,12 +41,17 @@ module Bundler
|
|
41
41
|
groups.map!(&:to_sym)
|
42
42
|
groups = [:default] if groups.empty?
|
43
43
|
|
44
|
-
@definition.dependencies.
|
45
|
-
#
|
46
|
-
#
|
47
|
-
|
44
|
+
dependencies = @definition.dependencies.select do |dep|
|
45
|
+
# Select the dependency if it is in any of the requested groups, and
|
46
|
+
# for the current platform, and matches the gem constraints.
|
47
|
+
(dep.groups & groups).any? && dep.should_include?
|
48
|
+
end
|
49
|
+
|
50
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE_ALL, dependencies)
|
48
51
|
|
52
|
+
dependencies.each do |dep|
|
49
53
|
required_file = nil
|
54
|
+
Plugin.hook(Plugin::Events::GEM_BEFORE_REQUIRE, dep)
|
50
55
|
|
51
56
|
begin
|
52
57
|
# Loop through all the specified autorequires for the
|
@@ -76,7 +81,13 @@ module Bundler
|
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
84
|
+
|
85
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE, dep)
|
79
86
|
end
|
87
|
+
|
88
|
+
Plugin.hook(Plugin::Events::GEM_AFTER_REQUIRE_ALL, dependencies)
|
89
|
+
|
90
|
+
dependencies
|
80
91
|
end
|
81
92
|
|
82
93
|
def self.definition_method(meth)
|
@@ -125,7 +136,16 @@ module Bundler
|
|
125
136
|
specs_to_cache.each do |spec|
|
126
137
|
next if spec.name == "bundler"
|
127
138
|
next if spec.source.is_a?(Source::Gemspec)
|
128
|
-
|
139
|
+
if spec.source.respond_to?(:migrate_cache)
|
140
|
+
spec.source.migrate_cache(custom_path, local: local)
|
141
|
+
elsif spec.source.respond_to?(:cache)
|
142
|
+
spec.source.cache(spec, custom_path)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
Dir[cache_path.join("*/.git")].each do |git_dir|
|
147
|
+
FileUtils.rm_rf(git_dir)
|
148
|
+
FileUtils.touch(File.expand_path("../.bundlecache", git_dir))
|
129
149
|
end
|
130
150
|
|
131
151
|
prune_cache(cache_path) unless Bundler.settings[:no_prune]
|
@@ -252,10 +272,10 @@ module Bundler
|
|
252
272
|
|
253
273
|
def setup_manpath
|
254
274
|
# Add man/ subdirectories from activated bundles to MANPATH for man(1)
|
255
|
-
manuals = $LOAD_PATH.
|
275
|
+
manuals = $LOAD_PATH.filter_map do |path|
|
256
276
|
man_subdir = path.sub(/lib$/, "man")
|
257
277
|
man_subdir unless Dir[man_subdir + "/man?/"].empty?
|
258
|
-
end
|
278
|
+
end
|
259
279
|
|
260
280
|
return if manuals.empty?
|
261
281
|
Bundler::SharedHelpers.set_env "MANPATH", manuals.concat(
|
data/lib/bundler/self_manager.rb
CHANGED
@@ -84,8 +84,8 @@ module Bundler
|
|
84
84
|
require "shellwords"
|
85
85
|
cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
|
86
86
|
else
|
87
|
-
cmd = [
|
88
|
-
cmd.unshift(Gem.ruby) unless File.executable?(
|
87
|
+
cmd = [Process.argv0, *ARGV]
|
88
|
+
cmd.unshift(Gem.ruby) unless File.executable?(Process.argv0)
|
89
89
|
end
|
90
90
|
|
91
91
|
Bundler.with_original_env do
|
@@ -106,7 +106,6 @@ module Bundler
|
|
106
106
|
|
107
107
|
def autoswitching_applies?
|
108
108
|
ENV["BUNDLER_VERSION"].nil? &&
|
109
|
-
Bundler.rubygems.supports_bundler_trampolining? &&
|
110
109
|
ruby_can_restart_with_same_arguments? &&
|
111
110
|
SharedHelpers.in_bundle? &&
|
112
111
|
lockfile_version
|
data/lib/bundler/settings.rb
CHANGED
@@ -32,6 +32,7 @@ module Bundler
|
|
32
32
|
ignore_messages
|
33
33
|
init_gems_rb
|
34
34
|
inline
|
35
|
+
lockfile_checksums
|
35
36
|
no_install
|
36
37
|
no_prune
|
37
38
|
path_relative_to_cwd
|
@@ -425,8 +426,12 @@ module Bundler
|
|
425
426
|
Validator.validate!(raw_key, converted_value(value, raw_key), hash)
|
426
427
|
|
427
428
|
return unless file
|
429
|
+
|
430
|
+
SharedHelpers.filesystem_access(file.dirname, :create) do |p|
|
431
|
+
FileUtils.mkdir_p(p)
|
432
|
+
end
|
433
|
+
|
428
434
|
SharedHelpers.filesystem_access(file) do |p|
|
429
|
-
FileUtils.mkdir_p(p.dirname)
|
430
435
|
p.open("w") {|f| f.write(serializer_class.dump(hash)) }
|
431
436
|
end
|
432
437
|
end
|
@@ -96,14 +96,16 @@ module Bundler
|
|
96
96
|
# given block
|
97
97
|
#
|
98
98
|
# @example
|
99
|
-
# filesystem_access("vendor/cache", :
|
99
|
+
# filesystem_access("vendor/cache", :create) do
|
100
100
|
# FileUtils.mkdir_p("vendor/cache")
|
101
101
|
# end
|
102
102
|
#
|
103
103
|
# @see {Bundler::PermissionError}
|
104
104
|
def filesystem_access(path, action = :write, &block)
|
105
105
|
yield(path.dup)
|
106
|
-
rescue Errno::EACCES
|
106
|
+
rescue Errno::EACCES => e
|
107
|
+
raise unless e.message.include?(path.to_s) || action == :create
|
108
|
+
|
107
109
|
raise PermissionError.new(path, action)
|
108
110
|
rescue Errno::EAGAIN
|
109
111
|
raise TemporaryResourceError.new(path, action)
|
@@ -116,7 +118,7 @@ module Bundler
|
|
116
118
|
rescue Errno::EEXIST, Errno::ENOENT
|
117
119
|
raise
|
118
120
|
rescue SystemCallError => e
|
119
|
-
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
|
121
|
+
raise GenericSystemCallError.new(e, "There was an error #{[:create, :write].include?(action) ? "creating" : "accessing"} `#{path}`.")
|
120
122
|
end
|
121
123
|
|
122
124
|
def major_deprecation(major_version, message, removed_message: nil, print_caller_location: false)
|
@@ -160,10 +162,10 @@ module Bundler
|
|
160
162
|
extra_deps = new_deps - old_deps
|
161
163
|
return if extra_deps.empty?
|
162
164
|
|
163
|
-
Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has
|
165
|
+
Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has corrupted API dependencies" \
|
164
166
|
" (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
|
165
167
|
raise APIResponseMismatchError,
|
166
|
-
"Downloading #{spec.full_name} revealed dependencies not in the API
|
168
|
+
"Downloading #{spec.full_name} revealed dependencies not in the API (#{extra_deps.join(", ")})." \
|
167
169
|
"\nRunning `bundle update #{spec.name}` should fix the problem."
|
168
170
|
end
|
169
171
|
|
@@ -274,15 +276,7 @@ module Bundler
|
|
274
276
|
until !File.directory?(current) || current == previous
|
275
277
|
if ENV["BUNDLER_SPEC_RUN"]
|
276
278
|
# avoid stepping above the tmp directory when testing
|
277
|
-
|
278
|
-
# for Ruby Core
|
279
|
-
"lib/bundler/bundler.gemspec"
|
280
|
-
else
|
281
|
-
"bundler.gemspec"
|
282
|
-
end
|
283
|
-
|
284
|
-
# avoid stepping above the tmp directory when testing
|
285
|
-
return nil if File.file?(File.join(current, gemspec))
|
279
|
+
return nil if File.directory?(File.join(current, "tmp"))
|
286
280
|
end
|
287
281
|
|
288
282
|
names.each do |name|
|
@@ -314,18 +308,36 @@ module Bundler
|
|
314
308
|
|
315
309
|
def bundle_bin_path
|
316
310
|
# bundler exe & lib folders have same root folder, typical gem installation
|
317
|
-
exe_file = File.
|
311
|
+
exe_file = File.join(source_root, "exe/bundle")
|
318
312
|
|
319
313
|
# for Ruby core repository testing
|
320
|
-
exe_file = File.
|
314
|
+
exe_file = File.join(source_root, "libexec/bundle") unless File.exist?(exe_file)
|
321
315
|
|
322
316
|
# bundler is a default gem, exe path is separate
|
323
|
-
exe_file =
|
317
|
+
exe_file = Gem.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
|
324
318
|
|
325
319
|
exe_file
|
326
320
|
end
|
327
321
|
public :bundle_bin_path
|
328
322
|
|
323
|
+
def gemspec_path
|
324
|
+
# inside a gem repository, typical gem installation
|
325
|
+
gemspec_file = File.join(source_root, "../../specifications/bundler-#{VERSION}.gemspec")
|
326
|
+
|
327
|
+
# for Ruby core repository testing
|
328
|
+
gemspec_file = File.expand_path("bundler.gemspec", __dir__) unless File.exist?(gemspec_file)
|
329
|
+
|
330
|
+
# bundler is a default gem
|
331
|
+
gemspec_file = File.join(Gem.default_specifications_dir, "bundler-#{VERSION}.gemspec") unless File.exist?(gemspec_file)
|
332
|
+
|
333
|
+
gemspec_file
|
334
|
+
end
|
335
|
+
public :gemspec_path
|
336
|
+
|
337
|
+
def source_root
|
338
|
+
File.expand_path("../..", __dir__)
|
339
|
+
end
|
340
|
+
|
329
341
|
def set_path
|
330
342
|
validate_bundle_path
|
331
343
|
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
|
@@ -84,12 +84,6 @@ module Bundler
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
def not_a_repository?
|
88
|
-
_, status = git_null("rev-parse", "--resolve-git-dir", path.to_s, dir: path)
|
89
|
-
|
90
|
-
!status.success?
|
91
|
-
end
|
92
|
-
|
93
87
|
def contains?(commit)
|
94
88
|
allowed_with_path do
|
95
89
|
result, status = git_null("branch", "--contains", commit, dir: path)
|
data/lib/bundler/source/git.rb
CHANGED
@@ -102,7 +102,7 @@ module Bundler
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def identifier
|
105
|
-
uri_with_specifiers([humanized_ref,
|
105
|
+
uri_with_specifiers([humanized_ref, locked_revision, glob_for_display])
|
106
106
|
end
|
107
107
|
|
108
108
|
def uri_with_specifiers(specifiers)
|
@@ -176,10 +176,10 @@ module Bundler
|
|
176
176
|
"#{current_branch} but Gemfile specifies #{branch}"
|
177
177
|
end
|
178
178
|
|
179
|
-
changed =
|
179
|
+
changed = locked_revision && locked_revision != revision
|
180
180
|
|
181
|
-
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(
|
182
|
-
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(
|
181
|
+
if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(locked_revision)
|
182
|
+
raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(locked_revision)} " \
|
183
183
|
"but the current branch in your local override for #{name} does not contain such commit. " \
|
184
184
|
"Please make sure your branch is up to date."
|
185
185
|
end
|
@@ -188,12 +188,10 @@ module Bundler
|
|
188
188
|
end
|
189
189
|
|
190
190
|
def specs(*)
|
191
|
-
|
191
|
+
set_cache_path!(app_cache_path) if use_app_cache?
|
192
192
|
|
193
193
|
if requires_checkout? && !@copied
|
194
|
-
|
195
|
-
|
196
|
-
fetch
|
194
|
+
fetch unless use_app_cache?
|
197
195
|
checkout
|
198
196
|
end
|
199
197
|
|
@@ -216,17 +214,16 @@ module Bundler
|
|
216
214
|
requires_checkout? ? spec.post_install_message : nil
|
217
215
|
end
|
218
216
|
|
217
|
+
def migrate_cache(custom_path = nil, local: false)
|
218
|
+
if local
|
219
|
+
cache_to(custom_path, try_migrate: false)
|
220
|
+
else
|
221
|
+
cache_to(custom_path, try_migrate: true)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
219
225
|
def cache(spec, custom_path = nil)
|
220
|
-
|
221
|
-
return unless Bundler.feature_flag.cache_all?
|
222
|
-
return if install_path == app_cache_path
|
223
|
-
return if cache_path == app_cache_path
|
224
|
-
cached!
|
225
|
-
FileUtils.rm_rf(app_cache_path)
|
226
|
-
git_proxy.checkout if requires_checkout?
|
227
|
-
FileUtils.cp_r("#{cache_path}/.", app_cache_path)
|
228
|
-
FileUtils.touch(app_cache_path.join(".bundlecache"))
|
229
|
-
FileUtils.rm_rf(Dir.glob(app_cache_path.join("hooks/*.sample")))
|
226
|
+
cache_to(custom_path, try_migrate: false)
|
230
227
|
end
|
231
228
|
|
232
229
|
def load_spec_files
|
@@ -249,7 +246,7 @@ module Bundler
|
|
249
246
|
end
|
250
247
|
|
251
248
|
def app_cache_dirname
|
252
|
-
"#{base_name}-#{shortref_for_path(
|
249
|
+
"#{base_name}-#{shortref_for_path(locked_revision || revision)}"
|
253
250
|
end
|
254
251
|
|
255
252
|
def revision
|
@@ -270,9 +267,38 @@ module Bundler
|
|
270
267
|
|
271
268
|
private
|
272
269
|
|
270
|
+
def cache_to(custom_path, try_migrate: false)
|
271
|
+
return unless Bundler.feature_flag.cache_all?
|
272
|
+
|
273
|
+
app_cache_path = app_cache_path(custom_path)
|
274
|
+
|
275
|
+
migrate = try_migrate ? bare_repo?(app_cache_path) : false
|
276
|
+
|
277
|
+
set_cache_path!(nil) if migrate
|
278
|
+
|
279
|
+
return if cache_path == app_cache_path
|
280
|
+
|
281
|
+
cached!
|
282
|
+
FileUtils.rm_rf(app_cache_path)
|
283
|
+
git_proxy.checkout if migrate || requires_checkout?
|
284
|
+
git_proxy.copy_to(app_cache_path, @submodules)
|
285
|
+
end
|
286
|
+
|
273
287
|
def checkout
|
274
288
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
275
|
-
|
289
|
+
if use_app_cache? && !bare_repo?(app_cache_path)
|
290
|
+
SharedHelpers.filesystem_access(install_path.dirname) do |p|
|
291
|
+
FileUtils.mkdir_p(p)
|
292
|
+
end
|
293
|
+
FileUtils.cp_r("#{app_cache_path}/.", install_path)
|
294
|
+
else
|
295
|
+
if use_app_cache? && bare_repo?(app_cache_path)
|
296
|
+
Bundler.ui.warn "Installing from cache in old \"bare repository\" format for compatibility. " \
|
297
|
+
"Please run `bundle cache` and commit the updated cache to migrate to the new format and get rid of this warning."
|
298
|
+
end
|
299
|
+
|
300
|
+
git_proxy.copy_to(install_path, submodules)
|
301
|
+
end
|
276
302
|
serialize_gemspecs_in(install_path)
|
277
303
|
@copied = true
|
278
304
|
end
|
@@ -320,13 +346,8 @@ module Bundler
|
|
320
346
|
@install_path = path
|
321
347
|
end
|
322
348
|
|
323
|
-
def set_up_app_cache!(path)
|
324
|
-
FileUtils.mkdir_p(path.join("refs"))
|
325
|
-
set_cache_path!(path)
|
326
|
-
end
|
327
|
-
|
328
349
|
def has_app_cache?
|
329
|
-
|
350
|
+
locked_revision && super
|
330
351
|
end
|
331
352
|
|
332
353
|
def use_app_cache?
|
@@ -334,11 +355,11 @@ module Bundler
|
|
334
355
|
end
|
335
356
|
|
336
357
|
def requires_checkout?
|
337
|
-
allow_git_ops? && !local? && !
|
358
|
+
allow_git_ops? && !local? && !locked_revision_checked_out?
|
338
359
|
end
|
339
360
|
|
340
|
-
def
|
341
|
-
|
361
|
+
def locked_revision_checked_out?
|
362
|
+
locked_revision && locked_revision == revision && install_path.exist?
|
342
363
|
end
|
343
364
|
|
344
365
|
def base_name
|
@@ -375,7 +396,7 @@ module Bundler
|
|
375
396
|
Bundler::Digest.sha1(input)
|
376
397
|
end
|
377
398
|
|
378
|
-
def
|
399
|
+
def locked_revision
|
379
400
|
options["revision"]
|
380
401
|
end
|
381
402
|
|
@@ -384,7 +405,7 @@ module Bundler
|
|
384
405
|
end
|
385
406
|
|
386
407
|
def git_proxy
|
387
|
-
@git_proxy ||= GitProxy.new(cache_path, uri, options,
|
408
|
+
@git_proxy ||= GitProxy.new(cache_path, uri, options, locked_revision, self)
|
388
409
|
end
|
389
410
|
|
390
411
|
def fetch
|
@@ -417,6 +438,10 @@ module Bundler
|
|
417
438
|
def override_for(path)
|
418
439
|
Bundler.settings.local_overrides.key(path)
|
419
440
|
end
|
441
|
+
|
442
|
+
def bare_repo?(path)
|
443
|
+
File.exist?(path.join("objects")) && File.exist?(path.join("HEAD"))
|
444
|
+
end
|
420
445
|
end
|
421
446
|
end
|
422
447
|
end
|
@@ -24,9 +24,8 @@ module Bundler
|
|
24
24
|
s.bindir = "exe"
|
25
25
|
s.homepage = "https://bundler.io"
|
26
26
|
s.summary = "The best way to manage your application's dependencies"
|
27
|
-
s.executables = %w[bundle]
|
28
|
-
|
29
|
-
s.loaded_from = __dir__
|
27
|
+
s.executables = %w[bundle bundler]
|
28
|
+
s.loaded_from = SharedHelpers.gemspec_path
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
data/lib/bundler/source/path.rb
CHANGED
@@ -214,7 +214,7 @@ module Bundler
|
|
214
214
|
|
215
215
|
# Some gem authors put absolute paths in their gemspec
|
216
216
|
# and we have to save them from themselves
|
217
|
-
spec.files = spec.files.
|
217
|
+
spec.files = spec.files.filter_map do |path|
|
218
218
|
next path unless /\A#{Pathname::SEPARATOR_PAT}/o.match?(path)
|
219
219
|
next if File.directory?(path)
|
220
220
|
begin
|
@@ -222,7 +222,7 @@ module Bundler
|
|
222
222
|
rescue ArgumentError
|
223
223
|
path
|
224
224
|
end
|
225
|
-
end
|
225
|
+
end
|
226
226
|
|
227
227
|
installer = Path::Installer.new(
|
228
228
|
spec,
|