Sha256: 9305a765842bd748dd309befaf2979e652db51effc3ad700af4e6486beab73be

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require "yaml"

module Linner
  class Environment

    def initialize(path)
      @env ||= (YAML::load(File.read path) || Hash.new)
      @convension = YAML::load File.read(File.join File.dirname(__FILE__), "../../vendor", "config.default.yml")
      @env = @convension.rmerge!(@env)
    end

    def paths
      groups.map { |group| group["paths"] }.flatten.uniq
    end

    %w(app test vendor public).each do |method|
      define_method("#{method}_folder") do
        @env["paths"][method]
      end
    end

    def revision
      @env["revision"]
    end

    def notification
      @env["notification"]
    end

    def modules_ignored
      Dir.glob(@env["modules"]["ignored"])
    end

    def wrapper
      @env["modules"]["wrapper"]
    end

    def definition
      File.join public_folder, @env["modules"]["definition"]
    end

    def groups
      @env["groups"].values
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linner-0.4.0 lib/linner/environment.rb