Class: Braid::Command

Inherits:
Object
  • Object
show all
Extended by:
Operations::Git, Operations::Helpers
Includes:
Operations::Helpers, Operations::Mirror
Defined in:
lib/braid/command.rb

Class Method Summary collapse

Instance Method Summary collapse

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_git_version, find_git_revision, validate_revision_option, validate_svn_revision, verify_git_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

Class Method Details

.msg(str) ⇒ Object



28
29
30
# File 'lib/braid/command.rb', line 28

def msg(str)
  puts str
end

.run(command, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/braid/command.rb', line 10

def run(command, *args)
  raise Braid::Git::VersionTooLow unless verify_git_version(REQUIRED_GIT_VERSION)

  klass = Braid::Commands.const_get(command.to_s.capitalize)
  klass.new.run(*args)

rescue Braid::Git::LocalChangesPresent => e
  msg "Local changes are present. You have to commit or stash them before running braid commands."
  msg "Exiting."

rescue Braid::Git::VersionTooLow => e
  msg "This version of braid requires at least git #{REQUIRED_GIT_VERSION}. You have #{extract_git_version}."
  msg "Exiting."

rescue => e
  # FIXME
end

Instance Method Details

#configObject



33
34
35
# File 'lib/braid/command.rb', line 33

def config
  @config ||= Braid::Config.new
end