diff options
| author | Max Howell | 2009-05-21 03:26:44 +0100 |
|---|---|---|
| committer | Max Howell | 2009-05-21 03:26:44 +0100 |
| commit | 5d13eee9d4afe741ef12493de2e6ab14e4479d29 (patch) | |
| tree | 2cd90b683ae112007ac05c829481e0d7b782f954 | |
| parent | a2afb5a4192caa858f90ac931da8599eb225e1f9 (diff) | |
| download | brew-5d13eee9d4afe741ef12493de2e6ab14e4479d29.tar.bz2 | |
Prettier exception handler
Build timing
No dmd caveats
| -rw-r--r-- | Cellar/homebrew/brewkit.rb | 16 | ||||
| -rw-r--r-- | Formula/dmd.rb | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/Cellar/homebrew/brewkit.rb b/Cellar/homebrew/brewkit.rb index 971cdc7e3..4bb102f98 100644 --- a/Cellar/homebrew/brewkit.rb +++ b/Cellar/homebrew/brewkit.rb @@ -1,7 +1,5 @@ # Copyright 2009 Max Howell <max@methylblue.com> # Licensed as per the GPL version 3 -require 'find' -require 'fileutils' require 'pathname' $agent = "Homebrew 0.1 (Ruby; Mac OS X 10.5 Leopard)" @@ -16,6 +14,9 @@ end class Formula + require 'find' + require 'fileutils' + # if you reimplement, assign @name, @version, @url and @md5 def initialize(url, md5) @name = File.basename $0, '.rb' #original script that the interpreter started @@ -41,6 +42,8 @@ class Formula raise "@version.nil?" if @version.nil? raise "@name does not validate to our regexp" unless /^\w+$/ =~ @name + beginning = Time.now + prefix=$cellar+@name+@version raise "#{prefix} already exists!" if prefix.exist? @@ -78,7 +81,7 @@ class Formula # stay in appsupport in case any odd files gets created etc. `#{$cellar}/homebrew/brew ln #{prefix}` if prefix.exist? - puts "#{prefix}: "+`find #{prefix} -type f | wc -l`.strip+' files, '+`du -hd0 #{prefix} | cut -d"\t" -f1`.strip + puts "#{prefix}: "+`find #{prefix} -type f | wc -l`.strip+' files, '+`du -hd0 #{prefix} | cut -d"\t" -f1`.strip+", built in #{Time.now - beginning} seconds" end end @@ -141,6 +144,13 @@ def system cmd end end +# force a prettier exception handler unless --verbose or HOMEBREW_DEBUG +Kernel.at_exit { + unless ARGV.include? '--verbose' or ENV['HOMEBREW_DEBUG'] + puts "\033[1;31mError\033[0;0m: #{$!}" if $! + exit! 1 + end +} ########################################################################script if $0 == __FILE__ diff --git a/Formula/dmd.rb b/Formula/dmd.rb index 2e287f97d..d390a9fa2 100644 --- a/Formula/dmd.rb +++ b/Formula/dmd.rb @@ -21,4 +21,6 @@ Formula.new(url, md5).brew do |prefix| FileUtils.cp_r Dir['html/d/*'], html unless ARGV.include? '--no-html' FileUtils.cp_r Dir['samples/d/*'], samples unless ARGV.include? '--no-samples' + + nil end
\ No newline at end of file |
