module Terraspace::Core

Public Instance Methods

argv() click to toggle source
# File lib/terraspace/core.rb, line 68
def argv
  @@argv
end
argv=(argv) click to toggle source

Terraspace.argv provides consistency when terraspace is being called by rspec-terrspace test harness So use Terraspace.argv instead of ARGV constant

# File lib/terraspace/core.rb, line 64
def argv=(argv)
  @@argv = argv
end
cache_root() click to toggle source
# File lib/terraspace/core.rb, line 20
def cache_root
  ENV['TS_CACHE_ROOT'] || config.build.cache_root || "#{root}/.terraspace-cache"
end
config() click to toggle source

Generally, use the Terraspace.config instead of App.instance.config since it guarantees the load_project_config call

# File lib/terraspace/core.rb, line 39
def config
  App.instance.load_project_config
  App.instance.config
end
configure(&block) click to toggle source
# File lib/terraspace/core.rb, line 34
def configure(&block)
  App.instance.configure(&block)
end
env() click to toggle source
# File lib/terraspace/core.rb, line 5
def env
  ENV['TS_ENV'] || "dev"
end
log_root() click to toggle source
# File lib/terraspace/core.rb, line 30
def log_root
  "#{root}/log"
end
logger() click to toggle source
# File lib/terraspace/core.rb, line 46
def logger
  @@logger ||= config.logger
end
logger=(v) click to toggle source

allow different logger when running up all

# File lib/terraspace/core.rb, line 51
def logger=(v)
  @@logger = v
end
pass_file?(path) click to toggle source
# File lib/terraspace/core.rb, line 55
def pass_file?(path)
  pass_files = config.build.pass_files + config.build.default_pass_files
  pass_files.uniq.detect do |i|
    i.is_a?(Regexp) ? path =~ i : path.include?(i)
  end
end
root() click to toggle source
# File lib/terraspace/core.rb, line 11
def root
  @@root ||= ENV['TS_ROOT'] || Dir.pwd
end
root=(v) click to toggle source

allow testing frameworks to switch roots

# File lib/terraspace/core.rb, line 16
def root=(v)
  @@root = v
end
tmp_root() click to toggle source
# File lib/terraspace/core.rb, line 25
def tmp_root
  ENV['TS_TMP_ROOT'] || "/tmp/terraspace"
end