Class: Terraspace::App

Inherits:
Object
  • Object
show all
Includes:
DslEvaluator, Singleton
Defined in:
lib/terraspace/app.rb,
lib/terraspace/app/hooks.rb

Defined Under Namespace

Classes: Hooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



7
8
9
# File 'lib/terraspace/app.rb', line 7

def initialize
  @config = defaults
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/terraspace/app.rb', line 6

def config
  @config
end

Instance Method Details

#configure {|@config| ... } ⇒ Object

Yields:



28
29
30
# File 'lib/terraspace/app.rb', line 28

def configure
  yield(@config)
end

#defaultsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/terraspace/app.rb', line 11

def defaults
  config = ActiveSupport::OrderedOptions.new
  config.test_framework = "rspec"
  config.logger = Logger.new($stdout)
  config.logger.level = :info
  config.hooks = Hooks.new
  config.cloud = ActiveSupport::OrderedOptions.new
  config.cloud.overwrite = true
  config.cloud.overwrite_sensitive = true
  config.cloud.relative_root = nil
  config.build = ActiveSupport::OrderedOptions.new
  config.build.cache_root = nil # defaults to /full/path/to/.terraspace-cache
  config.build.cache_dir = ":CACHE_ROOT/:REGION/:ENV/:BUILD_DIR"
  config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
  config
end

#load_project_configObject



32
33
34
35
36
# File 'lib/terraspace/app.rb', line 32

def load_project_config
  evaluate_file("#{Terraspace.root}/config/app.rb")
  path = "#{Terraspace.root}/config/env/#{Terraspace.env}.rb"
  evaluate_file(path)
end