Class: GitGuts::MultiPush
- Inherits:
-
Thor::GitGroup
- Object
- Group
- Thor::GitGroup
- GitGuts::MultiPush
- Defined in:
- lib/git_guts/multi_push.rb
Constant Summary collapse
- WORKING_DIRECTORY =
Dir.getwd
Constants inherited from Thor::GitGroup
Instance Method Summary collapse
Methods inherited from Thor::GitGroup
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_guts/multi_push.rb', line 9 def create begin raise Thor::Error.new("No branch specified".red) if remotes.size < 2 branch = remotes.pop Git.open(WORKING_DIRECTORY) remotes.each do |remote| puts "Pushing #{branch} to #{remote}" puts %x[git push #{remote} #{branch}] raise Thor::Error.new "Push to #{remote} failed" if $?.to_i > 0 end rescue ArgumentError raise Thor::Error.new "Could open repository. Is it a valid git repository ?" end end |