bundler 2.2.26 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +206 -1
- data/README.md +1 -1
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/doctor.rb +12 -3
- data/lib/bundler/cli/gem.rb +98 -9
- data/lib/bundler/cli/info.rb +26 -5
- data/lib/bundler/cli/install.rb +8 -28
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +8 -4
- data/lib/bundler/cli.rb +13 -11
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +0 -5
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/definition.rb +79 -133
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +18 -30
- data/lib/bundler/endpoint_specification.rb +21 -11
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +18 -2
- data/lib/bundler/fetcher/compact_index.rb +9 -14
- data/lib/bundler/fetcher/index.rb +0 -26
- data/lib/bundler/fetcher.rb +13 -20
- data/lib/bundler/friendly_errors.rb +5 -30
- data/lib/bundler/gem_helper.rb +7 -18
- data/lib/bundler/injector.rb +10 -1
- data/lib/bundler/installer/gem_installer.rb +1 -6
- data/lib/bundler/installer.rb +1 -5
- data/lib/bundler/lazy_specification.rb +19 -3
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +10 -12
- data/lib/bundler/man/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +5 -5
- data/lib/bundler/man/bundle-config.1.ronn +5 -5
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -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 +1 -1
- data/lib/bundler/man/bundle-install.1 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -2
- 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 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- 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 +2 -2
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/lib/bundler/plugin/api/source.rb +1 -0
- data/lib/bundler/plugin/installer.rb +3 -1
- data/lib/bundler/plugin.rb +23 -6
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +7 -0
- data/lib/bundler/resolver/spec_group.rb +1 -1
- data/lib/bundler/resolver.rb +38 -40
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +19 -10
- data/lib/bundler/rubygems_gem_installer.rb +21 -5
- data/lib/bundler/rubygems_integration.rb +40 -70
- data/lib/bundler/runtime.rb +2 -2
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +11 -2
- data/lib/bundler/shared_helpers.rb +4 -12
- data/lib/bundler/source/git/git_proxy.rb +7 -4
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/metadata.rb +1 -1
- data/lib/bundler/source/rubygems.rb +60 -85
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +3 -1
- data/lib/bundler/source_list.rb +11 -29
- data/lib/bundler/spec_set.rb +2 -2
- data/lib/bundler/templates/Executable.bundler +1 -1
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +15 -15
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/shell.rb +1 -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/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- 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 +9 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
- 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/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -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_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +2 -2
- data/lib/bundler.rb +23 -22
- metadata +25 -10
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -22
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
#
|
5
|
+
# This class handles installing and switching to the version of bundler needed
|
6
|
+
# by an application.
|
7
|
+
#
|
8
|
+
class SelfManager
|
9
|
+
def restart_with_locked_bundler_if_needed
|
10
|
+
return unless needs_switching? && installed?
|
11
|
+
|
12
|
+
restart_with(lockfile_version)
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_locked_bundler_and_restart_with_it_if_needed
|
16
|
+
return unless needs_switching?
|
17
|
+
|
18
|
+
Bundler.ui.info \
|
19
|
+
"Bundler #{current_version} is running, but your lockfile was generated with #{lockfile_version}. " \
|
20
|
+
"Installing Bundler #{lockfile_version} and restarting using that version."
|
21
|
+
|
22
|
+
install_and_restart_with(lockfile_version)
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_bundler_and_restart_with_it_if_needed(target)
|
26
|
+
return unless autoswitching_applies?
|
27
|
+
|
28
|
+
spec = resolve_update_version_from(target)
|
29
|
+
return unless spec
|
30
|
+
|
31
|
+
version = spec.version
|
32
|
+
|
33
|
+
Bundler.ui.info "Updating bundler to #{version}."
|
34
|
+
|
35
|
+
install(spec)
|
36
|
+
|
37
|
+
restart_with(version)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def install_and_restart_with(version)
|
43
|
+
requirement = Gem::Requirement.new(version)
|
44
|
+
spec = find_latest_matching_spec(requirement)
|
45
|
+
|
46
|
+
if spec.nil?
|
47
|
+
Bundler.ui.warn "Your lockfile is locked to a version of bundler (#{lockfile_version}) that doesn't exist at https://rubygems.org/. Going on using #{current_version}"
|
48
|
+
return
|
49
|
+
end
|
50
|
+
|
51
|
+
install(spec)
|
52
|
+
rescue StandardError => e
|
53
|
+
Bundler.ui.trace e
|
54
|
+
Bundler.ui.warn "There was an error installing the locked bundler version (#{lockfile_version}), rerun with the `--verbose` flag for more details. Going on using bundler #{current_version}."
|
55
|
+
else
|
56
|
+
restart_with(version)
|
57
|
+
end
|
58
|
+
|
59
|
+
def install(spec)
|
60
|
+
spec.source.install(spec)
|
61
|
+
end
|
62
|
+
|
63
|
+
def restart_with(version)
|
64
|
+
configured_gem_home = ENV["GEM_HOME"]
|
65
|
+
configured_gem_path = ENV["GEM_PATH"]
|
66
|
+
|
67
|
+
cmd = [$PROGRAM_NAME, *ARGV]
|
68
|
+
cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
|
69
|
+
|
70
|
+
Bundler.with_original_env do
|
71
|
+
Kernel.exec(
|
72
|
+
{ "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => version.to_s },
|
73
|
+
*cmd
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def needs_switching?
|
79
|
+
autoswitching_applies? &&
|
80
|
+
released?(lockfile_version) &&
|
81
|
+
!running?(lockfile_version) &&
|
82
|
+
!updating?
|
83
|
+
end
|
84
|
+
|
85
|
+
def autoswitching_applies?
|
86
|
+
ENV["BUNDLER_VERSION"].nil? &&
|
87
|
+
Bundler.rubygems.supports_bundler_trampolining? &&
|
88
|
+
SharedHelpers.in_bundle? &&
|
89
|
+
lockfile_version
|
90
|
+
end
|
91
|
+
|
92
|
+
def resolve_update_version_from(target)
|
93
|
+
requirement = Gem::Requirement.new(target)
|
94
|
+
update_candidate = find_latest_matching_spec(requirement)
|
95
|
+
|
96
|
+
if update_candidate.nil?
|
97
|
+
raise InvalidOption, "The `bundle update --bundler` target version (#{target}) does not exist"
|
98
|
+
end
|
99
|
+
|
100
|
+
resolved_version = update_candidate.version
|
101
|
+
needs_update = requirement.specific? ? !running?(resolved_version) : running_older_than?(resolved_version)
|
102
|
+
|
103
|
+
return unless needs_update
|
104
|
+
|
105
|
+
update_candidate
|
106
|
+
end
|
107
|
+
|
108
|
+
def local_specs
|
109
|
+
@local_specs ||= Bundler::Source::Rubygems.new("allow_local" => true).specs.select {|spec| spec.name == "bundler" }
|
110
|
+
end
|
111
|
+
|
112
|
+
def remote_specs
|
113
|
+
@remote_specs ||= begin
|
114
|
+
source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org")
|
115
|
+
source.remote!
|
116
|
+
source.add_dependency_names("bundler")
|
117
|
+
source.specs
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def find_latest_matching_spec(requirement)
|
122
|
+
local_result = find_latest_matching_spec_from_collection(local_specs, requirement)
|
123
|
+
return local_result if local_result && requirement.specific?
|
124
|
+
|
125
|
+
remote_result = find_latest_matching_spec_from_collection(remote_specs, requirement)
|
126
|
+
return remote_result if local_result.nil?
|
127
|
+
|
128
|
+
[local_result, remote_result].max
|
129
|
+
end
|
130
|
+
|
131
|
+
def find_latest_matching_spec_from_collection(specs, requirement)
|
132
|
+
specs.sort.reverse_each.find {|spec| requirement.satisfied_by?(spec.version) }
|
133
|
+
end
|
134
|
+
|
135
|
+
def running?(version)
|
136
|
+
version == current_version
|
137
|
+
end
|
138
|
+
|
139
|
+
def running_older_than?(version)
|
140
|
+
current_version < version
|
141
|
+
end
|
142
|
+
|
143
|
+
def released?(version)
|
144
|
+
!version.to_s.end_with?(".dev")
|
145
|
+
end
|
146
|
+
|
147
|
+
def updating?
|
148
|
+
"update".start_with?(ARGV.first || " ") && ARGV[1..-1].any? {|a| a.start_with?("--bundler") }
|
149
|
+
end
|
150
|
+
|
151
|
+
def installed?
|
152
|
+
Bundler.configure
|
153
|
+
|
154
|
+
Bundler.rubygems.find_bundler(lockfile_version.to_s)
|
155
|
+
end
|
156
|
+
|
157
|
+
def current_version
|
158
|
+
@current_version ||= Gem::Version.new(Bundler::VERSION)
|
159
|
+
end
|
160
|
+
|
161
|
+
def lockfile_version
|
162
|
+
return @lockfile_version if defined?(@lockfile_version)
|
163
|
+
|
164
|
+
parsed_version = Bundler::LockfileParser.bundled_with
|
165
|
+
@lockfile_version = parsed_version ? Gem::Version.new(parsed_version) : nil
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
data/lib/bundler/settings.rb
CHANGED
@@ -219,6 +219,7 @@ module Bundler
|
|
219
219
|
def path
|
220
220
|
configs.each do |_level, settings|
|
221
221
|
path = value_for("path", settings)
|
222
|
+
path = "vendor/bundle" if value_for("deployment", settings) && path.nil?
|
222
223
|
path_system = value_for("path.system", settings)
|
223
224
|
disabled_shared_gems = value_for("disable_shared_gems", settings)
|
224
225
|
next if path.nil? && path_system.nil? && disabled_shared_gems.nil?
|
@@ -366,7 +367,7 @@ module Bundler
|
|
366
367
|
|
367
368
|
def to_array(value)
|
368
369
|
return [] unless value
|
369
|
-
value.split(":").map(&:to_sym)
|
370
|
+
value.tr(" ", ":").split(":").map(&:to_sym)
|
370
371
|
end
|
371
372
|
|
372
373
|
def array_to_s(array)
|
@@ -419,7 +420,15 @@ module Bundler
|
|
419
420
|
elsif is_credential(key)
|
420
421
|
"[REDACTED]"
|
421
422
|
elsif is_userinfo(converted)
|
422
|
-
converted.
|
423
|
+
username, pass = converted.split(":", 2)
|
424
|
+
|
425
|
+
if pass == "x-oauth-basic"
|
426
|
+
username = "[REDACTED]"
|
427
|
+
else
|
428
|
+
pass = "[REDACTED]"
|
429
|
+
end
|
430
|
+
|
431
|
+
[username, pass].join(":")
|
423
432
|
else
|
424
433
|
converted
|
425
434
|
end
|
@@ -109,7 +109,7 @@ module Bundler
|
|
109
109
|
raise VirtualProtocolError.new
|
110
110
|
rescue Errno::ENOSPC
|
111
111
|
raise NoSpaceOnDeviceError.new(path, action)
|
112
|
-
rescue
|
112
|
+
rescue Errno::ENOTSUP
|
113
113
|
raise OperationNotSupportedError.new(path, action)
|
114
114
|
rescue Errno::EEXIST, Errno::ENOENT
|
115
115
|
raise
|
@@ -117,13 +117,6 @@ module Bundler
|
|
117
117
|
raise GenericSystemCallError.new(e, "There was an error accessing `#{path}`.")
|
118
118
|
end
|
119
119
|
|
120
|
-
def const_get_safely(constant_name, namespace)
|
121
|
-
const_in_namespace = namespace.constants.include?(constant_name.to_s) ||
|
122
|
-
namespace.constants.include?(constant_name.to_sym)
|
123
|
-
return nil unless const_in_namespace
|
124
|
-
namespace.const_get(constant_name)
|
125
|
-
end
|
126
|
-
|
127
120
|
def major_deprecation(major_version, message, print_caller_location: false)
|
128
121
|
if print_caller_location
|
129
122
|
caller_location = caller_locations(2, 2).first
|
@@ -246,7 +239,7 @@ module Bundler
|
|
246
239
|
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
247
240
|
|
248
241
|
until !File.directory?(current) || current == previous
|
249
|
-
if ENV["
|
242
|
+
if ENV["BUNDLER_SPEC_RUN"]
|
250
243
|
# avoid stepping above the tmp directory when testing
|
251
244
|
gemspec = if ENV["GEM_COMMAND"]
|
252
245
|
# for Ruby Core
|
@@ -320,12 +313,11 @@ module Bundler
|
|
320
313
|
end
|
321
314
|
|
322
315
|
def clean_load_path
|
323
|
-
bundler_lib = bundler_ruby_lib
|
324
|
-
|
325
316
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
326
317
|
|
327
318
|
$LOAD_PATH.reject! do |p|
|
328
|
-
|
319
|
+
resolved_path = resolve_path(p)
|
320
|
+
next if $LOADED_FEATURES.any? {|lf| lf.start_with?(resolved_path) }
|
329
321
|
loaded_gem_paths.delete(p)
|
330
322
|
end
|
331
323
|
$LOAD_PATH.uniq!
|
@@ -56,7 +56,6 @@ module Bundler
|
|
56
56
|
@ref = ref
|
57
57
|
@revision = revision
|
58
58
|
@git = git
|
59
|
-
raise GitNotInstalledError.new if allow? && !Bundler.git_present?
|
60
59
|
end
|
61
60
|
|
62
61
|
def revision
|
@@ -96,12 +95,12 @@ module Bundler
|
|
96
95
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
97
96
|
FileUtils.mkdir_p(p)
|
98
97
|
end
|
99
|
-
git_retry "clone",
|
98
|
+
git_retry "clone", "--bare", "--no-hardlinks", "--quiet", "--", configured_uri, path.to_s
|
100
99
|
return unless extra_ref
|
101
100
|
end
|
102
101
|
|
103
102
|
with_path do
|
104
|
-
git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
103
|
+
git_retry(*["fetch", "--force", "--quiet", "--tags", "--", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
@@ -208,7 +207,11 @@ module Bundler
|
|
208
207
|
end
|
209
208
|
|
210
209
|
def allow?
|
211
|
-
@git ? @git.allow_git_ops? : true
|
210
|
+
allowed = @git ? @git.allow_git_ops? : true
|
211
|
+
|
212
|
+
raise GitNotInstalledError.new if allowed && !Bundler.git_present?
|
213
|
+
|
214
|
+
allowed
|
212
215
|
end
|
213
216
|
|
214
217
|
def with_path(&blk)
|
data/lib/bundler/source/git.rb
CHANGED
@@ -42,7 +42,7 @@ module Bundler
|
|
42
42
|
%w[ref branch tag submodules].each do |opt|
|
43
43
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
44
|
end
|
45
|
-
out << " glob: #{@glob}\n" unless
|
45
|
+
out << " glob: #{@glob}\n" unless default_glob?
|
46
46
|
out << " specs:\n"
|
47
47
|
end
|
48
48
|
|
@@ -75,12 +75,20 @@ module Bundler
|
|
75
75
|
git_proxy.branch
|
76
76
|
end
|
77
77
|
|
78
|
-
rev = "
|
78
|
+
rev = "at #{at}@#{shortref_for_display(revision)}"
|
79
79
|
rescue GitError
|
80
80
|
""
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
specifiers = [rev, glob_for_display].compact
|
84
|
+
suffix =
|
85
|
+
if specifiers.any?
|
86
|
+
" (#{specifiers.join(", ")})"
|
87
|
+
else
|
88
|
+
""
|
89
|
+
end
|
90
|
+
|
91
|
+
"#{@safe_uri}#{suffix}"
|
84
92
|
end
|
85
93
|
|
86
94
|
def name
|
@@ -282,6 +290,14 @@ module Bundler
|
|
282
290
|
ref[0..11]
|
283
291
|
end
|
284
292
|
|
293
|
+
def glob_for_display
|
294
|
+
default_glob? ? nil : "glob: #{@glob}"
|
295
|
+
end
|
296
|
+
|
297
|
+
def default_glob?
|
298
|
+
@glob == DEFAULT_GLOB
|
299
|
+
end
|
300
|
+
|
285
301
|
def uri_hash
|
286
302
|
if uri =~ %r{^\w+://(\w+@)?}
|
287
303
|
# Downcase the domain component of the URI
|
@@ -291,7 +307,9 @@ module Bundler
|
|
291
307
|
# If there is no URI scheme, assume it is an ssh/git URI
|
292
308
|
input = uri
|
293
309
|
end
|
294
|
-
|
310
|
+
# We use SHA1 here for historical reason and to preserve backward compatibility.
|
311
|
+
# But a transition to a simpler mangling algorithm would be welcome.
|
312
|
+
Bundler::Digest.sha1(input)
|
295
313
|
end
|
296
314
|
|
297
315
|
def cached_revision
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
s.loaded_from = File.expand_path("..", __FILE__)
|
26
26
|
end
|
27
27
|
|
28
|
-
if local_spec = Bundler.rubygems.
|
28
|
+
if local_spec = Bundler.rubygems.find_bundler(VERSION)
|
29
29
|
idx << local_spec
|
30
30
|
end
|
31
31
|
|
@@ -26,6 +26,13 @@ module Bundler
|
|
26
26
|
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
27
27
|
end
|
28
28
|
|
29
|
+
def local_only!
|
30
|
+
@specs = nil
|
31
|
+
@allow_local = true
|
32
|
+
@allow_cached = false
|
33
|
+
@allow_remote = false
|
34
|
+
end
|
35
|
+
|
29
36
|
def local!
|
30
37
|
return if @allow_local
|
31
38
|
|
@@ -91,26 +98,30 @@ module Bundler
|
|
91
98
|
out << " specs:\n"
|
92
99
|
end
|
93
100
|
|
94
|
-
def
|
101
|
+
def to_s
|
95
102
|
if remotes.empty?
|
96
103
|
"locally installed gems"
|
97
|
-
elsif @allow_remote
|
104
|
+
elsif @allow_remote && @allow_cached && @allow_local
|
105
|
+
"rubygems repository #{remote_names}, cached gems or installed locally"
|
106
|
+
elsif @allow_remote && @allow_local
|
98
107
|
"rubygems repository #{remote_names} or installed locally"
|
99
|
-
elsif @
|
100
|
-
"
|
108
|
+
elsif @allow_remote
|
109
|
+
"rubygems repository #{remote_names}"
|
110
|
+
elsif @allow_cached && @allow_local
|
111
|
+
"cached gems or installed locally"
|
101
112
|
else
|
102
113
|
"locally installed gems"
|
103
114
|
end
|
104
115
|
end
|
105
116
|
|
106
|
-
def
|
117
|
+
def identifier
|
107
118
|
if remotes.empty?
|
108
119
|
"locally installed gems"
|
109
120
|
else
|
110
|
-
"rubygems repository #{remote_names}
|
121
|
+
"rubygems repository #{remote_names}"
|
111
122
|
end
|
112
123
|
end
|
113
|
-
alias_method :name, :
|
124
|
+
alias_method :name, :identifier
|
114
125
|
|
115
126
|
def specs
|
116
127
|
@specs ||= begin
|
@@ -128,7 +139,7 @@ module Bundler
|
|
128
139
|
force = opts[:force]
|
129
140
|
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
|
130
141
|
|
131
|
-
if ensure_builtin_gems_cached &&
|
142
|
+
if ensure_builtin_gems_cached && spec.default_gem?
|
132
143
|
if !cached_path(spec)
|
133
144
|
cached_built_in_gem(spec) unless spec.remote
|
134
145
|
force = true
|
@@ -137,7 +148,7 @@ module Bundler
|
|
137
148
|
end
|
138
149
|
end
|
139
150
|
|
140
|
-
if
|
151
|
+
if installed?(spec) && !force
|
141
152
|
print_using_message "Using #{version_message(spec)}"
|
142
153
|
return nil # no post-install message
|
143
154
|
end
|
@@ -155,7 +166,7 @@ module Bundler
|
|
155
166
|
begin
|
156
167
|
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
|
157
168
|
spec.__swap__(s)
|
158
|
-
rescue
|
169
|
+
rescue Gem::Package::FormatError
|
159
170
|
Bundler.rm_rf(path)
|
160
171
|
raise
|
161
172
|
end
|
@@ -167,6 +178,7 @@ module Bundler
|
|
167
178
|
Bundler.ui.confirm message
|
168
179
|
|
169
180
|
path = cached_gem(spec)
|
181
|
+
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
170
182
|
if requires_sudo?
|
171
183
|
install_path = Bundler.tmp(spec.full_name)
|
172
184
|
bin_path = install_path.join("bin")
|
@@ -226,12 +238,8 @@ module Bundler
|
|
226
238
|
end
|
227
239
|
|
228
240
|
def cache(spec, custom_path = nil)
|
229
|
-
|
230
|
-
|
231
|
-
else
|
232
|
-
cached_path = cached_gem(spec)
|
233
|
-
end
|
234
|
-
raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path
|
241
|
+
cached_path = cached_gem(spec)
|
242
|
+
raise GemNotFound, "Missing gem file '#{spec.file_name}'." unless cached_path
|
235
243
|
return if File.dirname(cached_path) == Bundler.app_cache.to_s
|
236
244
|
Bundler.ui.info " * #{File.basename(cached_path)}"
|
237
245
|
FileUtils.cp(cached_path, Bundler.app_cache(custom_path))
|
@@ -258,10 +266,6 @@ module Bundler
|
|
258
266
|
@remotes.unshift(uri) unless @remotes.include?(uri)
|
259
267
|
end
|
260
268
|
|
261
|
-
def equivalent_remotes?(other_remotes)
|
262
|
-
other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth))
|
263
|
-
end
|
264
|
-
|
265
269
|
def spec_names
|
266
270
|
if @allow_remote && dependency_api_available?
|
267
271
|
remote_specs.spec_names
|
@@ -330,7 +334,11 @@ module Bundler
|
|
330
334
|
end
|
331
335
|
|
332
336
|
def credless_remotes
|
333
|
-
|
337
|
+
if Bundler.settings[:allow_deployment_source_credential_changes]
|
338
|
+
remotes.map(&method(:remove_auth))
|
339
|
+
else
|
340
|
+
remotes.map(&method(:suppress_configured_credentials))
|
341
|
+
end
|
334
342
|
end
|
335
343
|
|
336
344
|
def remotes_for_spec(spec)
|
@@ -345,14 +353,17 @@ module Bundler
|
|
345
353
|
end
|
346
354
|
|
347
355
|
def cached_gem(spec)
|
348
|
-
|
349
|
-
|
350
|
-
|
356
|
+
if spec.default_gem?
|
357
|
+
cached_built_in_gem(spec)
|
358
|
+
else
|
359
|
+
cached_path(spec)
|
351
360
|
end
|
352
|
-
cached_gem
|
353
361
|
end
|
354
362
|
|
355
363
|
def cached_path(spec)
|
364
|
+
global_cache_path = download_cache_path(spec)
|
365
|
+
@caches << global_cache_path if global_cache_path
|
366
|
+
|
356
367
|
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
|
357
368
|
possibilities.find {|p| File.exist?(p) }
|
358
369
|
end
|
@@ -452,19 +463,26 @@ module Bundler
|
|
452
463
|
|
453
464
|
spec.fetch_platform
|
454
465
|
|
455
|
-
|
456
|
-
gem_path = "#{
|
466
|
+
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
|
467
|
+
gem_path = "#{cache_path}/#{spec.file_name}"
|
468
|
+
|
469
|
+
if requires_sudo?
|
470
|
+
download_path = Bundler.tmp(spec.full_name)
|
471
|
+
download_cache_path = default_cache_path_for(download_path)
|
472
|
+
else
|
473
|
+
download_cache_path = cache_path
|
474
|
+
end
|
457
475
|
|
458
|
-
SharedHelpers.filesystem_access(
|
476
|
+
SharedHelpers.filesystem_access(download_cache_path) do |p|
|
459
477
|
FileUtils.mkdir_p(p)
|
460
478
|
end
|
461
|
-
download_gem(spec,
|
479
|
+
download_gem(spec, download_cache_path)
|
462
480
|
|
463
481
|
if requires_sudo?
|
464
|
-
SharedHelpers.filesystem_access(
|
482
|
+
SharedHelpers.filesystem_access(cache_path) do |p|
|
465
483
|
Bundler.mkdir_p(p)
|
466
484
|
end
|
467
|
-
Bundler.sudo "mv #{
|
485
|
+
Bundler.sudo "mv #{download_cache_path}/#{spec.file_name} #{gem_path}"
|
468
486
|
end
|
469
487
|
|
470
488
|
gem_path
|
@@ -472,16 +490,8 @@ module Bundler
|
|
472
490
|
Bundler.rm_rf(download_path) if requires_sudo?
|
473
491
|
end
|
474
492
|
|
475
|
-
def builtin_gem?(spec)
|
476
|
-
# Ruby 2.1, where all included gems have this summary
|
477
|
-
return true if spec.summary =~ /is bundled with Ruby/
|
478
|
-
|
479
|
-
# Ruby 2.0, where gemspecs are stored in specifications/default/
|
480
|
-
spec.loaded_from && spec.loaded_from.include?("specifications/default/")
|
481
|
-
end
|
482
|
-
|
483
493
|
def installed?(spec)
|
484
|
-
installed_specs[spec].any?
|
494
|
+
installed_specs[spec].any? && !spec.deleted_gem?
|
485
495
|
end
|
486
496
|
|
487
497
|
def requires_sudo?
|
@@ -492,6 +502,10 @@ module Bundler
|
|
492
502
|
Bundler.rubygems.gem_dir
|
493
503
|
end
|
494
504
|
|
505
|
+
def default_cache_path_for(dir)
|
506
|
+
"#{dir}/cache"
|
507
|
+
end
|
508
|
+
|
495
509
|
def cache_path
|
496
510
|
Bundler.app_cache
|
497
511
|
end
|
@@ -504,52 +518,13 @@ module Bundler
|
|
504
518
|
# @param [Specification] spec
|
505
519
|
# the spec we want to download or retrieve from the cache.
|
506
520
|
#
|
507
|
-
# @param [String]
|
521
|
+
# @param [String] download_cache_path
|
508
522
|
# the local directory the .gem will end up in.
|
509
523
|
#
|
510
|
-
def download_gem(spec,
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
SharedHelpers.filesystem_access(local_path) do
|
515
|
-
FileUtils.cp(cache_path, local_path)
|
516
|
-
end
|
517
|
-
else
|
518
|
-
uri = spec.remote.uri
|
519
|
-
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
520
|
-
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
|
521
|
-
|
522
|
-
# older rubygems return varying file:// variants depending on version
|
523
|
-
rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
|
524
|
-
rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
|
525
|
-
|
526
|
-
if rubygems_local_path != local_path
|
527
|
-
SharedHelpers.filesystem_access(local_path) do
|
528
|
-
FileUtils.mv(rubygems_local_path, local_path)
|
529
|
-
end
|
530
|
-
end
|
531
|
-
cache_globally(spec, local_path)
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
# Checks if the requested spec exists in the global cache. If it does
|
536
|
-
# not, we create the relevant global cache subdirectory if it does not
|
537
|
-
# exist and copy the spec from the local cache to the global cache.
|
538
|
-
#
|
539
|
-
# @param [Specification] spec
|
540
|
-
# the spec we want to copy to the global cache.
|
541
|
-
#
|
542
|
-
# @param [String] local_cache_path
|
543
|
-
# the local directory from which we want to copy the .gem.
|
544
|
-
#
|
545
|
-
def cache_globally(spec, local_cache_path)
|
546
|
-
return unless cache_path = download_cache_path(spec)
|
547
|
-
return if cache_path.exist?
|
548
|
-
|
549
|
-
SharedHelpers.filesystem_access(cache_path.dirname, &:mkpath)
|
550
|
-
SharedHelpers.filesystem_access(cache_path) do
|
551
|
-
FileUtils.cp(local_cache_path, cache_path)
|
552
|
-
end
|
524
|
+
def download_gem(spec, download_cache_path)
|
525
|
+
uri = spec.remote.uri
|
526
|
+
Bundler.ui.confirm("Fetching #{version_message(spec)}")
|
527
|
+
Bundler.rubygems.download_gem(spec, uri, download_cache_path)
|
553
528
|
end
|
554
529
|
|
555
530
|
# Returns the global cache path of the calling Rubygems::Source object.
|
@@ -568,7 +543,7 @@ module Bundler
|
|
568
543
|
return unless remote = spec.remote
|
569
544
|
return unless cache_slug = remote.cache_slug
|
570
545
|
|
571
|
-
Bundler.user_cache.join("gems", cache_slug
|
546
|
+
Bundler.user_cache.join("gems", cache_slug)
|
572
547
|
end
|
573
548
|
|
574
549
|
def extension_cache_slug(spec)
|
data/lib/bundler/source.rb
CHANGED
@@ -36,6 +36,8 @@ module Bundler
|
|
36
36
|
|
37
37
|
def local!; end
|
38
38
|
|
39
|
+
def local_only!; end
|
40
|
+
|
39
41
|
def cached!; end
|
40
42
|
|
41
43
|
def remote!; end
|
@@ -65,7 +67,7 @@ module Bundler
|
|
65
67
|
"#<#{self.class}:0x#{object_id} #{self}>"
|
66
68
|
end
|
67
69
|
|
68
|
-
def
|
70
|
+
def identifier
|
69
71
|
to_s
|
70
72
|
end
|
71
73
|
|