Ignore stdout during GitDownloadStrategy.stage

This commit is contained in:
Max Howell 2009-11-09 18:24:36 +00:00
parent 75c7c942a1
commit 04f3ddeac0
3 changed files with 18 additions and 18 deletions

View File

@ -140,7 +140,7 @@ class GitDownloadStrategy <AbstractDownloadStrategy
safe_system 'git', 'clone', @url, @clone
else
# TODO git pull?
puts "Repository already cloned"
puts "Repository already cloned to #{@clone}"
end
end
def stage
@ -150,9 +150,9 @@ class GitDownloadStrategy <AbstractDownloadStrategy
ohai "Checking out #{@spec} #{@ref}"
case @spec
when :branch
safe_system 'git', 'checkout', "origin/#{@ref}"
nostdout { safe_system 'git', 'checkout', "origin/#{@ref}" }
when :tag
safe_system 'git', 'checkout', @ref
nostdout { safe_system 'git', 'checkout', @ref }
end
end
# http://stackoverflow.com/questions/160608/how-to-do-a-git-export-like-svn-export

View File

@ -136,21 +136,6 @@ class RefreshBrewMock < RefreshBrew
end
end
def nostdout
if ARGV.include? '-V'
yield
end
begin
require 'stringio'
tmpo=$stdout
tmpe=$stderr
$stdout=StringIO.new
yield
ensure
$stdout=tmpo
end
end
module ExtendArgvPlusYeast
def reset
@named = nil

View File

@ -159,3 +159,18 @@ def ignore_interrupts
ensure
trap("INT", std_trap)
end
def nostdout
if ARGV.verbose?
yield
else
begin
require 'stringio'
real_stdout = $stdout
$stdout = StringIO.new
yield
ensure
$stdout = real_stdout
end
end
end