aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-09-25 18:51:30 -0500
committerJack Nagel2013-09-26 10:04:45 -0500
commitd16abcddd55290a380a8db976c5918cac0ac45e8 (patch)
treede2d59540409754ae18dbc2bbbefc02698225c49 /Library
parent6444b8bbf0e2eaeecea26fdd1376a811f0304bd2 (diff)
downloadhomebrew-d16abcddd55290a380a8db976c5918cac0ac45e8.tar.bz2
Simplify setup for local bottle installation
Closes #22833.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/bottles.rb4
-rw-r--r--Library/Homebrew/download_strategy.rb6
-rw-r--r--Library/Homebrew/formula.rb2
-rw-r--r--Library/Homebrew/formula_installer.rb7
-rw-r--r--Library/Homebrew/formulary.rb2
5 files changed, 9 insertions, 12 deletions
diff --git a/Library/Homebrew/bottles.rb b/Library/Homebrew/bottles.rb
index ff12cc689..52f4c70ca 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 865bde286..01ff12a71 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 f45725822..44e1c315b 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 d6f105d7d..9c0719448 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 c02971f19..a5bb5e306 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