Class: Braid::Commands::Remove

Inherits:
Braid::Command show all
Defined in:
lib/braid/commands/remove.rb

Instance Method Summary collapse

Methods inherited from Braid::Command

#config, msg, run

Methods included from Operations::Git

#git_checkout, #git_commit, #git_fetch, #git_merge_base, #git_merge_ours, #git_merge_subtree, #git_read_tree, #git_remote_add, #git_reset_hard, #git_rev_parse, #git_rm_r, #local_changes?

Methods included from Operations::Helpers

#clean_svn_revision, #determine_target_commit, #display_revision, #extract_version, #find_git_revision, #validate_revision_option, #validate_svn_revision, #verify_version

Methods included from Operations::Mirror

#add_config_file, #check_merge_status, #create_work_branch, #fetch_remote, #find_remote, #get_current_branch, #get_work_head

Instance Method Details

#run(mirror) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/braid/commands/remove.rb', line 4

def run(mirror)
  raise Braid::Git::LocalChangesPresent if invoke(:local_changes?)

  in_work_branch do
    params = config.get(mirror)
    unless params
      msg "Mirror '#{mirror}/' does not exist."
      return
    end

    msg "Removing #{params["type"]} mirror from '#{mirror}/'."

    invoke(:git_rm_r, mirror)

    config.remove(mirror)
    add_config_file

    commit_message = "Remove mirror '#{mirror}/'."
    invoke(:git_commit, commit_message)
  end
end