Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix 1.9.3dev unused variable warnings

  • Loading branch information...
commit 0e4b7765c95dacaea25fd679f5ec20b8b7a23a2f 1 parent 6cfc91e
@drbrain drbrain authored
View
4 lib/rubygems/security.rb
@@ -685,8 +685,8 @@ def self.build_cert(name, key, opt = {})
ef = OpenSSL::X509::ExtensionFactory.new nil, cert
- cert.extensions = opt[:cert_exts].map do |name, value|
- ef.create_extension name, value
+ cert.extensions = opt[:cert_exts].map do |ext_name, value|
+ ef.create_extension ext_name, value
end
i_key = opt[:issuer_key] || key
View
1  lib/rubygems/server.rb
@@ -673,6 +673,7 @@ def root(req, res)
template = ERB.new(DOC_TEMPLATE)
res['content-type'] = 'text/html'
+ # this is used by binding, 1.9.3dev warns anyways
values = { "gem_count" => specs.size.to_s, "specs" => specs,
"total_file_count" => total_file_count.to_s }
View
2  lib/rubygems/source_index.rb
@@ -325,7 +325,7 @@ def outdated
begin
fetcher = Gem::SpecFetcher.fetcher
remotes = fetcher.find_matching dependency
- remotes = remotes.map { |(name, version,_),_| version }
+ remotes = remotes.map { |(_, version, _), _| version }
rescue Gem::RemoteFetcher::FetchError => e
raise unless fetcher.warn_legacy e do
require 'rubygems/source_info_cache'
View
1  lib/rubygems/spec_fetcher.rb
@@ -191,7 +191,6 @@ def legacy_repos
def suggest_gems_from_name gem_name
gem_name = gem_name.downcase
- gem_starts_with = gem_name[0,1]
max = gem_name.size / 2
specs = list.values.flatten(1) # flatten(1) is 1.8.7 and up
View
4 lib/rubygems/specification.rb
@@ -691,7 +691,7 @@ def same_attributes?(other)
private :same_attributes?
def hash # :nodoc:
- @@attributes.inject(0) { |hash_code, (name, default_value)|
+ @@attributes.inject(0) { |hash_code, (name, _)|
hash_code ^ self.send(name).hash
}
end
@@ -722,7 +722,7 @@ def encode_with coder # :nodoc:
def to_yaml(opts = {}) # :nodoc:
return super if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
- yaml = YAML.quick_emit object_id, opts do |out|
+ YAML.quick_emit object_id, opts do |out|
out.map taguri, to_yaml_style do |map|
encode_with map
end
View
4 test/gem_package_tar_test_case.rb
@@ -120,8 +120,10 @@ def to_oct(n, pad_size)
def util_entry(tar)
io = TempIO.new tar
+
header = Gem::Package::TarHeader.from io
- entry = Gem::Package::TarReader::Entry.new header, io
+
+ Gem::Package::TarReader::Entry.new header, io
end
def util_dir_entry
View
2  test/gemutilities.rb
@@ -159,7 +159,7 @@ def teardown
Gem.clear_paths
- Gem.class_eval { @ruby = ruby } if ruby = @orig_ruby
+ Gem.class_eval { @ruby = _ } if _ = @orig_ruby
if @orig_ENV_HOME then
ENV['HOME'] = @orig_ENV_HOME
View
4 test/test_gem_commands_outdated_command.rb
@@ -14,8 +14,8 @@ def test_initialize
end
def test_execute
- local_01 = quick_gem 'foo', '0.1'
- local_02 = quick_gem 'foo', '0.2'
+ quick_gem 'foo', '0.1'
+ quick_gem 'foo', '0.2'
remote_10 = quick_gem 'foo', '1.0'
remote_20 = quick_gem 'foo', '2.0'
View
6 test/test_gem_commands_query_command.rb
@@ -64,9 +64,6 @@ def test_execute_platform
end
def test_execute_all
- a1_name = @a1.full_name
- a2_name = @a2.full_name
-
@cmd.handle_options %w[-r --all]
use_ui @ui do
@@ -86,9 +83,6 @@ def test_execute_all
end
def test_execute_all_prerelease
- a1_name = @a1.full_name
- a2_name = @a2.full_name
-
@cmd.handle_options %w[-r --all --prerelease]
use_ui @ui do
View
8 test/test_gem_commands_specification_command.rb
@@ -25,8 +25,8 @@ def test_execute
end
def test_execute_all
- foo1 = quick_gem 'foo', '0.0.1'
- foo2 = quick_gem 'foo', '0.0.2'
+ quick_gem 'foo', '0.0.1'
+ quick_gem 'foo', '0.0.2'
@cmd.options[:args] = %w[foo]
@cmd.options[:all] = true
@@ -56,8 +56,8 @@ def test_execute_bad_name
end
def test_execute_exact_match
- foo = quick_gem 'foo'
- foo_bar = quick_gem 'foo_bar'
+ quick_gem 'foo'
+ quick_gem 'foo_bar'
@cmd.options[:args] = %w[foo]
View
16 test/test_gem_dependency_installer.rb
@@ -56,8 +56,8 @@ def setup
@fetcher = Gem::FakeFetcher.new
Gem::RemoteFetcher.fetcher = @fetcher
- si = util_setup_spec_fetcher(@a1, @a1_pre, @b1, @b1_pre, @c1_pre, @d1, @d2,
- @x1_m, @x1_o, @w1, @y1, @y1_1_p, @z1)
+ util_setup_spec_fetcher(@a1, @a1_pre, @b1, @b1_pre, @c1_pre, @d1, @d2,
+ @x1_m, @x1_o, @w1, @y1, @y1_1_p, @z1)
util_clear_gems
end
@@ -78,7 +78,7 @@ def test_install
end
def test_install_all_dependencies
- e1, e1_gem = util_gem 'e', '1' do |s|
+ _, e1_gem = util_gem 'e', '1' do |s|
s.add_dependency 'b'
end
@@ -190,9 +190,9 @@ def test_install_dependency_existing
end
def test_install_dependency_old
- e1, e1_gem = util_gem 'e', '1'
- f1, f1_gem = util_gem 'f', '1', 'e' => nil
- f2, f2_gem = util_gem 'f', '2'
+ _, e1_gem = util_gem 'e', '1'
+ _, f1_gem = util_gem 'f', '1', 'e' => nil
+ _, f2_gem = util_gem 'f', '2'
FileUtils.mv e1_gem, @tempdir
FileUtils.mv f1_gem, @tempdir
@@ -610,7 +610,7 @@ def test_find_gems_with_sources_prerelease
def assert_resolve expected, *specs
util_clear_gems
- si = util_setup_spec_fetcher(*specs)
+ util_setup_spec_fetcher(*specs)
inst = Gem::DependencyInstaller.new
inst.find_spec_by_name_and_version 'a'
@@ -661,7 +661,7 @@ def test_gather_dependencies_old_required
util_clear_gems
- si = util_setup_spec_fetcher @d1, @d2, e1
+ util_setup_spec_fetcher @d1, @d2, e1
inst = Gem::DependencyInstaller.new
inst.find_spec_by_name_and_version 'e'
View
9 test/test_gem_ext_ext_conf_builder.rb
@@ -28,15 +28,6 @@ def test_class_build
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
end
- expected = [
- "ruby extconf.rb",
- "creating Makefile\n",
- "make",
- "make: Nothing to be done for `all'.\n",
- "make install",
- "make: Nothing to be done for `install'.\n"
- ]
-
assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
assert_equal "creating Makefile\n", output[1]
case RUBY_PLATFORM
View
15 test/test_gem_ext_rake_builder.rb
@@ -33,13 +33,6 @@ def test_class_build
output = output.join "\n"
- expected = [
- "#{@@ruby} mkrf_conf.rb",
- "",
- "#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}",
- "(in #{realdir})\n"
- ]
-
refute_match %r%^rake failed:%, output
assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, output
assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, output
@@ -64,14 +57,6 @@ def test_class_build_fail
end
end
- expected = <<-EOF.strip
-rake failed:
-
-#{@@ruby} mkrf_conf.rb
-
-#{@@rake} RUBYARCHDIR=#{@dest_path} RUBYLIBDIR=#{@dest_path}
- EOF
-
assert_match %r%^rake failed:%, error.message
assert_match %r%^#{Regexp.escape @@ruby} mkrf_conf\.rb%, error.message
assert_match %r%^#{Regexp.escape @@rake} RUBYARCHDIR=#{Regexp.escape @dest_path} RUBYLIBDIR=#{Regexp.escape @dest_path}%, error.message
View
5 test/test_gem_installer.rb
@@ -58,10 +58,6 @@ def test_build_extensions_extconf_bad
assert_equal '', @ui.error
gem_make_out = File.join @gemhome, 'gems', @spec.full_name, 'gem_make.out'
- expected = <<-EOF
-#{Gem.ruby} extconf.rb
-#{Gem.ruby}: No such file or directory -- extconf.rb (LoadError)
- EOF
assert_match %r%#{Regexp.escape Gem.ruby} extconf\.rb%,
File.read(gem_make_out)
@@ -655,7 +651,6 @@ def test_install_missing_dirs
use_ui @ui do
Dir.chdir @tempdir do Gem::Builder.new(@spec).build end
- gem = File.join @tempdir, @spec.file_name
@installer.install
end
View
1  test/test_gem_platform.rb
@@ -117,7 +117,6 @@ def test_initialize_mswin32_vc6
def test_initialize_platform
platform = Gem::Platform.new 'cpu-my_platform1'
- expected = Gem::Platform.new platform
assert_equal 'cpu', platform.cpu
assert_equal 'my_platform', platform.os
View
4 test/test_gem_remote_fetcher.rb
@@ -646,11 +646,13 @@ def @fetcher.connection_for uri
def assert_error(exception_class=Exception)
got_exception = false
+
begin
yield
- rescue exception_class => ex
+ rescue exception_class
got_exception = true
end
+
assert got_exception, "Expected exception conforming to #{exception_class}"
end
View
12 test/test_gem_server.rb
@@ -92,7 +92,7 @@ def test_latest_specs_gz
def test_listen
util_listen
- out, err = capture_io do
+ capture_io do
@server.listen
end
@@ -102,10 +102,10 @@ def test_listen
def test_listen_addresses
util_listen
- out, err = capture_io do
+ capture_io do
@server.listen %w[a b]
end
-
+
assert_equal 2, @server.server.listeners.length
end
@@ -125,7 +125,7 @@ def test_quick_a_1_gemspec_rz
end
def test_quick_a_1_mswin32_gemspec_rz
- a1_p = quick_gem 'a', '1' do |s| s.platform = Gem::Platform.local end
+ quick_gem 'a', '1' do |s| s.platform = Gem::Platform.local end
data = StringIO.new "GET /quick/a-1-#{Gem::Platform.local}.gemspec.rz HTTP/1.0\r\n\r\n"
@req.parse data
@@ -143,7 +143,7 @@ def test_quick_a_1_mswin32_gemspec_rz
end
def test_quick_common_substrings
- ab1 = quick_gem 'ab', '1'
+ quick_gem 'ab', '1'
data = StringIO.new "GET /quick/a-1.gemspec.rz HTTP/1.0\r\n\r\n"
@req.parse data
@@ -236,7 +236,7 @@ def test_quick_marshal_a_1_gemspec_rz
end
def test_quick_marshal_a_1_mswin32_gemspec_rz
- a1_p = quick_gem 'a', '1' do |s| s.platform = Gem::Platform.local end
+ quick_gem 'a', '1' do |s| s.platform = Gem::Platform.local end
data = StringIO.new "GET /quick/Marshal.#{Gem.marshal_version}/a-1-#{Gem::Platform.local}.gemspec.rz HTTP/1.0\r\n\r\n"
@req.parse data
Please sign in to comment.
Something went wrong with that request. Please try again.