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

View File

@ -159,3 +159,18 @@ def ignore_interrupts
ensure ensure
trap("INT", std_trap) trap("INT", std_trap)
end 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