Class: Braid::Command

Inherits:
Object
  • Object
show all
Extended by:
Operations::VersionControl
Includes:
Operations::VersionControl
Defined in:
lib/braid/command.rb

Defined Under Namespace

Classes: InvalidRevision

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Operations::VersionControl

git, git_cache, git_svn, svn

Class Method Details

.msg(str) ⇒ Object



25
26
27
# File 'lib/braid/command.rb', line 25

def self.msg(str)
  puts "Braid: #{str}"
end

.run(command, *args) ⇒ Object



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

def self.run(command, *args)
  verify_git_version!

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

rescue BraidError => error
  case error
  when Operations::ShellExecutionError
    msg "Shell error: #{error.message}"
  else
    msg "Error: #{error.message}"
  end
  exit(1)
end

Instance Method Details

#configObject



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

def config
  @config ||= load_and_migrate_config
end

#msg(str) ⇒ Object



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

def msg(str)
  self.class.msg(str)
end

#verbose?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/braid/command.rb', line 37

def verbose?
  Braid.verbose
end