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

Class Method Details

.msg(str) ⇒ Object



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

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
24
# File 'lib/braid/command.rb', line 9

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

  klass = Commands.const_get(command.to_s)
  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



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

def config
  @config ||= Config.new({'mode' => config_mode})
end

#force?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/braid/command.rb', line 42

def force?
  Braid.force
end

#msg(str) ⇒ Object



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

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

#verbose?Boolean

Returns:

  • (Boolean)


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

def verbose?
  Braid.verbose
end