From 0d45c3c0f254fab1e014b83166aa25ffb081afc0 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 28 Mar 2013 17:37:29 -0500 Subject: [PATCH] Suppress uninitialized instance variable warnings --- Library/Homebrew/download_strategy.rb | 18 ++++++++++-------- Library/Homebrew/formula_support.rb | 2 ++ Library/Homebrew/test/test_updater.rb | 11 ++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 008fcc1bc1..f693945a14 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -29,19 +29,21 @@ class AbstractDownloadStrategy end class CurlDownloadStrategy < AbstractDownloadStrategy - attr_reader :tarball_path, :local_bottle_path - attr_writer :local_bottle_path + attr_reader :tarball_path + attr_accessor :local_bottle_path def initialize name, package super - @mirrors = package.mirrors - @unique_token = "#{name}-#{package.version}" unless name.to_s.empty? or name == '__UNKNOWN__' - if @unique_token - @tarball_path=HOMEBREW_CACHE+(@unique_token+ext) + + if name.to_s.empty? || name == '__UNKNOWN__' + @tarball_path = HOMEBREW_CACHE + File.basename(@url) else - @tarball_path=HOMEBREW_CACHE+File.basename(@url) + @tarball_path = HOMEBREW_CACHE + "#{name}-#{package.version}#{ext}" end - @temporary_path=Pathname.new(@tarball_path.to_s + ".incomplete") + + @mirrors = package.mirrors + @temporary_path = Pathname("#@tarball_path.incomplete") + @local_bottle_path = nil end def cached_location diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index 40bb561b82..bbc82396d0 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -10,6 +10,8 @@ class SoftwareSpec @version = version @mirrors = [] @specs = {} + @checksum = nil + @using = nil end def download_strategy diff --git a/Library/Homebrew/test/test_updater.rb b/Library/Homebrew/test/test_updater.rb index 4f7a6378e5..297349450b 100644 --- a/Library/Homebrew/test/test_updater.rb +++ b/Library/Homebrew/test/test_updater.rb @@ -3,6 +3,7 @@ abort if ARGV.include? "--skip-update" require 'testing_env' require 'formula' require 'cmd/update' +require 'yaml' class UpdaterMock < Updater def in_repo_expect(cmd, output = '') @@ -36,11 +37,11 @@ class UpdaterTests < Test::Unit::TestCase end def self.fixture_data - unless @fixture_data - require 'yaml' - @fixture_data = YAML.load_file(Pathname.new(ABS__FILE__).parent.realpath + 'fixtures/updater_fixture.yaml') - end - @fixture_data + @fixture_data ||= load_fixture_data + end + + def self.load_fixture_data + YAML.load_file(Pathname.new(ABS__FILE__).parent.realpath + 'fixtures/updater_fixture.yaml') end def test_update_homebrew_without_any_changes