Add ARGV.git?

This commit is contained in:
Jack Nagel 2014-11-03 21:33:20 -06:00
parent 34c0b40abf
commit 3c9cc18c17
4 changed files with 8 additions and 4 deletions

View File

@ -115,7 +115,7 @@ class Build
end end
formula.brew do formula.brew do
if ARGV.flag? '--git' if ARGV.git?
system "git", "init" system "git", "init"
system "git", "add", "-A" system "git", "add", "-A"
end end
@ -124,7 +124,7 @@ class Build
puts "Type `exit' to return and finalize the installation" puts "Type `exit' to return and finalize the installation"
puts "Install to this prefix: #{formula.prefix}" puts "Install to this prefix: #{formula.prefix}"
if ARGV.flag? '--git' if ARGV.git?
puts "This directory is now a git repo. Make your changes and then use:" puts "This directory is now a git repo. Make your changes and then use:"
puts " git diff | pbcopy" puts " git diff | pbcopy"
puts "to copy the diff to the clipboard." puts "to copy the diff to the clipboard."

View File

@ -125,7 +125,7 @@ module Homebrew
fi.build_from_source = ARGV.build_from_source? fi.build_from_source = ARGV.build_from_source?
fi.force_bottle = ARGV.force_bottle? fi.force_bottle = ARGV.force_bottle?
fi.interactive = ARGV.interactive? fi.interactive = ARGV.interactive?
fi.interactive &&= :git if ARGV.flag? "--git" fi.interactive &&= :git if ARGV.git?
fi.verbose = ARGV.verbose? fi.verbose = ARGV.verbose?
fi.verbose &&= :quieter if ARGV.quieter? fi.verbose &&= :quieter if ARGV.quieter?
fi.debug = ARGV.debug? fi.debug = ARGV.debug?

View File

@ -36,7 +36,7 @@ module Homebrew
f.brew { cp_r getwd, stage_dir } f.brew { cp_r getwd, stage_dir }
ENV['VERBOSE'] = nil ENV['VERBOSE'] = nil
if ARGV.flag? "--git" if ARGV.git?
ohai "Setting up git repository" ohai "Setting up git repository"
cd stage_dir cd stage_dir
system "git", "init", "-q" system "git", "init", "-q"

View File

@ -86,6 +86,10 @@ module HomebrewArgvExtension
include?('--dry-run') || switch?('n') include?('--dry-run') || switch?('n')
end end
def git?
flag? "--git"
end
def homebrew_developer? def homebrew_developer?
include? '--homebrew-developer' or !ENV['HOMEBREW_DEVELOPER'].nil? include? '--homebrew-developer' or !ENV['HOMEBREW_DEVELOPER'].nil?
end end