class Moodwall::Executable

Attributes

arguments[R]
command[R]

Public Class Methods

execute(path) click to toggle source
# File lib/moodwall/executable.rb, line 14
def self.execute(path)
  new.execute(path)
end
new(options = {}, config = Config.new) click to toggle source
# File lib/moodwall/executable.rb, line 7
def initialize(options = {}, config = Config.new)
  @config    = config.executable
  @command   = options.fetch(:command, @config.command)
  @arguments = options.fetch(:arguments, @config.arguments)
  error_if_missing
end

Public Instance Methods

error_if_missing() click to toggle source
# File lib/moodwall/executable.rb, line 18
def error_if_missing
  raise(MissingExecutableError, "Can't find the `#{ command }`") unless installed?
end
execute(path) click to toggle source
# File lib/moodwall/executable.rb, line 22
def execute(path)
  system "#{ command } #{ arguments } #{ path }"
end

Private Instance Methods

installed?() click to toggle source
# File lib/moodwall/executable.rb, line 28
def installed?
  system "which #{ command }"
  $?.success?
end