Class: Dauphin::Runtime
- Inherits:
-
Object
- Object
- Dauphin::Runtime
- Defined in:
- lib/dauphin/runtime.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #check_for_binary ⇒ Object
- #default_executable_path ⇒ Object
-
#initialize(exepath = nil) ⇒ Runtime
constructor
A new instance of Runtime.
- #join(options) ⇒ Object
Constructor Details
#initialize(exepath = nil) ⇒ Runtime
Returns a new instance of Runtime.
7 8 9 10 11 12 13 |
# File 'lib/dauphin/runtime.rb', line 7 def initialize(exepath=nil) puts "Making new Runtime(#{self.inspect}), path: #{exepath.inspect}" @path = exepath || default_executable_path puts "default_executable_path: #{path}" puts "Path: #{@path}" check_for_binary end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/dauphin/runtime.rb', line 5 def path @path end |
Instance Method Details
#check_for_binary ⇒ Object
15 16 17 18 |
# File 'lib/dauphin/runtime.rb', line 15 def check_for_binary raise 'Cannot find prince command-line app in $PATH' if !path || path.length == 0 raise "Cannot run executable at #{path}" unless File.executable? path end |
#default_executable_path ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/dauphin/runtime.rb', line 20 def default_executable_path if Platform.windows? return 'C:/Program Files/Prince/Engine/bin/prince' end if Platform.linux? `which prince`.chomp end end |
#join(options) ⇒ Object
29 30 31 |
# File 'lib/dauphin/runtime.rb', line 29 def join() ([@path] + Array()).join(' ') end |