aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2009-08-03 09:59:14 -0700
committerMax Howell2009-08-10 16:15:24 +0100
commitcae0e78e6065b95ce2fc47d0d2cdd500945ffe6d (patch)
treef5ddbd5eb7094dbfd517704619af3c18a5c1948a
parentfea89daae6e7b2d6bcae4b89becc819a1df4aac9 (diff)
downloadbrew-cae0e78e6065b95ce2fc47d0d2cdd500945ffe6d.tar.bz2
Pull USERAGENT used by curl into constant
-rw-r--r--Library/Homebrew/formula.rb4
-rwxr-xr-xLibrary/Homebrew/unittest.rb2
-rwxr-xr-xbin/brew1
3 files changed, 3 insertions, 4 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 1b20c9640..4f02e2077 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -174,10 +174,8 @@ private
tgz=File.expand_path File.basename(@url)
end
- agent="Homebrew #{HOMEBREW_VERSION} (Ruby #{VERSION}; Mac OS X 10.5 Leopard)"
-
unless File.exists? tgz
- `curl -#LA "#{agent}" #{oarg} "#{@url}"`
+ `curl -#LA "#{HOMEBREW_USER_AGENT}" #{oarg} "#{@url}"`
raise "Download failed" unless $? == 0
else
puts "File already downloaded and cached"
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 906912af8..878b05ab9 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -8,10 +8,10 @@ require 'utils'
# 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_VERSION='0.3t'
HOMEBREW_PREFIX=Pathname.new '/tmp/testbrew/prefix'
HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache"
HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar"
+HOMEBREW_USER_AGENT="Homebrew"
HOMEBREW_CELLAR.mkpath
raise "HOMEBREW_CELLAR couldn't be created!" unless HOMEBREW_CELLAR.directory?
diff --git a/bin/brew b/bin/brew
index 461fe307b..6af4460ac 100755
--- a/bin/brew
+++ b/bin/brew
@@ -4,6 +4,7 @@ require 'env'
require 'find'
PRISTINE_ARGV=ARGV.dup
+HOMEBREW_USER_AGENT="Homebrew #{HOMEBREW_VERSION} (Ruby #{VERSION}; Mac OS X 10.5 Leopard)"
# often causes Ruby to throw exception ffs
Dir.chdir '/' unless File.directory? ENV['PWD']