Class: AudioBookCreator::Runner

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/audio_book_creator/runner.rb

Instance Method Summary collapse

Methods included from Logging

#logger

Instance Method Details

#run(cmd, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/audio_book_creator/runner.rb', line 6

def run(cmd, options)
  params = options.fetch(:params).flatten.flatten.compact

  cmdline = [cmd] + params.map(&:to_s)

  logger.info { "run: #{cmdline.join(" ")}" }
  logger.info ""
  status = system(*cmdline)
  logger.info ""
  logger.info { status ? "success" : "issue" }

  status
end

#run!(cmd, options) ⇒ Object



20
21
22
# File 'lib/audio_book_creator/runner.rb', line 20

def run!(cmd, options)
  run(cmd, options) || raise("trouble running command")
end