Class: Tetra::Kit

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/tetra/kit.rb

Overview

encapsulates a Tetra kit directory

Instance Method Summary collapse

Methods included from Logging

#log

Constructor Details

#initialize(project) ⇒ Kit

Returns a new instance of Kit.



8
9
10
# File 'lib/tetra/kit.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 returns nil if executable cannot be found



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tetra/kit.rb', line 14

def find_executable(name)
  @project.from_directory do
    Find.find("kit") do |path|
      next unless path =~ %r{(.*bin)/#{name}$} && File.executable?(path)
      result = Regexp.last_match[1]

      log.debug("found #{name} executable in #{result}")
      return result
    end
  end

  nil
end