Class: Gjp::KitRunner

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/gjp/kit_runner.rb

Overview

runs programs from a gjp kit with gjp-specific options

Direct Known Subclasses

AntRunner, MavenRunner

Instance Method Summary collapse

Methods included from Logging

#log

Constructor Details

#initialize(project) ⇒ KitRunner

Returns a new instance of KitRunner.



11
12
13
# File 'lib/gjp/kit_runner.rb', line 11

def initialize(project)
  @project = project
end

Instance Method Details

#find_executable(name) ⇒ Object

finds an executable in a bin/ subdirectory of kit



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gjp/kit_runner.rb', line 16

def find_executable(name)
  @project.from_directory do
    Find.find("kit") do |path|
      if path =~ /bin\/#{name}$/
        log.debug("found #{name} executable: #{path}")
        return path
      end
    end
  end

  log.debug("#{name} executable not found")
  nil
end

#run_executable(full_commandline) ⇒ Object

runs an external executable, returns true on success



31
32
33
34
35
# File 'lib/gjp/kit_runner.rb', line 31

def run_executable(full_commandline)
  log.debug "running #{full_commandline}"
  Process.wait(Process.spawn(full_commandline))
  $?.exitstatus == 0
end