class Loader

Public Class Methods

new() click to toggle source

require '../dsl/eval'

# File src/Shuttl/Loader.rb, line 4
def initialize ()
    @dirs = []
    shuttlDir = File.join(Dir.home, '.shuttl/definitions')
    @dirs << shuttlDir
    if ENV.key('SHUTTL_PATH')
        @dirs << ENV['SHUTTL_PATH'].split(":")
    end
    @dirs << Dir.getwd
end

Public Instance Methods

find(name, stage) click to toggle source
# File src/Shuttl/Loader.rb, line 14
def find (name, stage)
    found = nil
    [name, "#{name}.shuttlfile"].each do |fileName|
        found = findFile(fileName, stage)
        if !found.nil?
            break
        end
    end
    if found.nil?
        throw "No shuttl file found"
    end
    found
end
findFile(file, stage) click to toggle source
# File src/Shuttl/Loader.rb, line 28
def findFile (file, stage)
    found = nil
    @dirs.each do | dir |
        potentialFileName = File.join(dir, file)
        if File.exist? potentialFileName
            found = ShuttlDSL.load potentialFileName, stage
            break
        end
    end
    found
end