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::Helpers

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

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
# File 'lib/braid/commands/remove.rb', line 4

def run(mirror)
  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