Class: StellarCoreBackup::Cmd
- Inherits:
-
Object
- Object
- StellarCoreBackup::Cmd
- Includes:
- Contracts
- Defined in:
- lib/stellar-core-backup/cmd.rb
Instance Method Summary collapse
-
#initialize(working_dir) ⇒ Cmd
constructor
A new instance of Cmd.
- #run(cmd, args) ⇒ Object
- #run_and_capture(cmd, args) ⇒ Object
Constructor Details
#initialize(working_dir) ⇒ Cmd
Returns a new instance of Cmd.
6 7 8 |
# File 'lib/stellar-core-backup/cmd.rb', line 6 def initialize(working_dir) @working_dir = working_dir end |
Instance Method Details
#run(cmd, args) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/stellar-core-backup/cmd.rb', line 20 def run(cmd, args) Dir.chdir @working_dir do system(cmd, *args) end CmdResult.new($?.exitstatus == 0, nil) end |
#run_and_capture(cmd, args) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/stellar-core-backup/cmd.rb', line 11 def run_and_capture(cmd, args) Dir.chdir @working_dir do stringArgs = args.map{|x| "#{x}"}.join(" ") out = `#{cmd} #{stringArgs}` CmdResult.new($?.exitstatus == 0, out) end end |