Class: Perfume::Shell::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/perfume/shell/base.rb

Overview

Internal: Executing shell commands isn’t good practice. Especially it’s bad when calling ruby methods like ‘exec` or `system`. This is dangerous and completely untestable. So here it comes base wrapper around shell calls.

Check Perfume::Shell::Exec and Perfume::Shell:SystemCall for two most common use cases.

Direct Known Subclasses

Exec, SystemCall

Instance Method Summary collapse

Instance Method Details

#beforeObject



24
25
# File 'lib/perfume/shell/base.rb', line 24

def before
end

#defaultsObject



20
21
22
# File 'lib/perfume/shell/base.rb', line 20

def defaults
  { root: Dir.pwd }
end

#initObject



12
13
14
# File 'lib/perfume/shell/base.rb', line 12

def init
  @root = Pathname.new(@root)
end

#logObject



16
17
18
# File 'lib/perfume/shell/base.rb', line 16

def log
  @log or self.class.log
end

#to_sObject



27
28
29
# File 'lib/perfume/shell/base.rb', line 27

def to_s
  cmd.to_s
end