From cceca83afe046b8c2b53eab6ab7c52faa1719b6d Mon Sep 17 00:00:00 2001 From: marcandre Date: Mon, 8 Nov 2010 20:58:42 +0000 Subject: * 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 --- lib/rubygems/command.rb | 4 ++-- lib/rubygems/commands/build_command.rb | 2 +- lib/rubygems/commands/check_command.rb | 2 +- lib/rubygems/commands/query_command.rb | 8 ++++---- lib/rubygems/commands/server_command.rb | 2 +- lib/rubygems/commands/update_command.rb | 4 ++-- lib/rubygems/doc_manager.rb | 2 +- lib/rubygems/format.rb | 2 -- lib/rubygems/gem_openssl.rb | 2 +- lib/rubygems/installer.rb | 4 ++-- lib/rubygems/old_format.rb | 2 +- lib/rubygems/uninstaller.rb | 2 +- 12 files changed, 17 insertions(+), 19 deletions(-) (limited to 'lib/rubygems') diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index 3491937358..f3961f1821 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -168,7 +168,7 @@ class Gem::Command "Please specify at least one gem name (e.g. gem build GEMNAME)" end - gem_names = args.select { |arg| arg !~ /^-/ } + args.select { |arg| arg !~ /^-/ } end ## @@ -430,7 +430,7 @@ class Gem::Command @parser.separator " #{header}Options:" option_list.each do |args, handler| - dashes = args.select { |arg| arg =~ /^-/ } + args.select { |arg| arg =~ /^-/ } @parser.on(*args) do |value| handler.call(value, @options) end diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index e1f0122c6c..c1ba9d2a63 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -35,7 +35,7 @@ class Gem::Commands::BuildCommand < Gem::Command while not f.eof? and spec = Gem::Specification.from_yaml(f) result << spec end - rescue Gem::EndOfYAMLException => e + rescue Gem::EndOfYAMLException # OK end end diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index 475aeb3795..0bfad9b97c 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -71,7 +71,7 @@ class Gem::Commands::CheckCommand < Gem::Command say "Verifying gem: '#{gem_name}'" begin Gem::Validator.new.verify_gem_file(gem_name) - rescue Exception => e + rescue Exception alert_error "#{gem_name} is invalid." end end diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index 93b417015c..65258fd1ac 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -161,19 +161,19 @@ class Gem::Commands::QueryCommand < Gem::Command end 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 end.reverse 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 end seen = {} - matching_tuples.delete_if do |(name, version,_),_| + matching_tuples.delete_if do |(_, version,_),_| if seen[version] then true else @@ -186,7 +186,7 @@ class Gem::Commands::QueryCommand < Gem::Command if options[:versions] then list = if platforms.empty? or options[:details] then - matching_tuples.map { |(name, version,_),_| version }.uniq + matching_tuples.map { |(_, version,_),_| version }.uniq else platforms.sort.reverse.map do |version, pls| if pls == [Gem::Platform::RUBY] then diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb index 4277787035..1760700e27 100644 --- a/lib/rubygems/commands/server_command.rb +++ b/lib/rubygems/commands/server_command.rb @@ -17,7 +17,7 @@ class Gem::Commands::ServerCommand < Gem::Command else begin Socket.getservbyname port - rescue SocketError => e + rescue SocketError raise OptionParser::InvalidArgument, "#{port}: no such named service" end end diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index 45d82e9385..2e6f11949a 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -181,11 +181,11 @@ class Gem::Commands::UpdateCommand < Gem::Command 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 end - highest_remote_gem = matching_gems.sort_by do |(name, version),| + highest_remote_gem = matching_gems.sort_by do |(_, version),| version end.last diff --git a/lib/rubygems/doc_manager.rb b/lib/rubygems/doc_manager.rb index d26d87a26f..b38fce1aba 100644 --- a/lib/rubygems/doc_manager.rb +++ b/lib/rubygems/doc_manager.rb @@ -77,7 +77,7 @@ class Gem::DocManager :formatter => RDoc::RI::Formatter, } - driver = RDoc::RI::Driver.new(options).class_cache + RDoc::RI::Driver.new(options).class_cache end ## diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb index 82eaf9e77e..d4c66d9f85 100644 --- a/lib/rubygems/format.rb +++ b/lib/rubygems/format.rb @@ -32,8 +32,6 @@ class Gem::Format # representing the data in the gem def self.from_file_by_path(file_path, security_policy = nil) - format = nil - unless File.exist?(file_path) raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}" end diff --git a/lib/rubygems/gem_openssl.rb b/lib/rubygems/gem_openssl.rb index 7891d596c4..ade95641bf 100644 --- a/lib/rubygems/gem_openssl.rb +++ b/lib/rubygems/gem_openssl.rb @@ -42,7 +42,7 @@ begin # Reference a constant defined in the .rb portion of ssl (just to # make sure that part is loaded too). - dummy = OpenSSL::Digest::SHA1 + OpenSSL::Digest::SHA1 Gem.ssl_available = true diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index f64696fe7a..d942960b2f 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -318,7 +318,7 @@ class Gem::Installer def generate_bin_script(filename, bindir) 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 #if File.read(exec_path, 2) == '#!' then @@ -466,7 +466,7 @@ TEXT say results.join("\n") if Gem.configuration.really_verbose - rescue => ex + rescue results = results.join "\n" File.open('gem_make.out', 'wb') { |f| f.puts results } diff --git a/lib/rubygems/old_format.rb b/lib/rubygems/old_format.rb index 43967db412..4cbff51c68 100644 --- a/lib/rubygems/old_format.rb +++ b/lib/rubygems/old_format.rb @@ -143,7 +143,7 @@ class Gem::OldFormat end yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])] end - rescue Zlib::DataError => e + rescue Zlib::DataError raise Gem::Exception, errstr end end diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 1dea232634..b8feb483f8 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -82,7 +82,7 @@ class Gem::Uninstaller gem_names = list.collect {|gem| gem.full_name} + ["All versions"] 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 remove_all list.dup -- cgit v1.2.3