* lib/rubygems/*: Remove unused variables warnings

Patch by Run Paint [ruby-core:30991]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2010-11-08 20:58:42 +00:00
Родитель 571ed8655f
Коммит cceca83afe
12 изменённых файлов: 17 добавлений и 19 удалений

Просмотреть файл

@ -168,7 +168,7 @@ class Gem::Command
"Please specify at least one gem name (e.g. gem build GEMNAME)" "Please specify at least one gem name (e.g. gem build GEMNAME)"
end end
gem_names = args.select { |arg| arg !~ /^-/ } args.select { |arg| arg !~ /^-/ }
end end
## ##
@ -430,7 +430,7 @@ class Gem::Command
@parser.separator " #{header}Options:" @parser.separator " #{header}Options:"
option_list.each do |args, handler| option_list.each do |args, handler|
dashes = args.select { |arg| arg =~ /^-/ } args.select { |arg| arg =~ /^-/ }
@parser.on(*args) do |value| @parser.on(*args) do |value|
handler.call(value, @options) handler.call(value, @options)
end end

Просмотреть файл

@ -35,7 +35,7 @@ class Gem::Commands::BuildCommand < Gem::Command
while not f.eof? and spec = Gem::Specification.from_yaml(f) while not f.eof? and spec = Gem::Specification.from_yaml(f)
result << spec result << spec
end end
rescue Gem::EndOfYAMLException => e rescue Gem::EndOfYAMLException
# OK # OK
end end
end end

Просмотреть файл

@ -71,7 +71,7 @@ class Gem::Commands::CheckCommand < Gem::Command
say "Verifying gem: '#{gem_name}'" say "Verifying gem: '#{gem_name}'"
begin begin
Gem::Validator.new.verify_gem_file(gem_name) Gem::Validator.new.verify_gem_file(gem_name)
rescue Exception => e rescue Exception
alert_error "#{gem_name} is invalid." alert_error "#{gem_name} is invalid."
end end
end end

Просмотреть файл

@ -161,19 +161,19 @@ class Gem::Commands::QueryCommand < Gem::Command
end end
versions.each do |gem_name, matching_tuples| versions.each do |gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by do |(name, version,_),_| matching_tuples = matching_tuples.sort_by do |(_, version,_),_|
version version
end.reverse end.reverse
platforms = Hash.new { |h,version| h[version] = [] } platforms = Hash.new { |h,version| h[version] = [] }
matching_tuples.map do |(name, version, platform,_),_| matching_tuples.map do |(_, version, platform,_),_|
platforms[version] << platform if platform platforms[version] << platform if platform
end end
seen = {} seen = {}
matching_tuples.delete_if do |(name, version,_),_| matching_tuples.delete_if do |(_, version,_),_|
if seen[version] then if seen[version] then
true true
else else
@ -186,7 +186,7 @@ class Gem::Commands::QueryCommand < Gem::Command
if options[:versions] then if options[:versions] then
list = if platforms.empty? or options[:details] then list = if platforms.empty? or options[:details] then
matching_tuples.map { |(name, version,_),_| version }.uniq matching_tuples.map { |(_, version,_),_| version }.uniq
else else
platforms.sort.reverse.map do |version, pls| platforms.sort.reverse.map do |version, pls|
if pls == [Gem::Platform::RUBY] then if pls == [Gem::Platform::RUBY] then

Просмотреть файл

@ -17,7 +17,7 @@ class Gem::Commands::ServerCommand < Gem::Command
else else
begin begin
Socket.getservbyname port Socket.getservbyname port
rescue SocketError => e rescue SocketError
raise OptionParser::InvalidArgument, "#{port}: no such named service" raise OptionParser::InvalidArgument, "#{port}: no such named service"
end end
end end

Просмотреть файл

@ -181,11 +181,11 @@ class Gem::Commands::UpdateCommand < Gem::Command
end end
end end
matching_gems = spec_tuples.select do |(name, version, platform),| matching_gems = spec_tuples.select do |(name, _, platform),|
name == l_name and Gem::Platform.match platform name == l_name and Gem::Platform.match platform
end end
highest_remote_gem = matching_gems.sort_by do |(name, version),| highest_remote_gem = matching_gems.sort_by do |(_, version),|
version version
end.last end.last

Просмотреть файл

@ -77,7 +77,7 @@ class Gem::DocManager
:formatter => RDoc::RI::Formatter, :formatter => RDoc::RI::Formatter,
} }
driver = RDoc::RI::Driver.new(options).class_cache RDoc::RI::Driver.new(options).class_cache
end end
## ##

Просмотреть файл

@ -32,8 +32,6 @@ class Gem::Format
# representing the data in the gem # representing the data in the gem
def self.from_file_by_path(file_path, security_policy = nil) def self.from_file_by_path(file_path, security_policy = nil)
format = nil
unless File.exist?(file_path) unless File.exist?(file_path)
raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}" raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
end end

Просмотреть файл

@ -42,7 +42,7 @@ begin
# Reference a constant defined in the .rb portion of ssl (just to # Reference a constant defined in the .rb portion of ssl (just to
# make sure that part is loaded too). # make sure that part is loaded too).
dummy = OpenSSL::Digest::SHA1 OpenSSL::Digest::SHA1
Gem.ssl_available = true Gem.ssl_available = true

Просмотреть файл

@ -318,7 +318,7 @@ class Gem::Installer
def generate_bin_script(filename, bindir) def generate_bin_script(filename, bindir)
bin_script_path = File.join bindir, formatted_program_filename(filename) bin_script_path = File.join bindir, formatted_program_filename(filename)
exec_path = File.join @gem_dir, @spec.bindir, filename File.join @gem_dir, @spec.bindir, filename
# HACK some gems don't have #! in their executables, restore 2008/06 # HACK some gems don't have #! in their executables, restore 2008/06
#if File.read(exec_path, 2) == '#!' then #if File.read(exec_path, 2) == '#!' then
@ -466,7 +466,7 @@ TEXT
say results.join("\n") if Gem.configuration.really_verbose say results.join("\n") if Gem.configuration.really_verbose
rescue => ex rescue
results = results.join "\n" results = results.join "\n"
File.open('gem_make.out', 'wb') { |f| f.puts results } File.open('gem_make.out', 'wb') { |f| f.puts results }

Просмотреть файл

@ -143,7 +143,7 @@ class Gem::OldFormat
end end
yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])] yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
end end
rescue Zlib::DataError => e rescue Zlib::DataError
raise Gem::Exception, errstr raise Gem::Exception, errstr
end end
end end

Просмотреть файл

@ -82,7 +82,7 @@ class Gem::Uninstaller
gem_names = list.collect {|gem| gem.full_name} + ["All versions"] gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
say say
gem_name, index = choose_from_list "Select gem to uninstall:", gem_names _, index = choose_from_list "Select gem to uninstall:", gem_names
if index == list.size then if index == list.size then
remove_all list.dup remove_all list.dup