rubygems-update 3.3.19 → 3.3.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/Manifest.txt +11 -1
- data/bin/update_rubygems +1 -1
- data/bundler/CHANGELOG.md +71 -0
- data/bundler/UPGRADING.md +11 -4
- data/bundler/bundler.gemspec +6 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/install.rb +5 -2
- data/bundler/lib/bundler/cli/outdated.rb +12 -3
- data/bundler/lib/bundler/cli/platform.rb +1 -1
- data/bundler/lib/bundler/cli.rb +7 -4
- data/bundler/lib/bundler/current_ruby.rb +14 -5
- data/bundler/lib/bundler/definition.rb +85 -33
- data/bundler/lib/bundler/dependency.rb +18 -85
- data/bundler/lib/bundler/endpoint_specification.rb +2 -13
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher.rb +6 -6
- data/bundler/lib/bundler/gem_helpers.rb +7 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +8 -18
- data/bundler/lib/bundler/injector.rb +2 -1
- data/bundler/lib/bundler/inline.rb +1 -1
- data/bundler/lib/bundler/installer/standalone.rb +1 -1
- data/bundler/lib/bundler/installer.rb +14 -12
- data/bundler/lib/bundler/lazy_specification.rb +23 -25
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/man/bundle-add.1 +6 -2
- data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +13 -4
- data/bundler/lib/bundler/man/bundle-config.1.ronn +7 -4
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +5 -1
- data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +13 -8
- data/bundler/lib/bundler/man/bundle.1.ronn +10 -5
- data/bundler/lib/bundler/man/gemfile.5 +8 -38
- data/bundler/lib/bundler/man/gemfile.5.ronn +9 -27
- data/bundler/lib/bundler/man/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/plugin.rb +2 -0
- data/bundler/lib/bundler/remote_specification.rb +1 -7
- data/bundler/lib/bundler/resolver/base.rb +50 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +11 -8
- data/bundler/lib/bundler/resolver.rb +94 -88
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +5 -5
- data/bundler/lib/bundler/rubygems_ext.rb +52 -1
- data/bundler/lib/bundler/settings.rb +0 -1
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -0
- data/bundler/lib/bundler/spec_set.rb +41 -34
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +3 -4
- data/lib/rubygems/available_set.rb +3 -3
- data/lib/rubygems/basic_specification.rb +2 -2
- data/lib/rubygems/command.rb +6 -6
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/contents_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +4 -4
- data/lib/rubygems/commands/fetch_command.rb +2 -2
- data/lib/rubygems/commands/generate_index_command.rb +2 -2
- data/lib/rubygems/commands/install_command.rb +7 -7
- data/lib/rubygems/commands/pristine_command.rb +5 -5
- data/lib/rubygems/commands/setup_command.rb +4 -4
- data/lib/rubygems/commands/sources_command.rb +3 -3
- data/lib/rubygems/commands/specification_command.rb +2 -2
- data/lib/rubygems/commands/uninstall_command.rb +4 -4
- data/lib/rubygems/commands/update_command.rb +5 -5
- data/lib/rubygems/commands/which_command.rb +1 -1
- data/lib/rubygems/config_file.rb +7 -7
- data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +5 -5
- data/lib/rubygems/dependency_installer.rb +5 -5
- data/lib/rubygems/dependency_list.rb +4 -4
- data/lib/rubygems/doctor.rb +4 -4
- data/lib/rubygems/exceptions.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/indexer.rb +3 -3
- data/lib/rubygems/installer.rb +5 -13
- data/lib/rubygems/name_tuple.rb +3 -3
- data/lib/rubygems/package/tar_header.rb +17 -17
- data/lib/rubygems/package/tar_writer.rb +1 -1
- data/lib/rubygems/package.rb +19 -8
- data/lib/rubygems/platform.rb +30 -19
- data/lib/rubygems/query_utils.rb +8 -8
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request/connection_pools.rb +2 -2
- data/lib/rubygems/request/http_pool.rb +1 -1
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
- data/lib/rubygems/request_set/lockfile/parser.rb +12 -12
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +2 -2
- data/lib/rubygems/request_set.rb +3 -3
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/api_specification.rb +4 -4
- data/lib/rubygems/resolver/best_set.rb +3 -3
- data/lib/rubygems/resolver/conflict.rb +3 -3
- data/lib/rubygems/resolver/git_specification.rb +3 -3
- data/lib/rubygems/resolver/index_specification.rb +3 -2
- data/lib/rubygems/resolver/installed_specification.rb +2 -2
- data/lib/rubygems/resolver/installer_set.rb +7 -12
- data/lib/rubygems/resolver/lock_set.rb +1 -1
- data/lib/rubygems/resolver/lock_specification.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +3 -3
- data/lib/rubygems/resolver.rb +4 -4
- data/lib/rubygems/security/policy.rb +6 -6
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/source/git.rb +4 -4
- data/lib/rubygems/source.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +26 -24
- data/lib/rubygems/specification_policy.rb +4 -4
- data/lib/rubygems/uninstaller.rb +4 -4
- data/lib/rubygems/user_interaction.rb +2 -2
- data/lib/rubygems/version.rb +12 -4
- data/lib/rubygems.rb +8 -8
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -1
- data/test/rubygems/helper.rb +5 -7
- data/test/rubygems/test_gem_commands_info_command.rb +26 -0
- data/test/rubygems/test_gem_config_file.rb +17 -5
- data/test/rubygems/test_gem_dependency_installer.rb +2 -2
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +1 -1
- data/test/rubygems/test_gem_installer.rb +6 -3
- data/test/rubygems/test_gem_package.rb +22 -0
- data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
- data/test/rubygems/test_gem_platform.rb +73 -2
- data/test/rubygems/test_gem_requirement.rb +9 -3
- data/test/rubygems/test_gem_resolver.rb +37 -3
- data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +44 -0
- data/test/rubygems/test_gem_specification.rb +11 -2
- data/test/rubygems/test_gem_version.rb +9 -2
- data/test/rubygems/test_require.rb +1 -1
- data/test/rubygems/utilities.rb +4 -4
- metadata +14 -4
- data/bundler/lib/bundler/incomplete_specification.rb +0 -12
data/bundler/lib/bundler.rb
CHANGED
@@ -53,13 +53,12 @@ module Bundler
|
|
53
53
|
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
54
54
|
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
|
55
55
|
autoload :Graph, File.expand_path("bundler/graph", __dir__)
|
56
|
-
autoload :IncompleteSpecification, File.expand_path("bundler/incomplete_specification", __dir__)
|
57
56
|
autoload :Index, File.expand_path("bundler/index", __dir__)
|
58
57
|
autoload :Injector, File.expand_path("bundler/injector", __dir__)
|
59
58
|
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
60
59
|
autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
|
61
60
|
autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
|
62
|
-
autoload :
|
61
|
+
autoload :MatchRemoteMetadata, File.expand_path("bundler/match_remote_metadata", __dir__)
|
63
62
|
autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
|
64
63
|
autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
|
65
64
|
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
|
@@ -332,9 +331,9 @@ module Bundler
|
|
332
331
|
FileUtils.remove_entry_secure(path) if path && File.exist?(path)
|
333
332
|
rescue ArgumentError
|
334
333
|
message = <<EOF
|
335
|
-
It is a security vulnerability to allow your home directory to be world-writable, and bundler
|
334
|
+
It is a security vulnerability to allow your home directory to be world-writable, and bundler cannot continue.
|
336
335
|
You should probably consider fixing this issue by running `chmod o-w ~` on *nix.
|
337
|
-
Please refer to https://ruby-doc.org/stdlib-
|
336
|
+
Please refer to https://ruby-doc.org/stdlib-3.1.2/libdoc/fileutils/rdoc/FileUtils.html#method-c-remove_entry_secure for details.
|
338
337
|
EOF
|
339
338
|
File.world_writable?(path) ? Bundler.ui.warn(message) : raise
|
340
339
|
raise PathError, "Please fix the world-writable issue with your #{path} directory"
|
@@ -26,7 +26,7 @@ class Gem::AvailableSet
|
|
26
26
|
s = o.set
|
27
27
|
when Array
|
28
28
|
s = o.map do |sp,so|
|
29
|
-
if !sp.kind_of?(Gem::Specification)
|
29
|
+
if !sp.kind_of?(Gem::Specification) || !so.kind_of?(Gem::Source)
|
30
30
|
raise TypeError, "Array must be in [[spec, source], ...] form"
|
31
31
|
end
|
32
32
|
|
@@ -149,8 +149,8 @@ class Gem::AvailableSet
|
|
149
149
|
@set.reject! do |t|
|
150
150
|
# already locally installed
|
151
151
|
Gem::Specification.any? do |installed_spec|
|
152
|
-
dep.name == installed_spec.name
|
153
|
-
dep.requirement.satisfied_by?
|
152
|
+
dep.name == installed_spec.name &&
|
153
|
+
dep.requirement.satisfied_by?(installed_spec.version)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -77,7 +77,7 @@ class Gem::BasicSpecification
|
|
77
77
|
|
78
78
|
if Gem::Platform::RUBY == platform || Gem::Platform.local === platform
|
79
79
|
warn "Ignoring #{full_name} because its extensions are not built. " +
|
80
|
-
|
80
|
+
"Try: gem pristine #{name} --version #{version}"
|
81
81
|
end
|
82
82
|
|
83
83
|
return false
|
@@ -131,7 +131,7 @@ class Gem::BasicSpecification
|
|
131
131
|
# default Ruby platform.
|
132
132
|
|
133
133
|
def full_name
|
134
|
-
if platform == Gem::Platform::RUBY
|
134
|
+
if platform == Gem::Platform::RUBY || platform.nil?
|
135
135
|
"#{name}-#{version}".dup.tap(&Gem::UNTAINT)
|
136
136
|
else
|
137
137
|
"#{name}-#{version}-#{platform}".dup.tap(&Gem::UNTAINT)
|
data/lib/rubygems/command.rb
CHANGED
@@ -159,11 +159,11 @@ class Gem::Command
|
|
159
159
|
gem = "'#{gem_name}' (#{version})"
|
160
160
|
msg = String.new "Could not find a valid gem #{gem}"
|
161
161
|
|
162
|
-
if errors
|
162
|
+
if errors && !errors.empty?
|
163
163
|
msg << ", here is why:\n"
|
164
164
|
errors.each {|x| msg << " #{x.wordy}\n" }
|
165
165
|
else
|
166
|
-
if required_by
|
166
|
+
if required_by && gem != required_by
|
167
167
|
msg << " (required by #{required_by}) in any repository"
|
168
168
|
else
|
169
169
|
msg << " in any repository"
|
@@ -186,7 +186,7 @@ class Gem::Command
|
|
186
186
|
def get_all_gem_names
|
187
187
|
args = options[:args]
|
188
188
|
|
189
|
-
if args.nil?
|
189
|
+
if args.nil? || args.empty?
|
190
190
|
raise Gem::CommandLineError,
|
191
191
|
"Please specify at least one gem name (e.g. gem build GEMNAME)"
|
192
192
|
end
|
@@ -216,7 +216,7 @@ class Gem::Command
|
|
216
216
|
def get_one_gem_name
|
217
217
|
args = options[:args]
|
218
218
|
|
219
|
-
if args.nil?
|
219
|
+
if args.nil? || args.empty?
|
220
220
|
raise Gem::CommandLineError,
|
221
221
|
"Please specify a gem name on the command line (e.g. gem build GEMNAME)"
|
222
222
|
end
|
@@ -554,7 +554,7 @@ class Gem::Command
|
|
554
554
|
end
|
555
555
|
|
556
556
|
def configure_options(header, option_list)
|
557
|
-
return if option_list.nil?
|
557
|
+
return if option_list.nil? || option_list.empty?
|
558
558
|
|
559
559
|
header = header.to_s.empty? ? "" : "#{header} "
|
560
560
|
@parser.separator " #{header}Options:"
|
@@ -586,7 +586,7 @@ class Gem::Command
|
|
586
586
|
add_common_option("-V", "--[no-]verbose",
|
587
587
|
"Set the verbose level of output") do |value, options|
|
588
588
|
# Set us to "really verbose" so the progress meter works
|
589
|
-
if Gem.configuration.verbose
|
589
|
+
if Gem.configuration.verbose && value
|
590
590
|
Gem.configuration.verbose = 1
|
591
591
|
else
|
592
592
|
Gem.configuration.verbose = value
|
@@ -152,7 +152,7 @@ class Gem::Commands::CertCommand < Gem::Command
|
|
152
152
|
|
153
153
|
def build_cert(email, key) # :nodoc:
|
154
154
|
expiration_length_days = options[:expiration_length_days] ||
|
155
|
-
|
155
|
+
Gem.configuration.cert_expiration_length_days
|
156
156
|
|
157
157
|
cert = Gem::Security.create_cert_email(
|
158
158
|
email,
|
@@ -149,7 +149,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
|
|
149
149
|
@primary_gems = {}
|
150
150
|
|
151
151
|
Gem::Specification.each do |spec|
|
152
|
-
if @primary_gems[spec.name].nil?
|
152
|
+
if @primary_gems[spec.name].nil? ||
|
153
153
|
@primary_gems[spec.name].version < spec.version
|
154
154
|
@primary_gems[spec.name] = spec
|
155
155
|
end
|
@@ -77,7 +77,7 @@ use with other commands.
|
|
77
77
|
name_matches = name_pattern ? name_pattern =~ spec.name : true
|
78
78
|
version_matches = requirement.satisfied_by?(spec.version)
|
79
79
|
|
80
|
-
name_matches
|
80
|
+
name_matches && version_matches
|
81
81
|
}.map(&:to_spec)
|
82
82
|
end
|
83
83
|
|
@@ -133,7 +133,7 @@ use with other commands.
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def ensure_local_only_reverse_dependencies # :nodoc:
|
136
|
-
if options[:reverse_dependencies]
|
136
|
+
if options[:reverse_dependencies] && remote? && !local?
|
137
137
|
alert_error "Only reverse dependencies for local gems are supported."
|
138
138
|
terminate_interaction 1
|
139
139
|
end
|
@@ -182,7 +182,7 @@ use with other commands.
|
|
182
182
|
sp.dependencies.each do |dep|
|
183
183
|
dep = Gem::Dependency.new(*dep) unless Gem::Dependency === dep
|
184
184
|
|
185
|
-
if spec.name == dep.name
|
185
|
+
if spec.name == dep.name &&
|
186
186
|
dep.requirement.satisfied_by?(spec.version)
|
187
187
|
result << [sp.full_name, dep]
|
188
188
|
end
|
@@ -197,7 +197,7 @@ use with other commands.
|
|
197
197
|
def name_pattern(args)
|
198
198
|
return if args.empty?
|
199
199
|
|
200
|
-
if args.length == 1
|
200
|
+
if args.length == 1 && args.first =~ /\A(.*)(i)?\z/m
|
201
201
|
flags = $2 ? Regexp::IGNORECASE : nil
|
202
202
|
Regexp.new $1, flags
|
203
203
|
else
|
@@ -52,8 +52,8 @@ then repackaging it.
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def check_version # :nodoc:
|
55
|
-
if options[:version] != Gem::Requirement.default
|
56
|
-
|
55
|
+
if options[:version] != Gem::Requirement.default &&
|
56
|
+
get_all_gem_names.size > 1
|
57
57
|
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
|
58
58
|
" version requirements using `gem fetch 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
|
59
59
|
terminate_interaction 1
|
@@ -68,8 +68,8 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
|
|
68
68
|
# This is always true because it's the only way now.
|
69
69
|
options[:build_modern] = true
|
70
70
|
|
71
|
-
if
|
72
|
-
|
71
|
+
if !File.exist?(options[:directory]) ||
|
72
|
+
!File.directory?(options[:directory])
|
73
73
|
alert_error "unknown directory name #{options[:directory]}."
|
74
74
|
terminate_interaction 1
|
75
75
|
else
|
@@ -46,8 +46,8 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
46
46
|
|
47
47
|
def defaults_str # :nodoc:
|
48
48
|
"--both --version '#{Gem::Requirement.default}' --no-force\n" +
|
49
|
-
|
50
|
-
|
49
|
+
"--install-dir #{Gem.dir} --lock\n" +
|
50
|
+
install_update_defaults_str
|
51
51
|
end
|
52
52
|
|
53
53
|
def description # :nodoc:
|
@@ -134,15 +134,15 @@ You can use `i` command instead of `install`.
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def check_install_dir # :nodoc:
|
137
|
-
if options[:install_dir]
|
137
|
+
if options[:install_dir] && options[:user_install]
|
138
138
|
alert_error "Use --install-dir or --user-install but not both"
|
139
139
|
terminate_interaction 1
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
def check_version # :nodoc:
|
144
|
-
if options[:version] != Gem::Requirement.default
|
145
|
-
|
144
|
+
if options[:version] != Gem::Requirement.default &&
|
145
|
+
get_all_gem_names.size > 1
|
146
146
|
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
|
147
147
|
" version requirements using `gem install 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
|
148
148
|
terminate_interaction 1
|
@@ -191,8 +191,8 @@ You can use `i` command instead of `install`.
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def install_gem(name, version) # :nodoc:
|
194
|
-
return if options[:conservative]
|
195
|
-
|
194
|
+
return if options[:conservative] &&
|
195
|
+
!Gem::Dependency.new(name, version).matching_specs.empty?
|
196
196
|
|
197
197
|
req = Gem::Requirement.create(version)
|
198
198
|
|
@@ -102,10 +102,10 @@ extensions will be restored.
|
|
102
102
|
|
103
103
|
# `--extensions` must be explicitly given to pristine only gems
|
104
104
|
# with extensions.
|
105
|
-
elsif options[:extensions_set]
|
106
|
-
|
105
|
+
elsif options[:extensions_set] &&
|
106
|
+
options[:extensions] && options[:args].empty?
|
107
107
|
Gem::Specification.select do |spec|
|
108
|
-
spec.extensions
|
108
|
+
spec.extensions && !spec.extensions.empty?
|
109
109
|
end
|
110
110
|
else
|
111
111
|
get_all_gem_names.sort.map do |gem_name|
|
@@ -135,14 +135,14 @@ extensions will be restored.
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
unless spec.extensions.empty?
|
138
|
+
unless spec.extensions.empty? || options[:extensions] || options[:only_executables] || options[:only_plugins]
|
139
139
|
say "Skipped #{spec.full_name}, it needs to compile an extension"
|
140
140
|
next
|
141
141
|
end
|
142
142
|
|
143
143
|
gem = spec.cache_file
|
144
144
|
|
145
|
-
unless File.exist?
|
145
|
+
unless File.exist?(gem) || options[:only_executables] || options[:only_plugins]
|
146
146
|
require_relative "../remote_fetcher"
|
147
147
|
|
148
148
|
say "Cached gem for #{spec.full_name} not found, attempting to fetch..."
|
@@ -329,9 +329,9 @@ By default, this RubyGems will install gem as:
|
|
329
329
|
# ignore
|
330
330
|
end
|
331
331
|
|
332
|
-
if File.writable?
|
333
|
-
(
|
334
|
-
File.writable?
|
332
|
+
if File.writable?(gem_doc_dir) &&
|
333
|
+
(!File.exist?(rubygems_doc_dir) ||
|
334
|
+
File.writable?(rubygems_doc_dir))
|
335
335
|
say "Removing old RubyGems RDoc and ri" if @verbose
|
336
336
|
Dir[File.join(Gem.dir, "doc", "rubygems-[0-9]*")].each do |dir|
|
337
337
|
rm_rf dir
|
@@ -559,7 +559,7 @@ abort "#{deprecation_message}"
|
|
559
559
|
|
560
560
|
history_string = ""
|
561
561
|
|
562
|
-
until versions.length == 0
|
562
|
+
until versions.length == 0 ||
|
563
563
|
versions.shift <= options[:previous_version] do
|
564
564
|
history_string += version_lines.shift + text.shift
|
565
565
|
end
|
@@ -82,7 +82,7 @@ Do you want to add this source?
|
|
82
82
|
def check_rubygems_https(source_uri) # :nodoc:
|
83
83
|
uri = URI source_uri
|
84
84
|
|
85
|
-
if uri.scheme
|
85
|
+
if uri.scheme && uri.scheme.downcase == "http" &&
|
86
86
|
uri.host.downcase == "rubygems.org"
|
87
87
|
question = <<-QUESTION.chomp
|
88
88
|
https://rubygems.org is recommended for security over #{uri}
|
@@ -215,9 +215,9 @@ To remove a source use the --remove argument:
|
|
215
215
|
def remove_cache_file(desc, path) # :nodoc:
|
216
216
|
FileUtils.rm_rf path
|
217
217
|
|
218
|
-
if
|
218
|
+
if !File.exist?(path)
|
219
219
|
say "*** Removed #{desc} source cache ***"
|
220
|
-
elsif
|
220
|
+
elsif !File.writable?(path)
|
221
221
|
say "*** Unable to remove #{desc} source cache (write protected) ***"
|
222
222
|
else
|
223
223
|
say "*** Unable to remove #{desc} source cache ***"
|
@@ -88,7 +88,7 @@ Specific fields in the specification can be extracted in YAML format:
|
|
88
88
|
raise Gem::CommandLineError, "Unsupported version type: '#{v}'"
|
89
89
|
end
|
90
90
|
|
91
|
-
if !req.none?
|
91
|
+
if !req.none? && options[:all]
|
92
92
|
alert_error "Specify --all or -v, not both"
|
93
93
|
terminate_interaction 1
|
94
94
|
end
|
@@ -102,7 +102,7 @@ Specific fields in the specification can be extracted in YAML format:
|
|
102
102
|
field = get_one_optional_argument
|
103
103
|
|
104
104
|
raise Gem::CommandLineError, "--ruby and FIELD are mutually exclusive" if
|
105
|
-
field
|
105
|
+
field && options[:format] == :ruby
|
106
106
|
|
107
107
|
if local?
|
108
108
|
if File.exist? gem
|
@@ -96,7 +96,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|
96
96
|
|
97
97
|
def defaults_str # :nodoc:
|
98
98
|
"--version '#{Gem::Requirement.default}' --no-force " +
|
99
|
-
|
99
|
+
"--user-install"
|
100
100
|
end
|
101
101
|
|
102
102
|
def description # :nodoc:
|
@@ -114,8 +114,8 @@ that is a dependency of an existing gem. You can use the
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def check_version # :nodoc:
|
117
|
-
if options[:version] != Gem::Requirement.default
|
118
|
-
|
117
|
+
if options[:version] != Gem::Requirement.default &&
|
118
|
+
get_all_gem_names.size > 1
|
119
119
|
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
|
120
120
|
" version requirements using `gem uninstall 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
|
121
121
|
terminate_interaction 1
|
@@ -125,7 +125,7 @@ that is a dependency of an existing gem. You can use the
|
|
125
125
|
def execute
|
126
126
|
check_version
|
127
127
|
|
128
|
-
if options[:all]
|
128
|
+
if options[:all] && !options[:args].empty?
|
129
129
|
uninstall_specific
|
130
130
|
elsif options[:all]
|
131
131
|
uninstall_all
|
@@ -56,7 +56,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
56
56
|
|
57
57
|
def defaults_str # :nodoc:
|
58
58
|
"--no-force --install-dir #{Gem.dir}\n" +
|
59
|
-
|
59
|
+
install_update_defaults_str
|
60
60
|
end
|
61
61
|
|
62
62
|
def description # :nodoc:
|
@@ -155,7 +155,7 @@ command to remove old versions.
|
|
155
155
|
Gem::Specification.dirs = Gem.user_dir if options[:user_install]
|
156
156
|
|
157
157
|
Gem::Specification.each do |spec|
|
158
|
-
if hig[spec.name].nil?
|
158
|
+
if hig[spec.name].nil? || hig[spec.name].version < spec.version
|
159
159
|
hig[spec.name] = spec
|
160
160
|
end
|
161
161
|
end
|
@@ -292,8 +292,8 @@ command to remove old versions.
|
|
292
292
|
args << "--no-document" unless options[:document].include?("rdoc") || options[:document].include?("ri")
|
293
293
|
args << "--no-format-executable" if options[:no_format_executable]
|
294
294
|
args << "--previous-version" << Gem::VERSION if
|
295
|
-
options[:system] == true
|
296
|
-
|
295
|
+
options[:system] == true ||
|
296
|
+
Gem::Version.new(options[:system]) >= Gem::Version.new(2)
|
297
297
|
args
|
298
298
|
end
|
299
299
|
|
@@ -301,7 +301,7 @@ command to remove old versions.
|
|
301
301
|
result = []
|
302
302
|
|
303
303
|
highest_installed_gems.each do |l_name, l_spec|
|
304
|
-
next if
|
304
|
+
next if !gem_names.empty? &&
|
305
305
|
gem_names.none? {|name| name == l_spec.name }
|
306
306
|
|
307
307
|
highest_remote_tup = highest_remote_name_tuple l_spec
|
@@ -71,7 +71,7 @@ requiring to see why it does not behave as you expect.
|
|
71
71
|
dirs.each do |dir|
|
72
72
|
Gem.suffixes.each do |ext|
|
73
73
|
full_path = File.join dir, "#{package_name}#{ext}"
|
74
|
-
if File.exist?
|
74
|
+
if File.exist?(full_path) && !File.directory?(full_path)
|
75
75
|
result << full_path
|
76
76
|
return result unless options[:show_all]
|
77
77
|
end
|
data/lib/rubygems/config_file.rb
CHANGED
@@ -39,7 +39,7 @@ require "rbconfig"
|
|
39
39
|
class Gem::ConfigFile
|
40
40
|
include Gem::UserInteraction
|
41
41
|
|
42
|
-
DEFAULT_BACKTRACE =
|
42
|
+
DEFAULT_BACKTRACE = true
|
43
43
|
DEFAULT_BULK_THRESHOLD = 1000
|
44
44
|
DEFAULT_VERBOSITY = true
|
45
45
|
DEFAULT_UPDATE_SOURCES = true
|
@@ -368,7 +368,7 @@ if you believe they were disclosed to a third party.
|
|
368
368
|
|
369
369
|
# True if the backtrace option has been specified, or debug is on.
|
370
370
|
def backtrace
|
371
|
-
@backtrace
|
371
|
+
@backtrace || $DEBUG
|
372
372
|
end
|
373
373
|
|
374
374
|
# The name of the configuration file.
|
@@ -477,11 +477,11 @@ if you believe they were disclosed to a third party.
|
|
477
477
|
end
|
478
478
|
|
479
479
|
def ==(other) # :nodoc:
|
480
|
-
self.class === other
|
481
|
-
@backtrace == other.backtrace
|
482
|
-
@bulk_threshold == other.bulk_threshold
|
483
|
-
@verbose == other.verbose
|
484
|
-
@update_sources == other.update_sources
|
480
|
+
self.class === other &&
|
481
|
+
@backtrace == other.backtrace &&
|
482
|
+
@bulk_threshold == other.bulk_threshold &&
|
483
|
+
@verbose == other.verbose &&
|
484
|
+
@update_sources == other.update_sources &&
|
485
485
|
@hash == other.hash
|
486
486
|
end
|
487
487
|
|
@@ -39,7 +39,7 @@ if RUBY_VERSION >= "2.5" && !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
|
|
39
39
|
start += 1
|
40
40
|
|
41
41
|
if path = loc.path
|
42
|
-
unless path.start_with?(rubygems_path)
|
42
|
+
unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
|
43
43
|
# Non-rubygems frames
|
44
44
|
uplevel -= 1
|
45
45
|
end
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -161,7 +161,7 @@ module Gem
|
|
161
161
|
path = []
|
162
162
|
path << user_dir if user_home && File.exist?(user_home)
|
163
163
|
path << default_dir
|
164
|
-
path << vendor_dir if vendor_dir
|
164
|
+
path << vendor_dir if vendor_dir && File.directory?(vendor_dir)
|
165
165
|
path
|
166
166
|
end
|
167
167
|
|
data/lib/rubygems/dependency.rb
CHANGED
@@ -115,7 +115,7 @@ class Gem::Dependency
|
|
115
115
|
# What does this dependency require?
|
116
116
|
|
117
117
|
def requirement
|
118
|
-
return @requirement if defined?(@requirement)
|
118
|
+
return @requirement if defined?(@requirement) && @requirement
|
119
119
|
|
120
120
|
# @version_requirements and @version_requirement are legacy ivar
|
121
121
|
# names, and supported here because older gems need to keep
|
@@ -230,10 +230,10 @@ class Gem::Dependency
|
|
230
230
|
|
231
231
|
version = Gem::Version.new version
|
232
232
|
|
233
|
-
return true if requirement.none?
|
234
|
-
return false if version.prerelease?
|
235
|
-
|
236
|
-
|
233
|
+
return true if requirement.none? && !version.prerelease?
|
234
|
+
return false if version.prerelease? &&
|
235
|
+
!allow_prerelease &&
|
236
|
+
!prerelease?
|
237
237
|
|
238
238
|
requirement.satisfied_by? version
|
239
239
|
end
|
@@ -109,7 +109,7 @@ class Gem::DependencyInstaller
|
|
109
109
|
# gems should be considered.
|
110
110
|
|
111
111
|
def consider_local?
|
112
|
-
@domain == :both
|
112
|
+
@domain == :both || @domain == :local
|
113
113
|
end
|
114
114
|
|
115
115
|
##
|
@@ -117,7 +117,7 @@ class Gem::DependencyInstaller
|
|
117
117
|
# gems should be considered.
|
118
118
|
|
119
119
|
def consider_remote?
|
120
|
-
@domain == :both
|
120
|
+
@domain == :both || @domain == :remote
|
121
121
|
end
|
122
122
|
|
123
123
|
##
|
@@ -197,7 +197,7 @@ class Gem::DependencyInstaller
|
|
197
197
|
|
198
198
|
def in_background(what) # :nodoc:
|
199
199
|
fork_happened = false
|
200
|
-
if @build_docs_in_background
|
200
|
+
if @build_docs_in_background && Process.respond_to?(:fork)
|
201
201
|
begin
|
202
202
|
Process.fork do
|
203
203
|
yield
|
@@ -268,7 +268,7 @@ class Gem::DependencyInstaller
|
|
268
268
|
end
|
269
269
|
|
270
270
|
def install_development_deps # :nodoc:
|
271
|
-
if @development
|
271
|
+
if @development && @dev_shallow
|
272
272
|
:shallow
|
273
273
|
elsif @development
|
274
274
|
:all
|
@@ -289,7 +289,7 @@ class Gem::DependencyInstaller
|
|
289
289
|
installer_set.force = @force
|
290
290
|
|
291
291
|
if consider_local?
|
292
|
-
if dep_or_name =~ /\.gem$/
|
292
|
+
if dep_or_name =~ /\.gem$/ && File.file?(dep_or_name)
|
293
293
|
src = Gem::Source::SpecificFile.new dep_or_name
|
294
294
|
installer_set.add_local dep_or_name, src.spec, src
|
295
295
|
version = src.spec.version if version == Gem::Requirement.default
|
@@ -119,11 +119,11 @@ class Gem::DependencyList
|
|
119
119
|
each do |spec|
|
120
120
|
spec.runtime_dependencies.each do |dep|
|
121
121
|
inst = Gem::Specification.any? do |installed_spec|
|
122
|
-
dep.name == installed_spec.name
|
123
|
-
dep.requirement.satisfied_by?
|
122
|
+
dep.name == installed_spec.name &&
|
123
|
+
dep.requirement.satisfied_by?(installed_spec.version)
|
124
124
|
end
|
125
125
|
|
126
|
-
unless inst
|
126
|
+
unless inst || @specs.find {|s| s.satisfies_requirement? dep }
|
127
127
|
unsatisfied[spec.name] << dep
|
128
128
|
return unsatisfied if quick
|
129
129
|
end
|
@@ -175,7 +175,7 @@ class Gem::DependencyList
|
|
175
175
|
def remove_specs_unsatisfied_by(dependencies)
|
176
176
|
specs.reject! do |spec|
|
177
177
|
dep = dependencies[spec.name]
|
178
|
-
dep
|
178
|
+
dep && !dep.requirement.satisfied_by?(spec.version)
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
data/lib/rubygems/doctor.rb
CHANGED
@@ -30,7 +30,7 @@ class Gem::Doctor
|
|
30
30
|
|
31
31
|
missing =
|
32
32
|
Gem::REPOSITORY_SUBDIRECTORIES.sort -
|
33
|
-
|
33
|
+
REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort
|
34
34
|
|
35
35
|
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ', '}" unless
|
36
36
|
missing.empty?
|
@@ -59,7 +59,7 @@ class Gem::Doctor
|
|
59
59
|
# Are we doctoring a gem repository?
|
60
60
|
|
61
61
|
def gem_repository?
|
62
|
-
|
62
|
+
!installed_specs.empty?
|
63
63
|
end
|
64
64
|
|
65
65
|
##
|
@@ -111,8 +111,8 @@ class Gem::Doctor
|
|
111
111
|
basename = File.basename(child, extension)
|
112
112
|
next if installed_specs.include? basename
|
113
113
|
next if /^rubygems-\d/ =~ basename
|
114
|
-
next if "specifications" == sub_directory
|
115
|
-
next if "plugins" == sub_directory
|
114
|
+
next if "specifications" == sub_directory && "default" == basename
|
115
|
+
next if "plugins" == sub_directory && Gem.plugin_suffix_regexp =~ (basename)
|
116
116
|
|
117
117
|
type = File.directory?(child) ? "directory" : "file"
|
118
118
|
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -254,7 +254,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
|
|
254
254
|
# Gem::Resolver::DependencyRequest +dep+
|
255
255
|
|
256
256
|
def initialize(dep, platform_mismatch=nil)
|
257
|
-
if platform_mismatch
|
257
|
+
if platform_mismatch && !platform_mismatch.empty?
|
258
258
|
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
|
259
259
|
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
|
260
260
|
else
|
@@ -44,7 +44,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
44
44
|
full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
|
45
45
|
|
46
46
|
# TODO remove in RubyGems 4
|
47
|
-
if Gem.install_extension_in_lib
|
47
|
+
if Gem.install_extension_in_lib && lib_dir
|
48
48
|
FileUtils.mkdir_p lib_dir
|
49
49
|
entries = Dir.entries(full_tmp_dest) - %w[. ..]
|
50
50
|
entries = entries.map {|entry| File.join full_tmp_dest, entry }
|
@@ -53,7 +53,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
53
53
|
|
54
54
|
FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
|
55
55
|
destent = ent.class.new(dest_path, ent.rel)
|
56
|
-
destent.exist?
|
56
|
+
destent.exist? || FileUtils.mv(ent.path, destent.path)
|
57
57
|
end
|
58
58
|
ensure
|
59
59
|
ENV["DESTDIR"] = destdir
|
@@ -71,7 +71,7 @@ module Gem::GemcutterUtilities
|
|
71
71
|
begin
|
72
72
|
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
73
73
|
env_rubygems_host = nil if
|
74
|
-
env_rubygems_host
|
74
|
+
env_rubygems_host && env_rubygems_host.empty?
|
75
75
|
|
76
76
|
env_rubygems_host || configured_host
|
77
77
|
end
|