class Nand::Launcher::Base

Attributes

execname[R]

Public Class Methods

launchable?(target, io, *argv) click to toggle source
# File lib/nand/launcher.rb, line 24
def self.launchable?(target, io, *argv)
  raise "Not Implemented #{__method__} in #{self.name}"
end
load( target, opts, *argv) click to toggle source
# File lib/nand/launcher.rb, line 27
def self.load( target, opts, *argv)
  raise "Not Implemented #{__method__} in #{self.name}"
end
new(target, opts, *argv) click to toggle source
# File lib/nand/launcher.rb, line 31
def initialize(target, opts, *argv)
  @progname    = target
  @execname    = opts[:name] || File.basename(target)
  @exec_stdout = opts[:out]  || "/dev/null"
  @exec_stderr = opts[:err]  || "/dev/null"
  @exec_stdin  = opts[:in]   || "/dev/null"
  @argv   = argv
end

Public Instance Methods

launch() click to toggle source
# File lib/nand/launcher.rb, line 39
def launch; end
ready?() click to toggle source
# File lib/nand/launcher.rb, line 40
def ready?
  [@exec_stdout, @exec_stderr].each do |out|
    next if out.is_a? IO
    path = Pathname.new(out)
    raise "Illegal Output File #{path.to_s}" unless (path.exist? and path.writable?) or
      (!path.exist? and path.dirname.writable?)
  end
  return true if @exec_stdin.is_a? IO
  path = Pathname.new(@exec_stdin)
  raise "Illegal Input File #{@exec_stdin.to_s}" unless path.exist? and path.readable?
  true
end