diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb index ff12cc689a..52f4c70cac 100644 --- a/Library/Homebrew/bottles.rb +++ b/Library/Homebrew/bottles.rb @@ -11,9 +11,7 @@ def bottle_filename f, bottle_revision=nil end def install_bottle? f, options={:warn=>false} - return true if f.downloader and defined? f.downloader.local_bottle_path \ - and f.downloader.local_bottle_path - + return true if f.local_bottle_path return false if ARGV.build_from_source? return true if ARGV.force_bottle? return false unless f.pour_bottle? diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 865bde286d..01ff12a713 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -2,8 +2,6 @@ require 'open-uri' require 'utils/json' class AbstractDownloadStrategy - attr_accessor :local_bottle_path - attr_reader :name, :resource def initialize name, resource @@ -251,9 +249,9 @@ end # This strategy extracts local binary packages. class LocalBottleDownloadStrategy < CurlDownloadStrategy - def initialize formula, local_bottle_path + def initialize formula super formula.name, formula.active_spec - @tarball_path = local_bottle_path + @tarball_path = formula.local_bottle_path end def stage diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index f45725822d..44e1c315b4 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -23,6 +23,8 @@ class Formula # Will only be non-nil inside #stage and #test. attr_reader :buildpath, :testpath + attr_accessor :local_bottle_path + # Homebrew determines the name def initialize name='__UNKNOWN__', path=nil @name = name diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index d6f105d7d6..9c07194483 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -509,11 +509,10 @@ class FormulaInstaller end def pour - downloader = f.downloader - if downloader.local_bottle_path - downloader = LocalBottleDownloadStrategy.new f, - downloader.local_bottle_path + if f.local_bottle_path + downloader = LocalBottleDownloadStrategy.new(f) else + downloader = f.downloader fetched = f.fetch f.verify_download_integrity fetched end diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index c02971f194..a5bb5e306a 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -74,7 +74,7 @@ class Formulary def get_formula formula = klass.new(name) - formula.downloader.local_bottle_path = @bottle_filename + formula.local_bottle_path = @bottle_filename return formula end end