class Rlt::Utils::Shell
Public Class Methods
new(opts = {})
click to toggle source
# File lib/rlt/utils/shell.rb, line 8 def initialize(opts = {}) @cmd = TTY::Command.new(printer: printer(opts), pty: true, dry_run: Rlt.debug) end
Public Instance Methods
current_user()
click to toggle source
# File lib/rlt/utils/shell.rb, line 24 def current_user ENV['USER'] || ENV['USERNAME'] end
run(*args)
click to toggle source
# File lib/rlt/utils/shell.rb, line 12 def run(*args) result = @cmd.run(*args, user: current_user) puts '' if Rlt.debug result end
run_safely(*args)
click to toggle source
# File lib/rlt/utils/shell.rb, line 18 def run_safely(*args) result = @cmd.run!(*args, user: current_user) puts '' if Rlt.debug result.success? end
Private Instance Methods
printer(opts)
click to toggle source
# File lib/rlt/utils/shell.rb, line 30 def printer(opts) if Rlt.debug :quiet else opts[:no_output] ? :null : :quiet end end