Class: Lono::Configure

Inherits:
Object
  • Object
show all
Includes:
Blueprint::Root
Defined in:
lib/lono/configure/base.rb,
lib/lono/configure.rb,
lib/lono/configure/helpers.rb,
lib/lono/configure/aws_services.rb

Overview

Subclasses must implement: setup, params, variables

Defined Under Namespace

Modules: AwsServices, Helpers Classes: Base

Instance Method Summary collapse

Methods included from Blueprint::Root

#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root

Constructor Details

#initialize(blueprint, options) ⇒ Configure

Returns a new instance of Configure.



7
8
9
10
# File 'lib/lono/configure.rb', line 7

def initialize(blueprint, options)
  @blueprint, @options = blueprint, options
  @args = options[:args] # hash
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lono/configure.rb', line 12

def run
  blueprint_root = find_blueprint_root(@blueprint)
  unless blueprint_root
    puts "ERROR: Did not find blueprint: #{@blueprint}".color(:red)
    puts "Are you sure you specified the right blueprint?"
    Blueprint::List.available
    exit 1
  end

  configs_path = "#{blueprint_root}/setup/configs.rb"
  unless File.exist?(configs_path)
    puts "No #{configs_path} file found.  Nothing to configure."
    exit
  end

  require configs_path
  unless defined?(Configs)
    puts "Configs class not found.\nAre you sure #{configs_path} contains a Configs class?"
    exit 1
  end
  configs = Configs.new(@blueprint, @options)
  # The Configs class implements: setup, params, and variables
  configs.run # setup the instance variables
end