class Perfume::Shell::Base
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.
Public Instance Methods
before()
click to toggle source
# File lib/perfume/shell/base.rb, line 24 def before end
defaults()
click to toggle source
# File lib/perfume/shell/base.rb, line 20 def defaults { root: Dir.pwd } end
init()
click to toggle source
# File lib/perfume/shell/base.rb, line 12 def init @root = Pathname.new(@root) end
log()
click to toggle source
# File lib/perfume/shell/base.rb, line 16 def log @log or self.class.log end
to_s()
click to toggle source
# File lib/perfume/shell/base.rb, line 27 def to_s cmd.to_s end
Protected Instance Methods
fail!(msg = "Shell command execution failed!")
click to toggle source
# File lib/perfume/shell/base.rb, line 33 def fail!(msg = "Shell command execution failed!") raise ExecutionError, msg end