Sha256: d1160e49ebb6b5ec4d5d553ee956169e8ea52634379a90fade47dfac1d33f549

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module Lono::Builder::Context
  module Loaders
    include LoadFiles

    # Variables in base.rb are overridden by their environment specific variables
    # file.  Example, file LONO_ENV=dev:
    #
    #   config/vars/base.rb
    #   config/vars/dev.rb - will override any variables in base.rb
    #   config/vars/base.rb
    #   config/vars/dev.rb - will override any variables in base.rb
    #
    def load_variables
      layers = Lono::Layering::Layer.new(@blueprint, "vars").paths
      layers.each do |layer|
        evaluate_variables_file(layer)
      end
    end

    # Load the variables defined in config/vars/* to make available in lono scope.
    #
    # NOTE: Was only able to make instance variables avaialble with instance_eval, wasnt able to make local variables
    # available.
    def evaluate_variables_file(path)
      return unless File.exist?(path)
      instance_eval(IO.read(path), path)
    end

    # Load blueprint helpers
    # blueprint helpers override extension helpers
    def load_blueprint_helpers
      load_files("#{@blueprint.root}/#{Lono.config.paths.helpers}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc2 lib/lono/builder/context/loaders.rb