rubygems-update 2.7.6 → 2.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -23
- data/History.txt +116 -0
- data/Manifest.txt +3 -3
- data/Rakefile +12 -2
- data/bundler/CHANGELOG.md +130 -0
- data/bundler/README.md +5 -1
- data/bundler/bundler.gemspec +2 -1
- data/bundler/lib/bundler.rb +12 -8
- data/bundler/lib/bundler/build_metadata.rb +19 -2
- data/bundler/lib/bundler/cli.rb +3 -1
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/exec.rb +4 -4
- data/bundler/lib/bundler/cli/gem.rb +5 -2
- data/bundler/lib/bundler/cli/init.rb +5 -0
- data/bundler/lib/bundler/cli/install.rb +2 -2
- data/bundler/lib/bundler/cli/outdated.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +3 -3
- data/bundler/lib/bundler/compact_index_client/updater.rb +10 -1
- data/bundler/lib/bundler/current_ruby.rb +8 -1
- data/bundler/lib/bundler/definition.rb +33 -23
- data/bundler/lib/bundler/dep_proxy.rb +2 -2
- data/bundler/lib/bundler/dependency.rb +1 -0
- data/bundler/lib/bundler/deprecate.rb +2 -1
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +10 -8
- data/bundler/lib/bundler/fetcher.rb +3 -3
- data/bundler/lib/bundler/fetcher/downloader.rb +10 -5
- data/bundler/lib/bundler/fetcher/index.rb +2 -2
- data/bundler/lib/bundler/friendly_errors.rb +2 -0
- data/bundler/lib/bundler/gem_helper.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +12 -0
- data/bundler/lib/bundler/injector.rb +5 -5
- data/bundler/lib/bundler/installer.rb +12 -4
- data/bundler/lib/bundler/installer/gem_installer.rb +9 -2
- data/bundler/lib/bundler/installer/parallel_installer.rb +1 -1
- data/bundler/lib/bundler/lazy_specification.rb +1 -1
- data/bundler/lib/bundler/mirror.rb +2 -2
- data/bundler/lib/bundler/plugin.rb +2 -2
- data/bundler/lib/bundler/plugin/index.rb +7 -2
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +10 -9
- data/bundler/lib/bundler/resolver/spec_group.rb +0 -5
- data/bundler/lib/bundler/ruby_version.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +9 -3
- data/bundler/lib/bundler/runtime.rb +2 -2
- data/bundler/lib/bundler/shared_helpers.rb +15 -3
- data/bundler/lib/bundler/source/git.rb +2 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +6 -1
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +11 -2
- data/bundler/lib/bundler/source/rubygems/remote.rb +4 -1
- data/bundler/lib/bundler/spec_set.rb +4 -1
- data/bundler/lib/bundler/templates/Executable +1 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
- data/bundler/lib/bundler/templates/newgem/travis.yml.tt +2 -0
- data/bundler/lib/bundler/ui/shell.rb +3 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-binstubs.ronn +3 -3
- data/bundler/man/bundle-check.ronn +3 -3
- data/bundler/man/bundle-config.ronn +13 -9
- data/bundler/man/bundle-doctor.ronn +33 -0
- data/bundler/man/bundle-exec.ronn +3 -3
- data/bundler/man/bundle-gem.ronn +1 -1
- data/bundler/man/bundle-init.ronn +15 -4
- data/bundler/man/bundle-inject.ronn +3 -3
- data/bundler/man/bundle-install.ronn +12 -3
- data/bundler/man/bundle-lock.ronn +1 -1
- data/bundler/man/bundle-outdated.ronn +1 -1
- data/bundler/man/bundle-package.ronn +3 -3
- data/bundler/man/bundle-show.ronn +3 -2
- data/bundler/man/bundle-update.ronn +18 -14
- data/bundler/man/bundle-viz.ronn +1 -1
- data/bundler/man/bundle.ronn +27 -27
- data/bundler/man/gemfile.5.ronn +24 -9
- data/lib/rubygems.rb +24 -11
- data/lib/rubygems/bundler_version_finder.rb +9 -22
- data/lib/rubygems/command_manager.rb +6 -4
- data/lib/rubygems/commands/install_command.rb +7 -0
- data/lib/rubygems/commands/owner_command.rb +4 -1
- data/lib/rubygems/commands/push_command.rb +37 -4
- data/lib/rubygems/commands/setup_command.rb +3 -3
- data/lib/rubygems/commands/uninstall_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +2 -7
- data/lib/rubygems/dependency.rb +1 -0
- data/lib/rubygems/dependency_installer.rb +4 -2
- data/lib/rubygems/exceptions.rb +5 -1
- data/lib/rubygems/gemcutter_utilities.rb +5 -2
- data/lib/rubygems/indexer.rb +1 -1
- data/lib/rubygems/install_update_options.rb +1 -1
- data/lib/rubygems/installer.rb +29 -6
- data/lib/rubygems/package.rb +20 -2
- data/lib/rubygems/package/tar_header.rb +3 -1
- data/lib/rubygems/package/tar_writer.rb +2 -3
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/request_set.rb +28 -17
- data/lib/rubygems/requirement.rb +14 -3
- data/lib/rubygems/resolver/api_specification.rb +5 -0
- data/lib/rubygems/security.rb +6 -1
- data/lib/rubygems/server.rb +3 -3
- data/lib/rubygems/source.rb +1 -1
- data/lib/rubygems/specification.rb +7 -10
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/test_case.rb +22 -4
- data/lib/rubygems/test_utilities.rb +1 -1
- data/lib/rubygems/user_interaction.rb +9 -2
- data/lib/rubygems/util/licenses.rb +35 -4
- data/lib/rubygems/version.rb +7 -1
- data/lib/ubygems.rb +3 -0
- data/test/rubygems/test_bundled_ca.rb +7 -4
- data/test/rubygems/test_gem.rb +45 -10
- data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
- data/test/rubygems/test_gem_command_manager.rb +2 -2
- data/test/rubygems/test_gem_commands_build_command.rb +2 -0
- data/test/rubygems/test_gem_commands_install_command.rb +37 -0
- data/test/rubygems/test_gem_commands_push_command.rb +20 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +6 -1
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
- data/test/rubygems/test_gem_dependency.rb +1 -1
- data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
- data/test/rubygems/test_gem_install_update_options.rb +2 -0
- data/test/rubygems/test_gem_installer.rb +109 -3
- data/test/rubygems/test_gem_package.rb +90 -5
- data/test/rubygems/test_gem_package_tar_header.rb +2 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +6 -2
- data/test/rubygems/test_gem_request.rb +5 -2
- data/test/rubygems/test_gem_requirement.rb +6 -0
- data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
- data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
- data/test/rubygems/test_gem_security_policy.rb +3 -3
- data/test/rubygems/test_gem_server.rb +12 -12
- data/test/rubygems/test_gem_specification.rb +27 -13
- data/test/rubygems/test_gem_stream_ui.rb +2 -2
- data/test/rubygems/test_gem_text.rb +5 -0
- data/test/rubygems/test_gem_util.rb +4 -2
- data/test/rubygems/test_gem_version.rb +29 -2
- data/util/ci +1 -0
- data/util/generate_spdx_license_list.rb +15 -6
- data/util/update_bundled_ca_certificates.rb +1 -3
- metadata +12 -12
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -1,13 +1,8 @@
|
|
1
|
-
|
2
|
-
@without_filtering = false
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
without_filtering, @without_filtering = true, @without_filtering
|
6
|
-
yield
|
7
|
-
ensure
|
8
|
-
@without_filtering = without_filtering
|
9
|
-
end
|
3
|
+
require "rubygems/util"
|
10
4
|
|
5
|
+
module Gem::BundlerVersionFinder
|
11
6
|
def self.bundler_version
|
12
7
|
version, _ = bundler_version_with_reason
|
13
8
|
|
@@ -17,8 +12,6 @@ module Gem::BundlerVersionFinder
|
|
17
12
|
end
|
18
13
|
|
19
14
|
def self.bundler_version_with_reason
|
20
|
-
return if @without_filtering
|
21
|
-
|
22
15
|
if v = ENV["BUNDLER_VERSION"]
|
23
16
|
return [v, "`$BUNDLER_VERSION`"]
|
24
17
|
end
|
@@ -36,7 +29,7 @@ module Gem::BundlerVersionFinder
|
|
36
29
|
return unless vr = bundler_version_with_reason
|
37
30
|
<<-EOS
|
38
31
|
Could not find 'bundler' (#{vr.first}) required by #{vr.last}.
|
39
|
-
To update to the
|
32
|
+
To update to the latest version installed on your system, run `bundle update --bundler`.
|
40
33
|
To install the missing version, run `gem install bundler:#{vr.first}`
|
41
34
|
EOS
|
42
35
|
end
|
@@ -44,20 +37,14 @@ To install the missing version, run `gem install bundler:#{vr.first}`
|
|
44
37
|
def self.compatible?(spec)
|
45
38
|
return true unless spec.name == "bundler".freeze
|
46
39
|
return true unless bundler_version = self.bundler_version
|
47
|
-
|
48
|
-
|
49
|
-
else # 1.x
|
50
|
-
spec.version.segments.first < 2
|
51
|
-
end
|
40
|
+
|
41
|
+
spec.version.segments.first == bundler_version.segments.first
|
52
42
|
end
|
53
43
|
|
54
44
|
def self.filter!(specs)
|
55
45
|
return unless bundler_version = self.bundler_version
|
56
|
-
|
57
|
-
|
58
|
-
else # 1.x
|
59
|
-
specs.reject! { |spec| spec.version.segments.first >= 2}
|
60
|
-
end
|
46
|
+
|
47
|
+
specs.reject! { |spec| spec.version.segments.first != bundler_version.segments.first }
|
61
48
|
end
|
62
49
|
|
63
50
|
def self.bundle_update_bundler_version
|
@@ -102,7 +89,7 @@ To install the missing version, run `gem install bundler:#{vr.first}`
|
|
102
89
|
lockfile = case gemfile
|
103
90
|
when "gems.rb" then "gems.locked"
|
104
91
|
else "#{gemfile}.lock"
|
105
|
-
end.untaint
|
92
|
+
end.dup.untaint
|
106
93
|
|
107
94
|
return unless File.file?(lockfile)
|
108
95
|
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
require 'rubygems/command'
|
9
9
|
require 'rubygems/user_interaction'
|
10
|
+
require 'rubygems/text'
|
10
11
|
|
11
12
|
##
|
12
13
|
# The command manager registers and installs all the individual sub-commands
|
@@ -32,6 +33,7 @@ require 'rubygems/user_interaction'
|
|
32
33
|
|
33
34
|
class Gem::CommandManager
|
34
35
|
|
36
|
+
include Gem::Text
|
35
37
|
include Gem::UserInteraction
|
36
38
|
|
37
39
|
BUILTIN_COMMANDS = [ # :nodoc:
|
@@ -140,12 +142,12 @@ class Gem::CommandManager
|
|
140
142
|
def run(args, build_args=nil)
|
141
143
|
process_args(args, build_args)
|
142
144
|
rescue StandardError, Timeout::Error => ex
|
143
|
-
alert_error "While executing gem ... (#{ex.class})\n #{ex}"
|
145
|
+
alert_error clean_text("While executing gem ... (#{ex.class})\n #{ex}")
|
144
146
|
ui.backtrace ex
|
145
147
|
|
146
148
|
terminate_interaction(1)
|
147
149
|
rescue Interrupt
|
148
|
-
alert_error "Interrupted"
|
150
|
+
alert_error clean_text("Interrupted")
|
149
151
|
terminate_interaction(1)
|
150
152
|
end
|
151
153
|
|
@@ -163,7 +165,7 @@ class Gem::CommandManager
|
|
163
165
|
say Gem::VERSION
|
164
166
|
terminate_interaction 0
|
165
167
|
when /^-/ then
|
166
|
-
alert_error "Invalid option: #{args.first}. See 'gem --help'."
|
168
|
+
alert_error clean_text("Invalid option: #{args.first}. See 'gem --help'.")
|
167
169
|
terminate_interaction 1
|
168
170
|
else
|
169
171
|
cmd_name = args.shift.downcase
|
@@ -212,7 +214,7 @@ class Gem::CommandManager
|
|
212
214
|
rescue Exception => e
|
213
215
|
e = load_error if load_error
|
214
216
|
|
215
|
-
alert_error "Loading command: #{command_name} (#{e.class})\n\t#{e}"
|
217
|
+
alert_error clean_text("Loading command: #{command_name} (#{e.class})\n\t#{e}")
|
216
218
|
ui.backtrace e
|
217
219
|
end
|
218
220
|
end
|
@@ -2,8 +2,11 @@
|
|
2
2
|
require 'rubygems/command'
|
3
3
|
require 'rubygems/local_remote_options'
|
4
4
|
require 'rubygems/gemcutter_utilities'
|
5
|
+
require 'rubygems/text'
|
5
6
|
|
6
7
|
class Gem::Commands::OwnerCommand < Gem::Command
|
8
|
+
|
9
|
+
include Gem::Text
|
7
10
|
include Gem::LocalRemoteOptions
|
8
11
|
include Gem::GemcutterUtilities
|
9
12
|
|
@@ -64,7 +67,7 @@ permission to.
|
|
64
67
|
end
|
65
68
|
|
66
69
|
with_response response do |resp|
|
67
|
-
owners = Gem::SafeYAML.load resp.body
|
70
|
+
owners = Gem::SafeYAML.load clean_text(resp.body)
|
68
71
|
|
69
72
|
say "Owners for gem: #{name}"
|
70
73
|
owners.each do |owner|
|
@@ -13,7 +13,7 @@ class Gem::Commands::PushCommand < Gem::Command
|
|
13
13
|
The push command uploads a gem to the push server (the default is
|
14
14
|
https://rubygems.org) and adds it to the index.
|
15
15
|
|
16
|
-
The gem can be removed from the index
|
16
|
+
The gem can be removed from the index and deleted from the server using the yank
|
17
17
|
command. For further discussion see the help for the yank command.
|
18
18
|
EOF
|
19
19
|
end
|
@@ -29,6 +29,8 @@ command. For further discussion see the help for the yank command.
|
|
29
29
|
def initialize
|
30
30
|
super 'push', 'Push a gem up to the gem server', :host => self.host
|
31
31
|
|
32
|
+
@user_defined_host = false
|
33
|
+
|
32
34
|
add_proxy_option
|
33
35
|
add_key_option
|
34
36
|
|
@@ -36,20 +38,41 @@ command. For further discussion see the help for the yank command.
|
|
36
38
|
'Push to another gemcutter-compatible host',
|
37
39
|
' (e.g. https://rubygems.org)') do |value, options|
|
38
40
|
options[:host] = value
|
41
|
+
@user_defined_host = true
|
39
42
|
end
|
40
43
|
|
41
44
|
@host = nil
|
42
45
|
end
|
43
46
|
|
44
47
|
def execute
|
45
|
-
|
48
|
+
gem_name = get_one_gem_name
|
49
|
+
default_gem_server, push_host = get_hosts_for(gem_name)
|
50
|
+
|
51
|
+
default_host = nil
|
52
|
+
user_defined_host = nil
|
53
|
+
|
54
|
+
if @user_defined_host
|
55
|
+
user_defined_host = options[:host]
|
56
|
+
else
|
57
|
+
default_host = options[:host]
|
58
|
+
end
|
59
|
+
|
60
|
+
@host = if user_defined_host
|
61
|
+
user_defined_host
|
62
|
+
elsif default_gem_server
|
63
|
+
default_gem_server
|
64
|
+
elsif push_host
|
65
|
+
push_host
|
66
|
+
else
|
67
|
+
default_host
|
68
|
+
end
|
46
69
|
|
47
70
|
sign_in @host
|
48
71
|
|
49
|
-
send_gem
|
72
|
+
send_gem(gem_name)
|
50
73
|
end
|
51
74
|
|
52
|
-
def send_gem
|
75
|
+
def send_gem(name)
|
53
76
|
args = [:post, "api/v1/gems"]
|
54
77
|
|
55
78
|
latest_rubygems_version = Gem.latest_rubygems_version
|
@@ -100,5 +123,15 @@ You can upgrade or downgrade to the latest release version with:
|
|
100
123
|
with_response response
|
101
124
|
end
|
102
125
|
|
126
|
+
private
|
127
|
+
|
128
|
+
def get_hosts_for(name)
|
129
|
+
gem_metadata = Gem::Package.new(name).spec.metadata
|
130
|
+
|
131
|
+
[
|
132
|
+
gem_metadata["default_gem_server"],
|
133
|
+
gem_metadata["allowed_push_host"]
|
134
|
+
]
|
135
|
+
end
|
103
136
|
end
|
104
137
|
|
@@ -351,7 +351,7 @@ By default, this RubyGems will install gem as:
|
|
351
351
|
return unless Gem::USE_BUNDLER_FOR_GEMDEPS
|
352
352
|
|
353
353
|
specs_dir = Gem::Specification.default_specifications_dir
|
354
|
-
File.join(options[:destdir], specs_dir) unless Gem.win_platform?
|
354
|
+
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
|
355
355
|
mkdir_p specs_dir
|
356
356
|
|
357
357
|
# Workaround for non-git environment.
|
@@ -385,8 +385,8 @@ By default, this RubyGems will install gem as:
|
|
385
385
|
each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
|
386
386
|
end
|
387
387
|
|
388
|
-
bundler_bin_dir =
|
389
|
-
File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
|
388
|
+
bundler_bin_dir = bundler_spec.bin_dir
|
389
|
+
bundler_bin_dir = File.join(options[:destdir], bundler_bin_dir) unless Gem.win_platform?
|
390
390
|
mkdir_p bundler_bin_dir
|
391
391
|
bundler_spec.executables.each do |e|
|
392
392
|
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
|
@@ -48,7 +48,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|
48
48
|
end
|
49
49
|
|
50
50
|
add_option('-n', '--bindir DIR',
|
51
|
-
'Directory to remove
|
51
|
+
'Directory to remove executables from') do |value, options|
|
52
52
|
options[:bin_dir] = File.expand_path(value)
|
53
53
|
end
|
54
54
|
|
@@ -11,13 +11,8 @@ module Kernel
|
|
11
11
|
|
12
12
|
RUBYGEMS_ACTIVATION_MONITOR = Monitor.new # :nodoc:
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
remove_method :require
|
17
|
-
else
|
18
|
-
##
|
19
|
-
# The Kernel#require from before RubyGems was loaded.
|
20
|
-
|
14
|
+
# Make sure we have a reference to Ruby's original Kernel#require
|
15
|
+
unless defined?(gem_original_require)
|
21
16
|
alias gem_original_require require
|
22
17
|
private :gem_original_require
|
23
18
|
end
|
data/lib/rubygems/dependency.rb
CHANGED
@@ -113,7 +113,7 @@ class Gem::DependencyInstaller
|
|
113
113
|
|
114
114
|
##
|
115
115
|
#--
|
116
|
-
# TODO remove, no longer used
|
116
|
+
# TODO remove at RubyGems 4, no longer used
|
117
117
|
|
118
118
|
def add_found_dependencies to_do, dependency_list # :nodoc:
|
119
119
|
seen = {}
|
@@ -163,6 +163,7 @@ class Gem::DependencyInstaller
|
|
163
163
|
|
164
164
|
dependency_list.remove_specs_unsatisfied_by dependencies
|
165
165
|
end
|
166
|
+
deprecate :add_found_dependencies, :none, 2018, 12
|
166
167
|
|
167
168
|
##
|
168
169
|
# Creates an AvailableSet to install from based on +dep_or_name+ and
|
@@ -321,7 +322,7 @@ class Gem::DependencyInstaller
|
|
321
322
|
# Gathers all dependencies necessary for the installation from local and
|
322
323
|
# remote sources unless the ignore_dependencies was given.
|
323
324
|
#--
|
324
|
-
# TODO remove at RubyGems
|
325
|
+
# TODO remove at RubyGems 4
|
325
326
|
|
326
327
|
def gather_dependencies # :nodoc:
|
327
328
|
specs = @available.all_specs
|
@@ -354,6 +355,7 @@ class Gem::DependencyInstaller
|
|
354
355
|
|
355
356
|
@gems_to_install = dependency_list.dependency_order.reverse
|
356
357
|
end
|
358
|
+
deprecate :gather_dependencies, :none, 2018, 12
|
357
359
|
|
358
360
|
def in_background what # :nodoc:
|
359
361
|
fork_happened = false
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
# Each exception needs a brief description and the scenarios where it is
|
5
5
|
# likely to be raised
|
6
6
|
|
7
|
+
require 'rubygems/deprecate'
|
8
|
+
|
7
9
|
##
|
8
10
|
# Base exception class for RubyGems. All exception raised by RubyGems are a
|
9
11
|
# subclass of this one.
|
@@ -11,10 +13,12 @@ class Gem::Exception < RuntimeError
|
|
11
13
|
|
12
14
|
##
|
13
15
|
#--
|
14
|
-
# TODO: remove in RubyGems
|
16
|
+
# TODO: remove in RubyGems 4, nobody sets this
|
15
17
|
|
16
18
|
attr_accessor :source_exception # :nodoc:
|
17
19
|
|
20
|
+
extend Gem::Deprecate
|
21
|
+
deprecate :source_exception, :none, 2018, 12
|
18
22
|
end
|
19
23
|
|
20
24
|
class Gem::CommandLineError < Gem::Exception; end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rubygems/remote_fetcher'
|
3
|
+
require 'rubygems/text'
|
3
4
|
|
4
5
|
##
|
5
6
|
# Utility methods for using the RubyGems API.
|
6
7
|
|
7
8
|
module Gem::GemcutterUtilities
|
8
9
|
|
10
|
+
include Gem::Text
|
11
|
+
|
9
12
|
# TODO: move to Gem::Command
|
10
13
|
OptionParser.accept Symbol do |value|
|
11
14
|
value.to_sym
|
@@ -145,13 +148,13 @@ module Gem::GemcutterUtilities
|
|
145
148
|
if block_given? then
|
146
149
|
yield response
|
147
150
|
else
|
148
|
-
say response.body
|
151
|
+
say clean_text(response.body)
|
149
152
|
end
|
150
153
|
else
|
151
154
|
message = response.body
|
152
155
|
message = "#{error_prefix}: #{message}" if error_prefix
|
153
156
|
|
154
|
-
say message
|
157
|
+
say clean_text(message)
|
155
158
|
terminate_interaction 1 # TODO: question this
|
156
159
|
end
|
157
160
|
end
|
data/lib/rubygems/indexer.rb
CHANGED
@@ -347,7 +347,7 @@ class Gem::Indexer
|
|
347
347
|
data = Gem.read_binary path
|
348
348
|
compressed_data = Gem.read_binary "#{path}.#{extension}"
|
349
349
|
|
350
|
-
unless data == Gem.inflate(compressed_data) then
|
350
|
+
unless data == Gem::Util.inflate(compressed_data) then
|
351
351
|
raise "Compressed file #{compressed_path} does not match uncompressed file #{path}"
|
352
352
|
end
|
353
353
|
end
|
@@ -25,7 +25,7 @@ module Gem::InstallUpdateOptions
|
|
25
25
|
end
|
26
26
|
|
27
27
|
add_option(:"Install/Update", '-n', '--bindir DIR',
|
28
|
-
'Directory where
|
28
|
+
'Directory where executables are',
|
29
29
|
'located') do |value, options|
|
30
30
|
options[:bin_dir] = File.expand_path(value)
|
31
31
|
end
|
data/lib/rubygems/installer.rb
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
require 'rubygems/command'
|
9
9
|
require 'rubygems/exceptions'
|
10
|
+
require 'rubygems/deprecate'
|
10
11
|
require 'rubygems/package'
|
11
12
|
require 'rubygems/ext'
|
12
13
|
require 'rubygems/user_interaction'
|
@@ -27,6 +28,8 @@ require 'fileutils'
|
|
27
28
|
|
28
29
|
class Gem::Installer
|
29
30
|
|
31
|
+
extend Gem::Deprecate
|
32
|
+
|
30
33
|
##
|
31
34
|
# Paths where env(1) might live. Some systems are broken and have it in
|
32
35
|
# /bin
|
@@ -707,9 +710,26 @@ class Gem::Installer
|
|
707
710
|
unpack or File.writable?(gem_home)
|
708
711
|
end
|
709
712
|
|
710
|
-
def
|
711
|
-
|
712
|
-
|
713
|
+
def verify_spec
|
714
|
+
unless spec.name =~ Gem::Specification::VALID_NAME_PATTERN
|
715
|
+
raise Gem::InstallError, "#{spec} has an invalid name"
|
716
|
+
end
|
717
|
+
|
718
|
+
if spec.raw_require_paths.any?{|path| path =~ /\r\n|\r|\n/ }
|
719
|
+
raise Gem::InstallError, "#{spec} has an invalid require_paths"
|
720
|
+
end
|
721
|
+
|
722
|
+
if spec.extensions.any?{|ext| ext =~ /\r\n|\r|\n/ }
|
723
|
+
raise Gem::InstallError, "#{spec} has an invalid extensions"
|
724
|
+
end
|
725
|
+
|
726
|
+
unless spec.specification_version.to_s =~ /\A\d+\z/
|
727
|
+
raise Gem::InstallError, "#{spec} has an invalid specification_version"
|
728
|
+
end
|
729
|
+
|
730
|
+
if spec.dependencies.any? {|dep| dep.type =~ /\r\n|\r|\n/ || dep.name =~ /\r\n|\r|\n/ }
|
731
|
+
raise Gem::InstallError, "#{spec} has an invalid dependencies"
|
732
|
+
end
|
713
733
|
end
|
714
734
|
|
715
735
|
##
|
@@ -777,13 +797,14 @@ TEXT
|
|
777
797
|
##
|
778
798
|
# Logs the build +output+ in +build_dir+, then raises Gem::Ext::BuildError.
|
779
799
|
#
|
780
|
-
# TODO: Delete this for RubyGems
|
800
|
+
# TODO: Delete this for RubyGems 4. It remains for API compatibility
|
781
801
|
|
782
802
|
def extension_build_error(build_dir, output, backtrace = nil) # :nodoc:
|
783
803
|
builder = Gem::Ext::Builder.new spec, @build_args
|
784
804
|
|
785
805
|
builder.build_error build_dir, output, backtrace
|
786
806
|
end
|
807
|
+
deprecate :extension_build_error, :none, 2018, 12
|
787
808
|
|
788
809
|
##
|
789
810
|
# Reads the file index and extracts each file into the gem directory.
|
@@ -836,9 +857,11 @@ TEXT
|
|
836
857
|
def pre_install_checks
|
837
858
|
verify_gem_home options[:unpack]
|
838
859
|
|
839
|
-
|
860
|
+
# The name and require_paths must be verified first, since it could contain
|
861
|
+
# ruby code that would be eval'ed in #ensure_loadable_spec
|
862
|
+
verify_spec
|
840
863
|
|
841
|
-
|
864
|
+
ensure_loadable_spec
|
842
865
|
|
843
866
|
if options[:install_as_default]
|
844
867
|
Gem.ensure_default_gem_subdirectories gem_home
|