summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/query_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
commit5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch)
treec63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/commands/query_command.rb
parent2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff)
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop https://github.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://github.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://github.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://github.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/query_command.rb')
-rw-r--r--lib/rubygems/commands/query_command.rb48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 4624e5a1e91..d947d588ef0 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -91,8 +91,8 @@ is too hard to use.
prerelease = options[:prerelease]
- unless options[:installed].nil? then
- if no_name then
+ unless options[:installed].nil?
+ if no_name
alert_error "You must specify a gem name"
exit_code |= 4
elsif name.count > 1
@@ -102,7 +102,7 @@ is too hard to use.
installed = installed? name.first, options[:version]
installed = !installed unless options[:installed]
- if installed then
+ if installed
say "true"
else
say "false"
@@ -119,8 +119,8 @@ is too hard to use.
private
- def display_header type
- if (ui.outs.tty? and Gem.configuration.verbose) or both? then
+ def display_header(type)
+ if (ui.outs.tty? and Gem.configuration.verbose) or both?
say
say "*** #{type} GEMS ***"
say
@@ -128,14 +128,14 @@ is too hard to use.
end
#Guts of original execute
- def show_gems name, prerelease
+ def show_gems(name, prerelease)
req = Gem::Requirement.default
# TODO: deprecate for real
dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
dep.prerelease = prerelease
- if local? then
- if prerelease and not both? then
+ if local?
+ if prerelease and not both?
alert_warning "prereleases are always shown locally"
end
@@ -152,7 +152,7 @@ is too hard to use.
output_query_results spec_tuples
end
- if remote? then
+ if remote?
display_header 'REMOTE'
fetcher = Gem::SpecFetcher.fetcher
@@ -205,7 +205,7 @@ is too hard to use.
say output.join(options[:details] ? "\n\n" : "\n")
end
- def output_versions output, versions
+ def output_versions(output, versions)
versions.each do |gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
@@ -218,7 +218,7 @@ is too hard to use.
seen = {}
matching_tuples.delete_if do |n,_|
- if seen[n.version] then
+ if seen[n.version]
true
else
seen[n.version] = true
@@ -230,7 +230,7 @@ is too hard to use.
end
end
- def entry_details entry, detail_tuple, specs, platforms
+ def entry_details(entry, detail_tuple, specs, platforms)
return unless options[:details]
name_tuple, spec = detail_tuple
@@ -247,11 +247,11 @@ is too hard to use.
spec_summary entry, spec
end
- def entry_versions entry, name_tuples, platforms, specs
+ def entry_versions(entry, name_tuples, platforms, specs)
return unless options[:versions]
list =
- if platforms.empty? or options[:details] then
+ if platforms.empty? or options[:details]
name_tuples.map { |n| n.version }.uniq
else
platforms.sort.reverse.map do |version, pls|
@@ -264,7 +264,7 @@ is too hard to use.
out = "default: #{out}" if default
end
- if pls != [Gem::Platform::RUBY] then
+ if pls != [Gem::Platform::RUBY]
platform_list = [pls.delete(Gem::Platform::RUBY), *pls.sort].compact
out = platform_list.unshift(out).join(' ')
end
@@ -276,7 +276,7 @@ is too hard to use.
entry << " (#{list.join ', '})"
end
- def make_entry entry_tuples, platforms
+ def make_entry(entry_tuples, platforms)
detail_tuple = entry_tuples.first
name_tuples, specs = entry_tuples.flatten.partition do |item|
@@ -291,19 +291,19 @@ is too hard to use.
entry.join
end
- def spec_authors entry, spec
+ def spec_authors(entry, spec)
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
authors << spec.authors.join(', ')
entry << format_text(authors, 68, 4)
end
- def spec_homepage entry, spec
+ def spec_homepage(entry, spec)
return if spec.homepage.nil? or spec.homepage.empty?
entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
end
- def spec_license entry, spec
+ def spec_license(entry, spec)
return if spec.license.nil? or spec.license.empty?
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
@@ -311,10 +311,10 @@ is too hard to use.
entry << "\n" << format_text(licenses, 68, 4)
end
- def spec_loaded_from entry, spec, specs
+ def spec_loaded_from(entry, spec, specs)
return unless spec.loaded_from
- if specs.length == 1 then
+ if specs.length == 1
default = spec.default_gem? ? ' (default)' : nil
entry << "\n" << " Installed at#{default}: #{spec.base_dir}"
else
@@ -328,14 +328,14 @@ is too hard to use.
end
end
- def spec_platforms entry, platforms
+ def spec_platforms(entry, platforms)
non_ruby = platforms.any? do |_, pls|
pls.any? { |pl| pl != Gem::Platform::RUBY }
end
return unless non_ruby
- if platforms.length == 1 then
+ if platforms.length == 1
title = platforms.values.length == 1 ? 'Platform' : 'Platforms'
entry << " #{title}: #{platforms.values.sort.join ', '}\n"
else
@@ -351,7 +351,7 @@ is too hard to use.
end
end
- def spec_summary entry, spec
+ def spec_summary(entry, spec)
summary = truncate_text(spec.summary, "the summary for #{spec.full_name}")
entry << "\n\n" << format_text(summary, 68, 4)
end