class Spore::Parser

Attributes

hash[R]

Public Class Methods

call() click to toggle source
# File lib/spore/parser.rb, line 6
def call
  config = Spore::Config.load
  new(config).hash
end
new(config) click to toggle source
# File lib/spore/parser.rb, line 13
def initialize(config)
  @config = config
  spore = JSON.parse(File.read config.spore_file)
  translate(spore["id"], spore["envs"][config.environment])
end

Public Instance Methods

translate(app_id, hash) click to toggle source
# File lib/spore/parser.rb, line 19
def translate(app_id, hash)
  @hash = {}
  hash.each do |key, value|
    # Translate APP_ENV to RAILS_ENV
    key = "RAILS_ENV" if key == "APP_ENV"
    @hash[key] = @config.fetch(app_id, value)
  end
  @hash
end