[rubygems/rubygems] util/rubocop -A --only Style/UnlessElse
https://github.com/rubygems/rubygems/commit/184c03270c
This commit is contained in:
parent
4868cfcf1d
commit
f4b073ef7a
@ -47,14 +47,14 @@ class Gem::Commands::CheckCommand < Gem::Command
|
||||
end
|
||||
|
||||
Gem::Validator.new.alien(gems).sort.each do |key, val|
|
||||
unless val.empty?
|
||||
if val.empty?
|
||||
say "#{key} is error-free" if Gem.configuration.verbose
|
||||
else
|
||||
say "#{key} has #{val.size} problems"
|
||||
val.each do |error_entry|
|
||||
say " #{error_entry.path}:"
|
||||
say " #{error_entry.problem}"
|
||||
end
|
||||
else
|
||||
say "#{key} is error-free" if Gem.configuration.verbose
|
||||
end
|
||||
say
|
||||
end
|
||||
|
@ -116,12 +116,12 @@ If no gems are named all gems in GEM_HOME are cleaned.
|
||||
end
|
||||
|
||||
def get_candidate_gems
|
||||
@candidate_gems = unless options[:args].empty?
|
||||
@candidate_gems = if options[:args].empty?
|
||||
Gem::Specification.to_a
|
||||
else
|
||||
options[:args].map do |gem_name|
|
||||
Gem::Specification.find_all_by_name gem_name
|
||||
end.flatten
|
||||
else
|
||||
Gem::Specification.to_a
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -98,16 +98,16 @@ Do you want to add this insecure source?
|
||||
path = Gem.spec_cache_dir
|
||||
FileUtils.rm_rf path
|
||||
|
||||
unless File.exist? path
|
||||
say "*** Removed specs cache ***"
|
||||
else
|
||||
unless File.writable? path
|
||||
say "*** Unable to remove source cache (write protected) ***"
|
||||
else
|
||||
if File.exist? path
|
||||
if File.writable? path
|
||||
say "*** Unable to remove source cache ***"
|
||||
else
|
||||
say "*** Unable to remove source cache (write protected) ***"
|
||||
end
|
||||
|
||||
terminate_interaction 1
|
||||
else
|
||||
say "*** Removed specs cache ***"
|
||||
end
|
||||
end
|
||||
|
||||
@ -193,13 +193,13 @@ To remove a source use the --remove argument:
|
||||
end
|
||||
|
||||
def remove_source(source_uri) # :nodoc:
|
||||
unless Gem.sources.include? source_uri
|
||||
say "source #{source_uri} not present in cache"
|
||||
else
|
||||
if Gem.sources.include? source_uri
|
||||
Gem.sources.delete source_uri
|
||||
Gem.configuration.write
|
||||
|
||||
say "#{source_uri} removed from sources"
|
||||
else
|
||||
say "source #{source_uri} not present in cache"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,16 +26,16 @@ module Gem
|
||||
rubylibdir
|
||||
].freeze
|
||||
|
||||
unless defined?(ConfigMap)
|
||||
if defined?(ConfigMap)
|
||||
RbConfigPriorities.each do |key|
|
||||
ConfigMap[key.to_sym] = RbConfig::CONFIG[key]
|
||||
end
|
||||
else
|
||||
##
|
||||
# Configuration settings from ::RbConfig
|
||||
ConfigMap = Hash.new do |cm, key|
|
||||
cm[key] = RbConfig::CONFIG[key.to_s]
|
||||
end
|
||||
deprecate_constant(:ConfigMap)
|
||||
else
|
||||
RbConfigPriorities.each do |key|
|
||||
ConfigMap[key.to_sym] = RbConfig::CONFIG[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -205,12 +205,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
||||
fetcher = Gem::RemoteFetcher.fetcher
|
||||
fetcher.instance_variable_set :@test_data, data
|
||||
|
||||
unless blow
|
||||
def fetcher.fetch_path(arg, *rest)
|
||||
@test_arg = arg
|
||||
@test_data
|
||||
end
|
||||
else
|
||||
if blow
|
||||
def fetcher.fetch_path(arg, *rest)
|
||||
# OMG I'm such an ass
|
||||
class << self; remove_method :fetch_path; end
|
||||
@ -221,6 +216,11 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
||||
|
||||
raise Gem::RemoteFetcher::FetchError.new("haha!", "")
|
||||
end
|
||||
else
|
||||
def fetcher.fetch_path(arg, *rest)
|
||||
@test_arg = arg
|
||||
@test_data
|
||||
end
|
||||
end
|
||||
|
||||
fetcher
|
||||
@ -653,15 +653,15 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
||||
|
||||
def fetcher.request(uri, request_class, last_modified = nil)
|
||||
url = "http://gems.example.com/redirect"
|
||||
unless defined? @requested
|
||||
@requested = true
|
||||
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
||||
res.add_field "Location", url
|
||||
else
|
||||
if defined? @requested
|
||||
res = Net::HTTPOK.new nil, 200, nil
|
||||
def res.body
|
||||
"real_path"
|
||||
end
|
||||
else
|
||||
@requested = true
|
||||
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
||||
res.add_field "Location", url
|
||||
end
|
||||
res
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user