module Graspi

Constants

VERSION

Public Class Methods

config(env = nil) click to toggle source
# File lib/graspi.rb, line 27
def self.config(env = nil)
  @@config ||= begin
    config = {}
    config_yaml = YAML.load_file(self.config_file)

    config_yaml['environments'].each do |env_name|
      config[env_name] = config_yaml[env_name].clone
    end

    config_yaml['environments'].each do |env_name|
      config_yaml.delete(env_name)
    end

    config_yaml['environments'].each do |env_name|
      config[env_name] = config_yaml.clone.merge(config[env_name])
    end

    config
  end

  if env.nil?
    @@config
  else
    @@config[env]
  end
end
config_file() click to toggle source
# File lib/graspi.rb, line 19
def self.config_file
  @@config_file ||= 'graspi.yml'
end
config_file=(config) click to toggle source
# File lib/graspi.rb, line 23
def self.config_file=(config)
  @@config_file = config
end
manifest(env) click to toggle source
# File lib/graspi.rb, line 58
def self.manifest(env)
  file = File.read(self.manifest_path(env))

  JSON.parse(file)[env]
end
manifest_path(env) click to toggle source
# File lib/graspi.rb, line 54
def self.manifest_path(env)
  File.join(Graspi.root, self.config(env)['manifest']['path'])
end
root() click to toggle source
# File lib/graspi.rb, line 15
def self.root
  File.expand_path '../..', __FILE__
end