class Princely::Executable

Attributes

path[R]

Public Class Methods

new(path=nil) click to toggle source
# File lib/princely/executable.rb, line 5
def initialize(path=nil)
  @path = path || default_executable_path

  check_for_executable
end

Public Instance Methods

check_for_executable() click to toggle source
# File lib/princely/executable.rb, line 11
def check_for_executable
  raise "Cannot find prince command-line app in $PATH" if !@path || @path.length == 0
  raise "Cannot find prince command-line app at #{@exe_path}" unless File.executable?(@path)
end
default_executable_path() click to toggle source
# File lib/princely/executable.rb, line 16
def default_executable_path
  if Princely.ruby_platform =~ /mswin32|minigw32/
    "C:/Program Files/Prince/Engine/bin/prince"
  else
    `which prince`.chomp
  end
end
join(options) click to toggle source
# File lib/princely/executable.rb, line 24
def join(options)
  ([path] + Array(options)).join(' ')
end