Class: Gjp::KitRunner
Overview
runs programs from a gjp kit with gjp-specific options
Direct Known Subclasses
Instance Method Summary collapse
-
#find_executable(name) ⇒ Object
finds an executable in a bin/ subdirectory of kit.
-
#initialize(project) ⇒ KitRunner
constructor
A new instance of KitRunner.
-
#run_executable(full_commandline) ⇒ Object
runs an external executable, returns true on success.
Methods included from Logging
Constructor Details
#initialize(project) ⇒ KitRunner
Returns a new instance of KitRunner.
8 9 10 |
# File 'lib/gjp/kit_runner.rb', line 8 def initialize(project) @project = project end |
Instance Method Details
#find_executable(name) ⇒ Object
finds an executable in a bin/ subdirectory of kit
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gjp/kit_runner.rb', line 13 def find_executable(name) @project.from_directory do Find.find("kit") do |path| next unless path =~ /bin\/#{name}$/ log.debug("found #{name} executable: #{path}") return path end end log.debug("#{name} executable not found") nil end |
#run_executable(full_commandline) ⇒ Object
runs an external executable, returns true on success
28 29 30 31 32 |
# File 'lib/gjp/kit_runner.rb', line 28 def run_executable(full_commandline) log.debug "running #{full_commandline}" Process.wait(Process.spawn(full_commandline)) $CHILD_STATUS.exitstatus == 0 end |