Class: GitBundle::CLI
Constant Summary
Constants included from Console
Instance Method Summary collapse
- #exec_all(*argv) ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #invoke(args) ⇒ Object
Methods included from Console
#puts_attention, #puts_error, #puts_heading, #puts_prompt, #puts_repo_heading
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
5 6 7 8 |
# File 'lib/git_bundle/cli.rb', line 5 def initialize @errors = [] load_repositories end |
Instance Method Details
#exec_all(*argv) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/git_bundle/cli.rb', line 24 def exec_all(*argv) exec_errors = [] @repositories.each do |repo| puts_repo_heading(repo) puts repo.execute_git(argv.join(' ')) exec_errors << repo.name unless $?.exitstatus == 0 end @errors << "Command failed in #{exec_errors.join(', ')}." unless exec_errors.empty? end |
#invoke(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/git_bundle/cli.rb', line 10 def invoke(args) case args[0] when nil, '--help', 'help' puts `git #{args.join(' ')}`.gsub('git', 'gitb') when 'push' push = GitBundle::Push.new(@repositories, args[1..-1]) push.invoke if push.prompt_confirm else exec_all(args) end puts_error @errors.join('\n') unless @errors.empty? end |