Module: GGSM::Foreach

Includes:
Stash, Submodule
Included in:
Cli
Defined in:
lib/ggsm/command/foreach.rb

Instance Method Summary collapse

Methods included from Stash

#stash_pop, #try_stash

Methods included from Submodule

#check_submodule, #check_submodule_status, #check_un_commit_code, #correct_dir, #foreach_module, #get_current_branch, #get_head_commit, #get_lastest_msg, #get_lastest_msg_not_merge, #get_lastest_msg_of_module, #get_modified_submodule, #get_submodule, #get_submodule_commit, #is_submodule, #tip_contact_author

Methods included from Hooks

#check_hooks, #cp_files, #cp_hooks, #install_billow, #update_hooks

Instance Method Details

#foreach_flow(*commands) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ggsm/command/foreach.rb', line 10

def foreach_flow(*commands)
  check_submodule

  cmd = ''
  if commands.size == 0
    puts '请输入正确git命令 foreach [<commands>...]'.red
    return
  elsif commands.fetch(0) == 'git'
    commands.delete_at(0)
  end

  commands.each do |arg|
    cmd = "#{cmd} #{arg}"
  end

  foreach_module {
    system "git #{cmd}"
  }

  puts '==> *进入主工程:'.yellow
  system "git #{cmd}"

  puts "Modules执行:git#{cmd}".blue
end