rubygems-update 3.3.15 → 3.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Manifest.txt +5 -2
- data/bundler/CHANGELOG.md +6 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/cache.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +0 -2
- data/bundler/lib/bundler/cli.rb +2 -6
- data/bundler/lib/bundler/definition.rb +16 -20
- data/bundler/lib/bundler/dependency.rb +2 -0
- data/bundler/lib/bundler/dsl.rb +1 -3
- data/bundler/lib/bundler/errors.rb +2 -0
- data/bundler/lib/bundler/fetcher/base.rb +6 -8
- data/bundler/lib/bundler/fetcher.rb +4 -0
- data/bundler/lib/bundler/plugin/api/source.rb +3 -3
- data/bundler/lib/bundler/resolver.rb +10 -12
- data/bundler/lib/bundler/rubygems_gem_installer.rb +8 -0
- data/bundler/lib/bundler/rubygems_integration.rb +3 -21
- data/bundler/lib/bundler/source/git.rb +5 -7
- data/bundler/lib/bundler/source/rubygems.rb +77 -76
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +1 -1
- data/lib/rubygems/commands/sources_command.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +1 -1
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/ext/builder.rb +3 -3
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +23 -0
- data/lib/rubygems/ext/cargo_builder.rb +87 -64
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/source/git.rb +2 -2
- data/lib/rubygems/source.rb +2 -9
- data/lib/rubygems/source_list.rb +1 -5
- data/lib/rubygems/specification.rb +28 -4
- data/lib/rubygems/specification_policy.rb +1 -1
- data/lib/rubygems/uri.rb +41 -26
- data/lib/rubygems/util.rb +1 -1
- data/lib/rubygems.rb +1 -2
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/{null-type.gemspec.rz → pry-0.4.7.gemspec.rz} +0 -0
- data/test/rubygems/helper.rb +2 -2
- data/test/rubygems/test_gem.rb +1 -1
- data/test/rubygems/test_gem_commands_sources_command.rb +50 -0
- data/test/rubygems/test_gem_config_file.rb +3 -3
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +86 -74
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -2
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +86 -74
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -2
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +2 -2
- data/test/rubygems/test_gem_ext_cargo_builder.rb +50 -19
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +75 -0
- data/test/rubygems/test_gem_gemcutter_utilities.rb +1 -1
- data/test/rubygems/test_gem_package.rb +1 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -15
- data/test/rubygems/test_gem_resolver.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +14 -6
- data/test/rubygems/test_require.rb +10 -10
- data/test/rubygems/test_rubygems.rb +3 -3
- metadata +8 -5
- data/lib/rubygems/psych_additions.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f28d959e6c80a1a48380837de462a5d37b8c74ab83db7ddb52c33e923088a819
|
4
|
+
data.tar.gz: 8492c0f957c64cc02e779d7f23b2c925f5be4d79451ae52e39105c6a52bbcfd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c61d093abdc997d0c015c3323de9404e35e309454fe7541cce731f5a9ed6a46bc9f59aed0cefffad780a2f889e2decd43350562af66cc6ae07a8bc443bdb0c56
|
7
|
+
data.tar.gz: 55306fc3437106fb9f97379219449b50c875f22a80309c675202e8fbde767bf2066b3395a0cae88e7b065d90e0eb1b452340b753eefba1f33b410f6ff14e9666
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# 3.3.16 / 2022-06-15
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
* Auto-fix and warn gem packages including a gemspec with `require_paths`
|
6
|
+
as an array of arrays. Pull request #5615 by deivid-rodriguez
|
7
|
+
* Misc cargo builder improvements. Pull request #5459 by ianks
|
8
|
+
* Installs bundler 2.3.16 as a default gem.
|
9
|
+
|
10
|
+
## Bug fixes:
|
11
|
+
|
12
|
+
* Fix incorrect password redaction when there's an error in `gem source
|
13
|
+
-a`. Pull request #5623 by deivid-rodriguez
|
14
|
+
* Fix another regression when loading old marshaled specs. Pull request
|
15
|
+
#5610 by deivid-rodriguez
|
16
|
+
|
1
17
|
# 3.3.15 / 2022-06-01
|
2
18
|
|
3
19
|
## Enhancements:
|
data/Manifest.txt
CHANGED
@@ -383,6 +383,7 @@ lib/rubygems/ext.rb
|
|
383
383
|
lib/rubygems/ext/build_error.rb
|
384
384
|
lib/rubygems/ext/builder.rb
|
385
385
|
lib/rubygems/ext/cargo_builder.rb
|
386
|
+
lib/rubygems/ext/cargo_builder/link_flag_converter.rb
|
386
387
|
lib/rubygems/ext/cmake_builder.rb
|
387
388
|
lib/rubygems/ext/configure_builder.rb
|
388
389
|
lib/rubygems/ext/ext_conf_builder.rb
|
@@ -424,7 +425,6 @@ lib/rubygems/package/tar_writer.rb
|
|
424
425
|
lib/rubygems/package_task.rb
|
425
426
|
lib/rubygems/path_support.rb
|
426
427
|
lib/rubygems/platform.rb
|
427
|
-
lib/rubygems/psych_additions.rb
|
428
428
|
lib/rubygems/psych_tree.rb
|
429
429
|
lib/rubygems/query_utils.rb
|
430
430
|
lib/rubygems/rdoc.rb
|
@@ -538,11 +538,12 @@ test/rubygems/child_cert.pem
|
|
538
538
|
test/rubygems/child_cert_32.pem
|
539
539
|
test/rubygems/child_key.pem
|
540
540
|
test/rubygems/client.pem
|
541
|
+
test/rubygems/data/excon-0.7.7.gemspec.rz
|
541
542
|
test/rubygems/data/gem-private_key.pem
|
542
543
|
test/rubygems/data/gem-public_cert.pem
|
543
544
|
test/rubygems/data/null-required-ruby-version.gemspec.rz
|
544
545
|
test/rubygems/data/null-required-rubygems-version.gemspec.rz
|
545
|
-
test/rubygems/data/
|
546
|
+
test/rubygems/data/pry-0.4.7.gemspec.rz
|
546
547
|
test/rubygems/encrypted_private_key.pem
|
547
548
|
test/rubygems/expired_cert.pem
|
548
549
|
test/rubygems/fake_certlib/openssl.rb
|
@@ -649,6 +650,8 @@ test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
|
|
649
650
|
test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
|
650
651
|
test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec
|
651
652
|
test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs
|
653
|
+
test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
|
654
|
+
test/rubygems/test_gem_ext_cargo_builder_unit.rb
|
652
655
|
test/rubygems/test_gem_ext_cmake_builder.rb
|
653
656
|
test/rubygems/test_gem_ext_configure_builder.rb
|
654
657
|
test/rubygems/test_gem_ext_ext_conf_builder.rb
|
data/bundler/CHANGELOG.md
CHANGED
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2022-06-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2022-06-15".freeze
|
8
|
+
@git_commit_sha = "324ee6e542".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
@@ -14,7 +14,7 @@ module Bundler
|
|
14
14
|
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
|
15
15
|
|
16
16
|
setup_cache_all
|
17
|
-
install
|
17
|
+
install unless Bundler.settings[:no_install]
|
18
18
|
|
19
19
|
# TODO: move cache contents here now that all bundles are locked
|
20
20
|
custom_path = Bundler.settings[:path] if options[:path]
|
@@ -161,8 +161,6 @@ module Bundler
|
|
161
161
|
|
162
162
|
Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
|
163
163
|
|
164
|
-
Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
|
165
|
-
|
166
164
|
Bundler.settings.set_command_option_if_given :clean, options["clean"]
|
167
165
|
|
168
166
|
normalize_groups if options[:without] || options[:with]
|
data/bundler/lib/bundler/cli.rb
CHANGED
@@ -251,9 +251,7 @@ module Bundler
|
|
251
251
|
remembered_negative_flag_deprecation("no-deployment")
|
252
252
|
|
253
253
|
require_relative "cli/install"
|
254
|
-
|
255
|
-
Install.new(options.dup).run
|
256
|
-
end
|
254
|
+
Install.new(options.dup).run
|
257
255
|
end
|
258
256
|
|
259
257
|
map aliases_for("install")
|
@@ -299,9 +297,7 @@ module Bundler
|
|
299
297
|
def update(*gems)
|
300
298
|
SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
|
301
299
|
require_relative "cli/update"
|
302
|
-
|
303
|
-
Update.new(options, gems).run
|
304
|
-
end
|
300
|
+
Update.new(options, gems).run
|
305
301
|
end
|
306
302
|
|
307
303
|
desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
|
@@ -255,20 +255,18 @@ module Bundler
|
|
255
255
|
#
|
256
256
|
# @return [SpecSet] resolved dependencies
|
257
257
|
def resolve
|
258
|
-
@resolve ||=
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
271
|
-
end
|
258
|
+
@resolve ||= if Bundler.frozen_bundle?
|
259
|
+
Bundler.ui.debug "Frozen, using resolution from the lockfile"
|
260
|
+
@locked_specs
|
261
|
+
elsif !unlocking? && nothing_changed?
|
262
|
+
Bundler.ui.debug("Found no changes, using resolution from the lockfile")
|
263
|
+
SpecSet.new(filter_specs(@locked_specs, @dependencies.select {|dep| @locked_specs[dep].any? }))
|
264
|
+
else
|
265
|
+
last_resolve = converge_locked_specs
|
266
|
+
# Run a resolve against the locally available gems
|
267
|
+
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
268
|
+
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
|
269
|
+
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
272
270
|
end
|
273
271
|
end
|
274
272
|
|
@@ -735,12 +733,10 @@ module Bundler
|
|
735
733
|
end
|
736
734
|
|
737
735
|
def metadata_dependencies
|
738
|
-
@metadata_dependencies ||=
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
]
|
743
|
-
end
|
736
|
+
@metadata_dependencies ||= [
|
737
|
+
Dependency.new("Ruby\0", RubyVersion.system.gem_version),
|
738
|
+
Dependency.new("RubyGems\0", Gem::VERSION),
|
739
|
+
]
|
744
740
|
end
|
745
741
|
|
746
742
|
def expand_dependencies(dependencies, remote = false)
|
@@ -9,6 +9,7 @@ module Bundler
|
|
9
9
|
attr_reader :autorequire
|
10
10
|
attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref
|
11
11
|
|
12
|
+
# rubocop:disable Naming/VariableNumber
|
12
13
|
PLATFORM_MAP = {
|
13
14
|
:ruby => Gem::Platform::RUBY,
|
14
15
|
:ruby_18 => Gem::Platform::RUBY,
|
@@ -91,6 +92,7 @@ module Bundler
|
|
91
92
|
:x64_mingw_30 => Gem::Platform::X64_MINGW,
|
92
93
|
:x64_mingw_31 => Gem::Platform::X64_MINGW,
|
93
94
|
}.freeze
|
95
|
+
# rubocop:enable Naming/VariableNumber
|
94
96
|
|
95
97
|
def initialize(name, version, options = {}, &blk)
|
96
98
|
type = options["type"] || :runtime
|
data/bundler/lib/bundler/dsl.rb
CHANGED
@@ -511,9 +511,7 @@ module Bundler
|
|
511
511
|
# be raised.
|
512
512
|
#
|
513
513
|
def contents
|
514
|
-
@contents ||=
|
515
|
-
dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
|
516
|
-
end
|
514
|
+
@contents ||= dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
|
517
515
|
end
|
518
516
|
|
519
517
|
# The message of the exception reports the content of podspec for the
|
@@ -41,12 +41,14 @@ module Bundler
|
|
41
41
|
class GemspecError < BundlerError; status_code(14); end
|
42
42
|
class InvalidOption < BundlerError; status_code(15); end
|
43
43
|
class ProductionError < BundlerError; status_code(16); end
|
44
|
+
|
44
45
|
class HTTPError < BundlerError
|
45
46
|
status_code(17)
|
46
47
|
def filter_uri(uri)
|
47
48
|
URICredentialsFilter.credential_filtered_uri(uri)
|
48
49
|
end
|
49
50
|
end
|
51
|
+
|
50
52
|
class RubyVersionMismatch < BundlerError; status_code(18); end
|
51
53
|
class SecurityError < BundlerError; status_code(19); end
|
52
54
|
class LockfileError < BundlerError; status_code(20); end
|
@@ -19,14 +19,12 @@ module Bundler
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def fetch_uri
|
22
|
-
@fetch_uri ||=
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
remote_uri
|
29
|
-
end
|
22
|
+
@fetch_uri ||= if remote_uri.host == "rubygems.org"
|
23
|
+
uri = remote_uri.dup
|
24
|
+
uri.host = "index.rubygems.org"
|
25
|
+
uri
|
26
|
+
else
|
27
|
+
remote_uri
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
@@ -20,6 +20,7 @@ module Bundler
|
|
20
20
|
class TooManyRequestsError < HTTPError; end
|
21
21
|
# This error is raised if the API returns a 413 (only printed in verbose)
|
22
22
|
class FallbackError < HTTPError; end
|
23
|
+
|
23
24
|
# This is the error raised if OpenSSL fails the cert verification
|
24
25
|
class CertificateFailureError < HTTPError
|
25
26
|
def initialize(remote_uri)
|
@@ -33,6 +34,7 @@ module Bundler
|
|
33
34
|
" sources and change 'https' to 'http'."
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
36
38
|
# This is the error raised when a source is HTTPS and OpenSSL didn't load
|
37
39
|
class SSLError < HTTPError
|
38
40
|
def initialize(msg = nil)
|
@@ -42,6 +44,7 @@ module Bundler
|
|
42
44
|
"using RVM are available at rvm.io/packages/openssl."
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
45
48
|
# This error is raised if HTTP authentication is required, but not provided.
|
46
49
|
class AuthenticationRequiredError < HTTPError
|
47
50
|
def initialize(remote_uri)
|
@@ -52,6 +55,7 @@ module Bundler
|
|
52
55
|
"or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
|
53
56
|
end
|
54
57
|
end
|
58
|
+
|
55
59
|
# This error is raised if HTTP authentication is provided, but incorrect.
|
56
60
|
class BadAuthenticationError < HTTPError
|
57
61
|
def initialize(remote_uri)
|
@@ -258,7 +258,7 @@ module Bundler
|
|
258
258
|
@dependencies |= Array(names)
|
259
259
|
end
|
260
260
|
|
261
|
-
#
|
261
|
+
# NOTE: Do not override if you don't know what you are doing.
|
262
262
|
def can_lock?(spec)
|
263
263
|
spec.source == self
|
264
264
|
end
|
@@ -285,7 +285,7 @@ module Bundler
|
|
285
285
|
end
|
286
286
|
alias_method :identifier, :to_s
|
287
287
|
|
288
|
-
#
|
288
|
+
# NOTE: Do not override if you don't know what you are doing.
|
289
289
|
def include?(other)
|
290
290
|
other == self
|
291
291
|
end
|
@@ -294,7 +294,7 @@ module Bundler
|
|
294
294
|
SharedHelpers.digest(:SHA1).hexdigest(uri)
|
295
295
|
end
|
296
296
|
|
297
|
-
#
|
297
|
+
# NOTE: Do not override if you don't know what you are doing.
|
298
298
|
def gem_install_dir
|
299
299
|
Bundler.install_path
|
300
300
|
end
|
@@ -233,19 +233,17 @@ module Bundler
|
|
233
233
|
# before dependencies that are unconstrained
|
234
234
|
def amount_constrained(dependency)
|
235
235
|
@amount_constrained ||= {}
|
236
|
-
@amount_constrained[dependency.name] ||=
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
all = index_for(dependency).search(dependency.name).size
|
236
|
+
@amount_constrained[dependency.name] ||= if (base = @base[dependency.name]) && !base.empty?
|
237
|
+
dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
|
238
|
+
else
|
239
|
+
all = index_for(dependency).search(dependency.name).size
|
241
240
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
end
|
241
|
+
if all <= 1
|
242
|
+
all - 1_000_000
|
243
|
+
else
|
244
|
+
search = search_for(dependency)
|
245
|
+
search = @prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
|
246
|
+
search - all
|
249
247
|
end
|
250
248
|
end
|
251
249
|
end
|
@@ -90,6 +90,14 @@ module Bundler
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
def spec
|
94
|
+
if Bundler.rubygems.provides?("< 3.3.12") # RubyGems implementation rescues and re-raises errors before 3.3.12 and we don't want that
|
95
|
+
@package.spec
|
96
|
+
else
|
97
|
+
super
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
93
101
|
private
|
94
102
|
|
95
103
|
def strict_rm_rf(dir)
|
@@ -203,20 +203,9 @@ module Bundler
|
|
203
203
|
EXT_LOCK
|
204
204
|
end
|
205
205
|
|
206
|
-
def spec_from_gem(path
|
207
|
-
require "rubygems/
|
208
|
-
|
209
|
-
gem_from_path(path, security_policies[policy]).spec
|
210
|
-
rescue Exception, Gem::Exception, Gem::Security::Exception => e # rubocop:disable Lint/RescueException
|
211
|
-
if e.is_a?(Gem::Security::Exception) ||
|
212
|
-
e.message =~ /unknown trust policy|unsigned gem/i ||
|
213
|
-
e.message =~ /couldn't verify (meta)?data signature/i
|
214
|
-
raise SecurityError,
|
215
|
-
"The gem #{File.basename(path, ".gem")} can't be installed because " \
|
216
|
-
"the security policy didn't allow it, with the message: #{e.message}"
|
217
|
-
else
|
218
|
-
raise e
|
219
|
-
end
|
206
|
+
def spec_from_gem(path)
|
207
|
+
require "rubygems/package"
|
208
|
+
Gem::Package.new(path).spec
|
220
209
|
end
|
221
210
|
|
222
211
|
def build_gem(gem_dir, spec)
|
@@ -514,13 +503,6 @@ module Bundler
|
|
514
503
|
Gem::RemoteFetcher.new(proxy)
|
515
504
|
end
|
516
505
|
|
517
|
-
def gem_from_path(path, policy = nil)
|
518
|
-
require "rubygems/package"
|
519
|
-
p = Gem::Package.new(path)
|
520
|
-
p.security_policy = policy if policy
|
521
|
-
p
|
522
|
-
end
|
523
|
-
|
524
506
|
def build(spec, skip_validation = false)
|
525
507
|
require "rubygems/package"
|
526
508
|
Gem::Package.build(spec, skip_validation)
|
@@ -219,13 +219,11 @@ module Bundler
|
|
219
219
|
# across different projects, this cache will be shared.
|
220
220
|
# When using local git repos, this is set to the local repo.
|
221
221
|
def cache_path
|
222
|
-
@cache_path ||=
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
end.join("git", git_scope)
|
228
|
-
end
|
222
|
+
@cache_path ||= if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
|
223
|
+
Bundler.user_cache
|
224
|
+
else
|
225
|
+
Bundler.bundle_path.join("cache", "bundler")
|
226
|
+
end.join("git", git_scope)
|
229
227
|
end
|
230
228
|
|
231
229
|
def app_cache_dirname
|
@@ -139,13 +139,9 @@ module Bundler
|
|
139
139
|
force = options[:force]
|
140
140
|
ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
|
141
141
|
|
142
|
-
if ensure_builtin_gems_cached && spec.default_gem?
|
143
|
-
|
144
|
-
|
145
|
-
force = true
|
146
|
-
else
|
147
|
-
spec.loaded_from = loaded_from(spec)
|
148
|
-
end
|
142
|
+
if ensure_builtin_gems_cached && spec.default_gem? && !cached_path(spec)
|
143
|
+
cached_built_in_gem(spec) unless spec.remote
|
144
|
+
force = true
|
149
145
|
end
|
150
146
|
|
151
147
|
if installed?(spec) && !force
|
@@ -153,84 +149,90 @@ module Bundler
|
|
153
149
|
return nil # no post-install message
|
154
150
|
end
|
155
151
|
|
156
|
-
# Download the gem to get the spec, because some specs that are returned
|
157
|
-
# by rubygems.org are broken and wrong.
|
158
152
|
if spec.remote
|
159
153
|
# Check for this spec from other sources
|
160
|
-
uris = [spec.remote.anonymized_uri
|
161
|
-
uris += remotes_for_spec(spec).map(&:anonymized_uri)
|
162
|
-
uris.uniq!
|
154
|
+
uris = [spec.remote, *remotes_for_spec(spec)].map(&:anonymized_uri).uniq
|
163
155
|
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
|
164
156
|
|
165
157
|
path = fetch_gem(spec, options[:previous_spec])
|
166
|
-
|
167
|
-
|
168
|
-
|
158
|
+
else
|
159
|
+
path = cached_gem(spec)
|
160
|
+
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
|
161
|
+
end
|
162
|
+
|
163
|
+
if requires_sudo?
|
164
|
+
install_path = Bundler.tmp(spec.full_name)
|
165
|
+
bin_path = install_path.join("bin")
|
166
|
+
else
|
167
|
+
install_path = rubygems_dir
|
168
|
+
bin_path = Bundler.system_bindir
|
169
|
+
end
|
170
|
+
|
171
|
+
Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
|
172
|
+
|
173
|
+
require_relative "../rubygems_gem_installer"
|
174
|
+
|
175
|
+
installer = Bundler::RubyGemsGemInstaller.at(
|
176
|
+
path,
|
177
|
+
:security_policy => Bundler.rubygems.security_policies[Bundler.settings["trust-policy"]],
|
178
|
+
:install_dir => install_path.to_s,
|
179
|
+
:bin_dir => bin_path.to_s,
|
180
|
+
:ignore_dependencies => true,
|
181
|
+
:wrappers => true,
|
182
|
+
:env_shebang => true,
|
183
|
+
:build_args => options[:build_args],
|
184
|
+
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
|
185
|
+
:bundler_extension_cache_path => extension_cache_path(spec)
|
186
|
+
)
|
187
|
+
|
188
|
+
if spec.remote
|
189
|
+
s = begin
|
190
|
+
installer.spec
|
169
191
|
rescue Gem::Package::FormatError
|
170
192
|
Bundler.rm_rf(path)
|
171
193
|
raise
|
194
|
+
rescue Gem::Security::Exception => e
|
195
|
+
raise SecurityError,
|
196
|
+
"The gem #{File.basename(path, ".gem")} can't be installed because " \
|
197
|
+
"the security policy didn't allow it, with the message: #{e.message}"
|
172
198
|
end
|
199
|
+
|
200
|
+
spec.__swap__(s)
|
173
201
|
end
|
174
202
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
Bundler.ui.confirm message
|
203
|
+
message = "Installing #{version_message(spec, options[:previous_spec])}"
|
204
|
+
message += " with native extensions" if spec.extensions.any?
|
205
|
+
Bundler.ui.confirm message
|
179
206
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
bin_path = install_path.join("bin")
|
185
|
-
else
|
186
|
-
install_path = rubygems_dir
|
187
|
-
bin_path = Bundler.system_bindir
|
188
|
-
end
|
207
|
+
installed_spec = installer.install
|
208
|
+
|
209
|
+
spec.full_gem_path = installed_spec.full_gem_path
|
210
|
+
spec.loaded_from = installed_spec.loaded_from
|
189
211
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
:env_shebang => true,
|
201
|
-
:build_args => options[:build_args],
|
202
|
-
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
|
203
|
-
:bundler_extension_cache_path => extension_cache_path(spec)
|
204
|
-
).install
|
205
|
-
spec.full_gem_path = installed_spec.full_gem_path
|
206
|
-
|
207
|
-
# SUDO HAX
|
208
|
-
if requires_sudo?
|
209
|
-
Bundler.rubygems.repository_subdirectories.each do |name|
|
210
|
-
src = File.join(install_path, name, "*")
|
211
|
-
dst = File.join(rubygems_dir, name)
|
212
|
-
if name == "extensions" && Dir.glob(src).any?
|
213
|
-
src = File.join(src, "*/*")
|
214
|
-
ext_src = Dir.glob(src).first
|
215
|
-
ext_src.gsub!(src[0..-6], "")
|
216
|
-
dst = File.dirname(File.join(dst, ext_src))
|
217
|
-
end
|
218
|
-
SharedHelpers.filesystem_access(dst) do |p|
|
219
|
-
Bundler.mkdir_p(p)
|
220
|
-
end
|
221
|
-
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
212
|
+
# SUDO HAX
|
213
|
+
if requires_sudo?
|
214
|
+
Bundler.rubygems.repository_subdirectories.each do |name|
|
215
|
+
src = File.join(install_path, name, "*")
|
216
|
+
dst = File.join(rubygems_dir, name)
|
217
|
+
if name == "extensions" && Dir.glob(src).any?
|
218
|
+
src = File.join(src, "*/*")
|
219
|
+
ext_src = Dir.glob(src).first
|
220
|
+
ext_src.gsub!(src[0..-6], "")
|
221
|
+
dst = File.dirname(File.join(dst, ext_src))
|
222
222
|
end
|
223
|
+
SharedHelpers.filesystem_access(dst) do |p|
|
224
|
+
Bundler.mkdir_p(p)
|
225
|
+
end
|
226
|
+
Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any?
|
227
|
+
end
|
223
228
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
end
|
228
|
-
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
229
|
+
spec.executables.each do |exe|
|
230
|
+
SharedHelpers.filesystem_access(Bundler.system_bindir) do |p|
|
231
|
+
Bundler.mkdir_p(p)
|
229
232
|
end
|
233
|
+
Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/"
|
230
234
|
end
|
231
|
-
installed_spec.loaded_from = loaded_from(spec)
|
232
235
|
end
|
233
|
-
spec.loaded_from = loaded_from(spec)
|
234
236
|
|
235
237
|
spec.post_install_message
|
236
238
|
ensure
|
@@ -348,10 +350,6 @@ module Bundler
|
|
348
350
|
end
|
349
351
|
end
|
350
352
|
|
351
|
-
def loaded_from(spec)
|
352
|
-
"#{rubygems_dir}/specifications/#{spec.full_name}.gemspec"
|
353
|
-
end
|
354
|
-
|
355
353
|
def cached_gem(spec)
|
356
354
|
if spec.default_gem?
|
357
355
|
cached_built_in_gem(spec)
|
@@ -364,10 +362,14 @@ module Bundler
|
|
364
362
|
global_cache_path = download_cache_path(spec)
|
365
363
|
@caches << global_cache_path if global_cache_path
|
366
364
|
|
367
|
-
possibilities = @caches.map {|p|
|
365
|
+
possibilities = @caches.map {|p| package_path(p, spec) }
|
368
366
|
possibilities.find {|p| File.exist?(p) }
|
369
367
|
end
|
370
368
|
|
369
|
+
def package_path(cache_path, spec)
|
370
|
+
"#{cache_path}/#{spec.file_name}"
|
371
|
+
end
|
372
|
+
|
371
373
|
def normalize_uri(uri)
|
372
374
|
uri = uri.to_s
|
373
375
|
uri = "#{uri}/" unless uri =~ %r{/$}
|
@@ -459,12 +461,11 @@ module Bundler
|
|
459
461
|
end
|
460
462
|
|
461
463
|
def fetch_gem(spec, previous_spec = nil)
|
462
|
-
return false unless spec.remote
|
463
|
-
|
464
464
|
spec.fetch_platform
|
465
465
|
|
466
466
|
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
|
467
|
-
gem_path =
|
467
|
+
gem_path = package_path(cache_path, spec)
|
468
|
+
return gem_path if File.exist?(gem_path)
|
468
469
|
|
469
470
|
if requires_sudo?
|
470
471
|
download_path = Bundler.tmp(spec.full_name)
|
@@ -482,7 +483,7 @@ module Bundler
|
|
482
483
|
SharedHelpers.filesystem_access(cache_path) do |p|
|
483
484
|
Bundler.mkdir_p(p)
|
484
485
|
end
|
485
|
-
Bundler.sudo "mv #{download_cache_path
|
486
|
+
Bundler.sudo "mv #{package_path(download_cache_path, spec)} #{gem_path}"
|
486
487
|
end
|
487
488
|
|
488
489
|
gem_path
|
@@ -261,7 +261,7 @@ You can use `i` command instead of `install`.
|
|
261
261
|
return unless Gem::SourceFetchProblem === x
|
262
262
|
|
263
263
|
require_relative "../uri"
|
264
|
-
msg = "Unable to pull data from '#{Gem::Uri.
|
264
|
+
msg = "Unable to pull data from '#{Gem::Uri.redact(x.source.uri)}': #{x.error.message}"
|
265
265
|
|
266
266
|
alert_warning msg
|
267
267
|
end
|