Permalink
Browse files

Fix 1.9 warnings

  • Loading branch information...
1 parent bb29d3a commit abe3d13022d49264ca66c7e3f670c300caa6b622 @evanphx evanphx committed Mar 14, 2012
@@ -71,7 +71,7 @@ def execute
if remote? and not options[:reverse_dependencies] then
fetcher = Gem::SpecFetcher.fetcher
- ss, err = fetcher.spec_for_dependency dependency
+ ss, _ = fetcher.spec_for_dependency dependency
ss.each { |s,o| specs << s }
end
@@ -33,7 +33,6 @@ def usage # :nodoc:
def execute
version = options[:version] || Gem::Requirement.default
- all = Gem::Requirement.default != version
platform = Gem.platforms.last
gem_names = get_all_gem_names
@@ -19,7 +19,7 @@ def execute
Gem::Specification.outdated.sort.each do |name|
local = Gem::Specification.find_all_by_name(name).max
dep = Gem::Dependency.new local.name, ">= #{local.version}"
- remotes, e = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+ remotes, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
next if remotes.empty?
@@ -128,8 +128,8 @@ def execute
if options[:name].source.empty?
spec_tuples = fetcher.detect(type) { true }
else
- spec_tuples = fetcher.detect(type) do |name, ver, plat|
- options[:name] === name
+ spec_tuples = fetcher.detect(type) do |gem_name, ver, plat|
+ options[:name] === gem_name
end
end
@@ -96,11 +96,9 @@ def execute
end
if options[:update] then
- fetcher = Gem::SpecFetcher.fetcher
-
- Gem.sources.each_source do |source|
- source.load_specs :released
- source.load_specs :latest
+ Gem.sources.each_source do |src|
+ src.load_specs :released
+ src.load_specs :latest
end
say "source cache successfully updated"
@@ -110,8 +108,8 @@ def execute
say "*** CURRENT SOURCES ***"
say
- Gem.sources.each do |source|
- say source
+ Gem.sources.each do |src|
+ say src
end
end
end
@@ -100,7 +100,7 @@ def execute
if remote? then
dep.prerelease = options[:prerelease]
- found, err = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
specs.push(*found.map { |spec,| spec })
end
@@ -195,7 +195,7 @@ def which_to_update highest_installed_gems, gem_names, system = false
fetcher = Gem::SpecFetcher.fetcher
- spec_tuples, errs = fetcher.search_for_dependency dependency
+ spec_tuples, _ = fetcher.search_for_dependency dependency
matching_gems = spec_tuples.select do |g,_|
g.name == l_name and g.match_platform?
@@ -264,13 +264,13 @@ def find_spec_by_name_and_version(gem_name,
if consider_local?
if File.exists? gem_name
- source = Gem::Source::SpecificFile.new(gem_name)
- spec_and_source = [source.spec, source]
+ src = Gem::Source::SpecificFile.new(gem_name)
+ spec_and_source = [src.spec, src]
else
local = Gem::Source::Local.new
- if spec = local.find_gem(gem_name, version)
- spec_and_source = [spec, local]
+ if s = local.find_gem(gem_name, version)
+ spec_and_source = [s, local]
end
end
end
View
@@ -61,8 +61,6 @@ def add_platform(platform)
##
# A wordy description of the error.
def wordy
- prefix = "Found #{@name} (#{@version})"
-
"Found %s (%), but was for platform%s %s" %
[@name,
@version,
@@ -111,7 +111,7 @@ def api_endpoint(uri)
# larger, more emcompassing effort. -erikh
def download_to_cache dependency
- found, err = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
return if found.empty?
@@ -162,7 +162,7 @@ def source(url)
def gem(name, *reqs)
# Ignore the opts for now.
- opts = reqs.pop if reqs.last.kind_of?(Hash)
+ reqs.pop if reqs.last.kind_of?(Hash)
@set.gem name, *reqs
end
View
@@ -431,7 +431,7 @@ def self.create_cert_self_signed subject, key, age = ONE_YEAR,
# default is a 2048 bit RSA key.
def self.create_key length = KEY_LENGTH, algorithm = KEY_ALGORITHM
- key = algorithm.new length
+ algorithm.new length
end
##
@@ -67,7 +67,7 @@ def name_path name
def load_certificate certificate_file
pem = File.read certificate_file
- certificate = OpenSSL::X509::Certificate.new pem
+ OpenSSL::X509::Certificate.new pem
end
##
@@ -112,7 +112,7 @@ def search_for_dependency(dependency, matching_platform=true)
def detect(type=:complete)
tuples = []
- list, errors = available_specs(type)
+ list, _ = available_specs(type)
list.each do |source, specs|
specs.each do |tup|
if yield(tup)
@@ -957,7 +957,7 @@ def self.outdated
latest_specs.each do |local|
dependency = Gem::Dependency.new local.name, ">= #{local.version}"
- remotes, err = fetcher.search_for_dependency dependency
+ remotes, _ = fetcher.search_for_dependency dependency
remotes = remotes.map { |n, _| n.version }
latest = remotes.sort.last
@@ -135,7 +135,7 @@ def download spec, source_uri, install_dir = Gem.dir
end
def download_to_cache dependency
- found, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
+ found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
return if found.empty?
@@ -77,7 +77,7 @@ def test_execute_add
end
def test_execute_add_twice
- alternate = self.class.cert_path 'alternate'
+ self.class.cert_path 'alternate'
@cmd.handle_options %W[
--add #{PUBLIC_CERT_FILE}
@@ -685,7 +685,7 @@ def test_execute_installs_deps_a_gemdeps
end
def test_execute_uses_deps_a_gemdeps
- q, q_gem = util_gem 'q', '1.0'
+ q, _ = util_gem 'q', '1.0'
r, r_gem = util_gem 'r', '2.0', 'q' => nil
util_setup_fake_fetcher
@@ -125,11 +125,6 @@ def test_execute_clear_all
util_setup_spec_fetcher
- fetcher = Gem::SpecFetcher.fetcher
-
- # HACK figure out how to force directory creation via fetcher
- #assert File.directory?(fetcher.dir), 'cache dir exists'
-
use_ui @ui do
@cmd.execute
end
@@ -9,7 +9,7 @@ def setup
end
def test_gem
- a = util_spec "a", "2"
+ util_spec "a", "2"
rs = Gem::RequestSet.new
rs.gem "a", "= 2"
@@ -27,7 +27,7 @@ def test_resolve
res = rs.resolve StaticSet.new([a, b])
assert_equal 2, res.size
- names = res.map { |a| a.full_name }.sort
+ names = res.map { |s| s.full_name }.sort
assert_equal ["a-2", "b-2"], names
end
@@ -42,7 +42,7 @@ def test_sorted_requests
rs.resolve StaticSet.new([a, b, c])
- names = rs.sorted_requests.map { |a| a.full_name }
+ names = rs.sorted_requests.map { |s| s.full_name }
assert_equal %w!c-2 b-2 a-2!, names
end
@@ -220,10 +220,6 @@ def test_check_trust_no_trust_child
def test_verify
Gem::Security.trust_dir.trust_cert PUBLIC_CERT
- data = digest 'hello'
- digest = { 0 => data }
- signature = { 0 => sign(data, PRIVATE_KEY) }
-
assert @almost_no.verify [PUBLIC_CERT]
end
@@ -41,14 +41,14 @@ def test_find_gem
end
def test_find_gem_highest_version
- a2, a2_gem = util_gem "a", "2"
+ _, a2_gem = util_gem "a", "2"
FileUtils.mv a2_gem, @tempdir
assert_equal "a-2", @sl.find_gem("a").full_name
end
def test_find_gem_specific_version
- a2, a2_gem = util_gem "a", "2"
+ _, a2_gem = util_gem "a", "2"
FileUtils.mv a2_gem, @tempdir
req = Gem::Requirement.create("= 1")
@@ -61,7 +61,7 @@ def test_spec_for_dependency_all
dep = Gem::Dependency.new 'a', ">= 1"
- specs_and_sources, e = @sf.spec_for_dependency dep
+ specs_and_sources, _ = @sf.spec_for_dependency dep
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
@@ -81,7 +81,7 @@ def test_spec_for_dependency_latest
@fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
dep = Gem::Dependency.new 'a'
- specs_and_sources, e = @sf.spec_for_dependency dep
+ specs_and_sources, _ = @sf.spec_for_dependency dep
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
@@ -96,7 +96,7 @@ def test_spec_for_dependency_prerelease
@fetcher.data["#{d}#{@a2.spec_name}.rz"] = util_zip(Marshal.dump(@a2))
@fetcher.data["#{d}#{@a_pre.spec_name}.rz"] = util_zip(Marshal.dump(@a_pre))
- specs_and_sources, e = @sf.spec_for_dependency dep('a', '1.a')
+ specs_and_sources, _ = @sf.spec_for_dependency dep('a', '1.a')
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
@@ -112,7 +112,7 @@ def test_spec_for_dependency_platform
util_zip(Marshal.dump(@pl1))
dep = Gem::Dependency.new 'pl', 1
- specs_and_sources, e = @sf.spec_for_dependency dep
+ specs_and_sources, _ = @sf.spec_for_dependency dep
spec_names = specs_and_sources.map do |spec, source_uri|
[spec.full_name, source_uri]
@@ -249,8 +249,8 @@ def test_uninstall_selection_greater_than_one
end
def test_uninstall_prompts_about_broken_deps
- r, r_gem = util_gem 'r', '1', 'q' => '= 1'
- q, q_gem = util_gem 'q', '1'
+ util_gem 'r', '1', 'q' => '= 1'
+ util_gem 'q', '1'
un = Gem::Uninstaller.new('q')
ui = Gem::MockGemUi.new("y\n")
@@ -270,11 +270,11 @@ def test_uninstall_prompts_about_broken_deps
end
def test_uninstall_prompt_includes_dep_type
- r, r_gem = util_gem 'r', '1' do |s|
+ util_gem 'r', '1' do |s|
s.add_development_dependency 'q', '= 1'
end
- q, q_gem = util_gem 'q', '1'
+ util_gem 'q', '1'
un = Gem::Uninstaller.new('q')
ui = Gem::MockGemUi.new("y\n")

1 comment on commit abe3d13

Hej @evanphx, can you push the v1.8.19 tag? The Syck::Syck error crashed our deploys today and we only found out by accident that there was already a fix released. And thanks for this quickness of fixing :)

Please sign in to comment.