Class: Braid::Command

Inherits:
Object
  • Object
show all
Extended by:
Operations::VersionControl, T::Sig
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 T::Sig

sig

Methods included from Operations::VersionControl

git, git_cache

Class Method Details

.msg(str) ⇒ Object



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

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

.run(command, *args) ⇒ Object



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

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



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

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

#force?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/braid/command.rb', line 49

def force?
  Braid.force
end

#msg(str) ⇒ Object



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

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

#verbose?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/braid/command.rb', line 44

def verbose?
  Braid.verbose
end