Sha256: 2d5e59aa4753cf3636267768a5a48a69c7d4683cf0049acba294e9804b9e1244

Contents?: true

Size: 898 Bytes

Versions: 7

Compression:

Stored size: 898 Bytes

Contents

# Loads a config file and evaluates the stored configuration
#
# @example of a config file
#
#   defaults email: "me@gmail.com", token: "d728201893d47607ec382", interval: 60
#   app "lonely-warrior-45", url: "http://cnamed.host/robots.txt"
#
class Heroku::Scalr::Config

  attr_reader :apps

  # @param [String] path file path containing a configuration
  def initialize(path)
    @defaults = {}
    @apps     = []
    instance_eval File.read(path)
  end

  # @param [Hash] opts updates for defaults
  # @see Heroku::Scalr::App#initialize for a full set of options
  def defaults(opts = {})
    @defaults.update(opts)
  end

  # @param [String] name the Heroku app name
  # @param [Hash] opts configuration options
  # @see Heroku::Scalr::App#initialize for a full set of options
  def app(name, opts = {})
    opts = @defaults.merge(opts)
    @apps << Heroku::Scalr::App.new(name, opts)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
heroku-scalr-0.3.0 lib/heroku/scalr/config.rb
heroku-scalr-0.2.4 lib/heroku/scalr/config.rb
heroku-scalr-0.2.3 lib/heroku/scalr/config.rb
heroku-scalr-0.2.2 lib/heroku/scalr/config.rb
heroku-scalr-0.2.1 lib/heroku/scalr/config.rb
heroku-scalr-0.2.0 lib/heroku/scalr/config.rb
heroku-scalr-0.1.0 lib/heroku/scalr/config.rb