Sha256: 083ef252217f9d93d3140a4ef4b3803dd8c650fab0d1f1c4f62f1fd9eafbc266

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

require 'pathname'
require 'yaml'

module Ufo
  module Core
    extend Memoist

    def role
      ENV['UFO_ROLE'] || 'web'
    end

    def app
      ENV['UFO_APP'] || config.app
    end

    # v5: development is default
    # v6: dev is default
    def env
      ENV['UFO_ENV'] || 'dev'
    end
    memoize :env

    def extra
      extra = ENV['UFO_EXTRA'] if ENV['UFO_EXTRA'] # highest precedence
      return if extra&.empty?
      extra
    end
    memoize :extra

    def root
      path = ENV['UFO_ROOT'] || '.'
      Pathname.new(path)
    end

    def log_root
      "#{root}/log"
    end

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

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

    # allow different logger when running up all or rspec-lono
    cattr_writer :logger
    def logger
      @@logger ||= config.logger
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ufo-6.0.9 lib/ufo/core.rb
ufo-6.0.8 lib/ufo/core.rb
ufo-6.0.7 lib/ufo/core.rb
ufo-6.0.6 lib/ufo/core.rb
ufo-6.0.5 lib/ufo/core.rb
ufo-6.0.4 lib/ufo/core.rb
ufo-6.0.3 lib/ufo/core.rb
ufo-6.0.2 lib/ufo/core.rb
ufo-6.0.1 lib/ufo/core.rb
ufo-6.0.0 lib/ufo/core.rb