Module: Terraspace::Core

Extended by:
Memoist
Included in:
Terraspace
Defined in:
lib/terraspace/core.rb

Constant Summary collapse

@@root =
nil
@@logger =
nil

Instance Method Summary collapse

Instance Method Details

#cache_rootObject



20
21
22
# File 'lib/terraspace/core.rb', line 20

def cache_root
  ENV['TS_CACHE_ROOT'] || config.build.cache_root || "#{root}/.terraspace-cache"
end

#configObject

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



39
40
41
42
# File 'lib/terraspace/core.rb', line 39

def config
  App.instance.load_project_config
  App.instance.config
end

#configure(&block) ⇒ Object



34
35
36
# File 'lib/terraspace/core.rb', line 34

def configure(&block)
  App.instance.configure(&block)
end

#envObject



5
6
7
# File 'lib/terraspace/core.rb', line 5

def env
  ENV['TS_ENV'] || "dev"
end

#log_rootObject



30
31
32
# File 'lib/terraspace/core.rb', line 30

def log_root
  "#{root}/log"
end

#loggerObject



46
47
48
# File 'lib/terraspace/core.rb', line 46

def logger
  @@logger ||= config.logger
end

#logger=(v) ⇒ Object

allow different logger when running up all



51
52
53
# File 'lib/terraspace/core.rb', line 51

def logger=(v)
  @@logger = v
end

#rootObject



11
12
13
# File 'lib/terraspace/core.rb', line 11

def root
  @@root ||= ENV['TS_ROOT'] || Dir.pwd
end

#root=(v) ⇒ Object

allow testing frameworks to switch roots



16
17
18
# File 'lib/terraspace/core.rb', line 16

def root=(v)
  @@root = v
end

#tmp_rootObject



25
26
27
# File 'lib/terraspace/core.rb', line 25

def tmp_root
  ENV['TS_TMP_ROOT'] || "/tmp/terraspace"
end