module PuntfileHelper

Constants

SUPPORTED_PUNTFILES

Public Instance Methods

punt_environment(env: nil) click to toggle source

Pulls the specific environment hash out of the Puntfile. If no environment is given, this automatically returns the default environment.

# File lib/punt/helper/puntfile_helper.rb, line 15
def punt_environment(env: nil)
    env = puntfile.first.first unless env
    environment = puntfile[env] if env

    if (!environment)
        raise "No environment #{env} was found in the puntfile"
    end

    return environment
end
puntfile() click to toggle source

Returns the puntfile hash for the current program. This will scan the various supported Puntfile file formats and attempt to load the first one it finds.

# File lib/punt/helper/puntfile_helper.rb, line 7
def puntfile
    load_puntfile

    return @@puntfile
end

Private Instance Methods

load_puntfile() click to toggle source
# File lib/punt/helper/puntfile_helper.rb, line 28
def load_puntfile
    return if defined?(@@puntfile)

    SUPPORTED_PUNTFILES.each do |puntfile|
        if File.exists?(puntfile)
            @@puntfile = YAML.load_file(puntfile)
            return
        end
    end

    raise "We couldn't find puntfile.yml in the current directory"
end