Module: GGSM::Delete

Includes:
Stash, Submodule
Included in:
Cli
Defined in:
lib/ggsm/command/delete.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_modified_submodule, #get_submodule, #get_submodule_commit, #tip_contact_author

Methods included from Hooks

#check_hooks, #cp_files, #cp_hooks, #update_hooks

Instance Method Details

#delete_branch(all, branch, remote) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ggsm/command/delete.rb', line 21

def delete_branch(all, branch, remote)
  if all
    system "git branch -D #{branch}"
    result = system "git push origin -d #{branch}"
    unless result
      system 'git fetch -p origin'
    end
  elsif remote
    result = system "git push origin -d #{branch}"
    unless result
      system 'git fetch -p origin'
    end
  else
    system "git branch -D #{branch}"
  end
end

#delete_flow(branch, remote, all) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ggsm/command/delete.rb', line 9

def delete_flow(branch, remote, all)
  check_submodule

  puts '==> 进入主工程:'.yellow

  delete_branch(all, branch, remote)

  foreach_module {
    delete_branch(all, branch, remote)
  }
end