Class: Brigit::HopCommand
- Defined in:
- lib/brigit/commands/hop_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
Methods included from Pretending
Methods included from Fallible
Methods included from Listable
Constructor Details
This class inherits a constructor from Brigit::Command
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/brigit/commands/hop_command.rb', line 7 def run ref = default_ref super do |parser| parser.on('-r TREE-ISH', '--ref', "(default: `#{ref}')") do |treeish| ref = treeish end add_pretend_to parser end check_url! changed = [] errors = [] submodules.each do |path, parent| Dir.chdir path do say "cd #{path}" if clean? sh 'git pull origin master' sh "git checkout '#{ref}'" changed << parent else say "Working directory isn't clean, skipping" errors << path end end end if changed.any? say "---\nPlease check and commit the following parent repositories:\n#{format_list changed}" end if errors.any? say "---\nCould not update the following locations:\n#{format_list errors}" end end |