class EC2Launcher::ConfigLoader

Attributes

config[RW]

Public Class Methods

new(base_directory) click to toggle source
# File lib/ec2launcher/config_loader.rb, line 13
def initialize(base_directory)
  @config = load_config_file(base_directory)
end

Public Instance Methods

load_config_file(base_directory) click to toggle source

Read in the configuration file stored in the workspace directory. By default this will be ‘./config.rb’.

@return [EC2Launcher::Config] the parsed configuration object

# File lib/ec2launcher/config_loader.rb, line 21
def load_config_file(base_directory)
  # Load configuration file
  config_filename = File.join(base_directory, "config.rb")
  abort("Unable to find 'config.rb' in '#{base_directory}'") unless File.exists?(config_filename)
  EC2Launcher::DSL::ConfigDSL.execute(File.read(config_filename)).config
end