Sha256: b32d5d66320cd617087f4981e0b24563b66523fe89cd85f1722106401484c2f3

Contents?: true

Size: 1.03 KB

Versions: 19

Compression:

Stored size: 1.03 KB

Contents

module Terraspace
  module Core
    extend Memoist

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

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

    # allow testing frameworks to switch roots
    def root=(v)
      @@root = v
    end

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

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

    def log_root
      "#{root}/log"
    end

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

    # Generally, use the Terraspace.config instead of App.instance.config since it guarantees the load_project_config call
    def config
      App.instance.load_project_config
      App.instance.config
    end
    memoize :config

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

    # allow different logger when running up all
    def logger=(v)
      @@logger = v
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
terraspace-0.6.5 lib/terraspace/core.rb
terraspace-0.6.4 lib/terraspace/core.rb
terraspace-0.6.3 lib/terraspace/core.rb
terraspace-0.6.2 lib/terraspace/core.rb
terraspace-0.6.1 lib/terraspace/core.rb
terraspace-0.6.0 lib/terraspace/core.rb
terraspace-0.5.12 lib/terraspace/core.rb
terraspace-0.5.11 lib/terraspace/core.rb
terraspace-0.5.10 lib/terraspace/core.rb
terraspace-0.5.9 lib/terraspace/core.rb
terraspace-0.5.8 lib/terraspace/core.rb
terraspace-0.5.7 lib/terraspace/core.rb
terraspace-0.5.6 lib/terraspace/core.rb
terraspace-0.5.5 lib/terraspace/core.rb
terraspace-0.5.4 lib/terraspace/core.rb
terraspace-0.5.3 lib/terraspace/core.rb
terraspace-0.5.2 lib/terraspace/core.rb
terraspace-0.5.1 lib/terraspace/core.rb
terraspace-0.5.0 lib/terraspace/core.rb