summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorximenasandoval <ximena.sandoval.dh@gmail.com>2022-01-04 17:16:40 -0700
committergit <svn-admin@ruby-lang.org>2022-01-06 23:58:39 +0900
commit73be7a85cd4da6229f9a898b77492357e3811210 (patch)
treed4c8557e34c42f3b1f24193fbf49c7c6d100203e /lib
parentcea4a81056311f13ca1c17f26c9d2c21b5a017a6 (diff)
[rubygems/rubygems] Fix suggestions flag
https://github.com/rubygems/rubygems/commit/b55a1393ca
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/fetch_command.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index dd45fe20fd..c8ecb0d48c 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -8,7 +8,12 @@ class Gem::Commands::FetchCommand < Gem::Command
include Gem::VersionOption
def initialize
- super 'fetch', 'Download a gem and place it in the current directory'
+ defaults = {
+ :suggest_alternate => true,
+ :version => Gem::Requirement.default,
+ }
+
+ super 'fetch', 'Download a gem and place it in the current directory', defaults
add_bulk_threshold_option
add_proxy_option
@@ -20,7 +25,7 @@ class Gem::Commands::FetchCommand < Gem::Command
add_prerelease_option
add_option '--[no-]suggestions', 'Suggest alternates when gems are not found' do |value, options|
- options[:suggest_alternate] = true
+ options[:suggest_alternate] = value
end
end
@@ -47,7 +52,7 @@ then repackaging it.
end
def check_version # :nodoc:
- if options[:version] and options[:version] != Gem::Requirement.default and
+ if options[:version] != Gem::Requirement.default and
get_all_gem_names.size > 1
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
" version requirements using `gem fetch 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
@@ -66,7 +71,7 @@ then repackaging it.
gem_version ||= version
dep = Gem::Dependency.new gem_name, gem_version
dep.prerelease = options[:prerelease]
- suppress_suggestions = options[:suggest_alternate]
+ suppress_suggestions = !options[:suggest_alternate]
specs_and_sources, errors =
Gem::SpecFetcher.fetcher.spec_for_dependency dep