Skip to content
Browse files

Make testing_env somewhat readable

  • Loading branch information...
1 parent 18ac84a commit 6731611a79b790f0485c4295ba35845d75490954 @jacknagel jacknagel committed Apr 1, 2013
Showing with 21 additions and 21 deletions.
  1. +21 −21 Library/Homebrew/test/testing_env.rb
View
42 Library/Homebrew/test/testing_env.rb
@@ -4,48 +4,48 @@
# Require this file to build a testing environment.
-ABS__FILE__=File.expand_path(__FILE__)
-
+ABS__FILE__ = File.expand_path(__FILE__)
$:.push(File.expand_path(__FILE__+'/../..'))
+
require 'extend/fileutils'
require 'extend/pathname'
require 'extend/string'
require 'exceptions'
require 'utils'
-# these are defined in global.rb, but we don't want to break our actual
-# homebrew tree, and we do want to test everything :)
-HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix'
-HOMEBREW_REPOSITORY=HOMEBREW_PREFIX
-HOMEBREW_LIBRARY=HOMEBREW_REPOSITORY+"Library"
-HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache"
-HOMEBREW_CACHE_FORMULA=HOMEBREW_PREFIX.parent+"formula_cache"
-HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar"
-HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
-HOMEBREW_USER_AGENT="Homebrew"
-HOMEBREW_WWW='http://example.com'
-HOMEBREW_CURL_ARGS = '-fsLA'
-HOMEBREW_VERSION = '0.9-test'
+# Constants normally defined in global.rb
+HOMEBREW_PREFIX = Pathname.new('/private/tmp/testbrew/prefix')
+HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
+HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
+HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
+HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+'formula_cache'
+HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+'cellar'
+HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+'logs'
+HOMEBREW_USER_AGENT = 'Homebrew'
+HOMEBREW_WWW = 'http://example.com'
+HOMEBREW_CURL_ARGS = '-fsLA'
+HOMEBREW_VERSION = '0.9-test'
MACOS = true
MACOS_VERSION = ENV.fetch('MACOS_VERSION', 10.6)
MACOS_FULL_VERSION = '10.6.8'
+ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
+
+module Homebrew extend self
+ include FileUtils
+end
+
+# Test environment setup
%w{Library/Formula Library/ENV}.each do |d|
HOMEBREW_REPOSITORY.join(d).mkpath
end
-ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
-
at_exit { HOMEBREW_PREFIX.parent.rmtree }
# Test fixtures and files can be found relative to this path
TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath
-module Homebrew extend self
- include FileUtils
-end
-
def shutup
if ARGV.verbose?
yield

0 comments on commit 6731611

Please sign in to comment.
Something went wrong with that request. Please try again.