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