Made the output of updating a bit nicer and log more if --verbose.

This commit is contained in:
Eloy Duran 2009-09-11 20:09:39 +02:00
parent bb03db8e6c
commit 3b8f3ad409
2 changed files with 11 additions and 4 deletions

View File

@ -27,7 +27,7 @@ class RefreshBrew
end
def current_revision
in_prefix { `#{REVISION_COMMAND}`.strip }
in_prefix { execute(REVISION_COMMAND).strip }
end
private
@ -36,11 +36,17 @@ class RefreshBrew
Dir.chdir(HOMEBREW_PREFIX) { yield }
end
def execute(cmd)
out = `#{cmd}`
ohai "#{cmd}: #{out}" if ARGV.verbose?
out
end
def git_checkout_masterbrew!
in_prefix { `#{CHECKOUT_COMMAND}` }
in_prefix { execute CHECKOUT_COMMAND }
end
def git_pull!
in_prefix { `#{UPDATE_COMMAND}` }
in_prefix { execute UPDATE_COMMAND }
end
end

View File

@ -113,10 +113,11 @@ begin
when 'up', 'update'
require 'refresh_brew'
updater = RefreshBrew.new
old_revision = updater.current_revision
unless updater.update_from_masterbrew!
ohai "Already up-to-date."
else
ohai "Updated Homebrew to: #{updater.current_revision}"
ohai "Updated Homebrew from #{old_revision} to #{updater.current_revision}."
if updater.pending_formulae_changes?
ohai "The following formulae were updated: #{updater.updated_formulae.join(', ')}"
else