Sha256: a093abbbdc3ae332e53c9e976dbb721d0849070c22be96b9409a3d8880f6d907

Contents?: true

Size: 622 Bytes

Versions: 5

Compression:

Stored size: 622 Bytes

Contents

# encoding: UTF-8

module Tetra
  # encapsulates a Tetra kit directory
  class Kit
    include Logging

    def initialize(project)
      @project = project
    end

    # finds an executable in a bin/ subdirectory of kit
    # returns nil if executable cannot be found
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tetra-2.0.6 lib/tetra/kit.rb
tetra-2.0.5 lib/tetra/kit.rb
tetra-2.0.4 lib/tetra/kit.rb
tetra-2.0.3 lib/tetra/kit.rb
tetra-2.0.2 lib/tetra/kit.rb