diff options
Diffstat (limited to 'Library/brew.rb')
| -rwxr-xr-x | Library/brew.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Library/brew.rb b/Library/brew.rb index 24b72fc9d..f2ea30110 100755 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -2,22 +2,22 @@ std_trap = trap("INT") { exit! 130 } # no backtrace thanks -HOMEBREW_BREW_FILE = ENV['HOMEBREW_BREW_FILE'] +HOMEBREW_BREW_FILE = ENV["HOMEBREW_BREW_FILE"] -if ARGV == %w{--prefix} +if ARGV == %w[--prefix] puts File.dirname(File.dirname(HOMEBREW_BREW_FILE)) exit 0 end -require 'pathname' +require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent.join("Homebrew") $:.unshift(HOMEBREW_LIBRARY_PATH.to_s) -require 'global' +require "global" -if ARGV.first == '--version' +if ARGV.first == "--version" puts HOMEBREW_VERSION exit 0 -elsif ARGV.first == '-v' +elsif ARGV.first == "-v" puts "Homebrew #{HOMEBREW_VERSION}" # Shift the -v to the end of the parameter list ARGV << ARGV.shift @@ -39,9 +39,9 @@ if OS.mac? && MacOS.version < :mavericks && MacOS.active_developer_dir == "/" EOS end -case HOMEBREW_PREFIX.to_s when '/', '/usr' - # it may work, but I only see pain this route and don't want to support it - abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}" +case HOMEBREW_PREFIX.to_s when "/", "/usr" + # it may work, but I only see pain this route and don't want to support it + abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}" end if OS.mac? and MacOS.version < "10.6" abort <<-EOABORT.undent @@ -54,10 +54,10 @@ end # odd exceptions. Reduce our support burden by showing a user-friendly error. Dir.getwd rescue abort "The current working directory doesn't exist, cannot proceed." -def require? path +def require?(path) require path rescue LoadError => e - # HACK :( because we should raise on syntax errors but + # HACK: ( because we should raise on syntax errors but # not if the file doesn't exist. TODO make robust! raise unless e.to_s.include? path end @@ -115,14 +115,14 @@ begin # arguments themselves. if empty_argv || (help_flag && (cmd.nil? || internal_cmd)) - # TODO - `brew help cmd` should display subcommand help - require 'cmd/help' + # TODO: - `brew help cmd` should display subcommand help + require "cmd/help" puts ARGV.usage exit ARGV.any? ? 0 : 1 end if internal_cmd - Homebrew.send cmd.to_s.gsub('-', '_').downcase + Homebrew.send cmd.to_s.gsub("-", "_").downcase elsif which "brew-#{cmd}" %w[CACHE CELLAR LIBRARY_PATH PREFIX REPOSITORY].each do |e| ENV["HOMEBREW_#{e}"] = Object.const_get("HOMEBREW_#{e}").to_s |
