HOMEBREW_CACHE is now a Pathname object

This is consistent with the other HOMEBREW_* path constants
This commit is contained in:
Max Howell 2009-08-04 00:40:12 +01:00
parent 8ce4e5923f
commit 33b90794e1
4 changed files with 6 additions and 6 deletions

View File

@ -20,6 +20,6 @@ require 'utils'
# TODO if whoami == root then use /Library/Caches/Homebrew instead # TODO if whoami == root then use /Library/Caches/Homebrew instead
HOMEBREW_VERSION='0.3' HOMEBREW_VERSION='0.3'
HOMEBREW_CACHE=File.expand_path "~/Library/Caches/Homebrew" HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path
HOMEBREW_PREFIX=Pathname.new(__FILE__).dirname.parent.parent.cleanpath HOMEBREW_PREFIX=Pathname.new(__FILE__).dirname.parent.parent.cleanpath
HOMEBREW_CELLAR=HOMEBREW_PREFIX+'Cellar' HOMEBREW_CELLAR=HOMEBREW_PREFIX+'Cellar'

View File

@ -96,7 +96,7 @@ public
# yields self with current working directory set to the uncompressed tarball # yields self with current working directory set to the uncompressed tarball
def brew def brew
ohai "Downloading #{@url}" ohai "Downloading #{@url}"
FileUtils.mkpath HOMEBREW_CACHE HOMEBREW_CACHE.mkpath
Dir.chdir HOMEBREW_CACHE do Dir.chdir HOMEBREW_CACHE do
tmp=nil tmp=nil
tgz=Pathname.new(fetch()).realpath tgz=Pathname.new(fetch()).realpath

View File

@ -1,7 +1,7 @@
def hw_model_output def hw_model_output
require 'fileutils' require 'fileutils'
FileUtils.mkpath HOMEBREW_CACHE HOMEBREW_CACHE.mkpath
exe=Pathname.new(HOMEBREW_CACHE)+'hw.model' exe=HOMEBREW_CACHE+'hw.model'
Kernel.system "gcc -Os #{File.dirname __FILE__}/hw.model.c -o #{exe}" unless exe.file? Kernel.system "gcc -Os #{File.dirname __FILE__}/hw.model.c -o #{exe}" unless exe.file?
/(.*)(\d+),(\d+)/ =~ `#{exe}` /(.*)(\d+),(\d+)/ =~ `#{exe}`
yield $1, $2.to_i, $3.to_i yield $1, $2.to_i, $3.to_i

View File

@ -9,13 +9,13 @@ require 'utils'
# these are defined in env.rb usually, but we don't want to break our actual # these are defined in env.rb usually, but we don't want to break our actual
# homebrew tree, and we do want to test everything :) # homebrew tree, and we do want to test everything :)
HOMEBREW_VERSION='0.3t' HOMEBREW_VERSION='0.3t'
HOMEBREW_CACHE="/tmp/testbrew" HOMEBREW_CACHE=Pathname.new "/tmp/testbrew"
HOMEBREW_PREFIX=Pathname.new(HOMEBREW_CACHE)+'prefix' HOMEBREW_PREFIX=Pathname.new(HOMEBREW_CACHE)+'prefix'
HOMEBREW_CELLAR=Pathname.new(HOMEBREW_CACHE)+'cellar' HOMEBREW_CELLAR=Pathname.new(HOMEBREW_CACHE)+'cellar'
HOMEBREW_CELLAR.mkpath HOMEBREW_CELLAR.mkpath
raise "HOMEBREW_CELLAR couldn't be created!" unless HOMEBREW_CELLAR.directory? raise "HOMEBREW_CELLAR couldn't be created!" unless HOMEBREW_CELLAR.directory?
at_exit { Pathname.new(HOMEBREW_CACHE).rmtree } at_exit { HOMEBREW_CACHE.rmtree }
require 'test/unit' # must be after at_exit require 'test/unit' # must be after at_exit