Sha256: 7119a31880ff54b2728f72922596cb58261e0bc71886df960f860970d5683b7c

Contents?: true

Size: 800 Bytes

Versions: 14

Compression:

Stored size: 800 Bytes

Contents

module LitmusPaper
  class Configuration
    def initialize(config_file_path)
      @config_file_path = config_file_path
      @services = {}
    end

    def evaluate(file = @config_file_path)
      LitmusPaper.logger.info "Loading file #{file}"
      config_contents = File.read(file)
      instance_eval(config_contents)
      @services
    end

    def include_files(glob_pattern)
      full_glob_pattern = File.expand_path(glob_pattern, File.dirname(@config_file_path))
      LitmusPaper.logger.info "Searching for files matching: #{full_glob_pattern}"

      Dir.glob(full_glob_pattern).each do |file|
        evaluate(file)
      end
    end

    def service(name, &block)
      service = Service.new(name.to_s)
      block.call(service)
      @services[name.to_s] = service
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
litmus_paper-0.6.2 lib/litmus_paper/configuration.rb
litmus_paper-0.6.1 lib/litmus_paper/configuration.rb
litmus_paper-0.6.0 lib/litmus_paper/configuration.rb
litmus_paper-0.5.0 lib/litmus_paper/configuration.rb
litmus_paper-0.4.0 lib/litmus_paper/configuration.rb
litmus_paper-0.3.5 lib/litmus_paper/configuration.rb
litmus_paper-0.3.3 lib/litmus_paper/configuration.rb
litmus_paper-0.3.2 lib/litmus_paper/configuration.rb
litmus_paper-0.3.1 lib/litmus_paper/configuration.rb
litmus_paper-0.3.0 lib/litmus_paper/configuration.rb
litmus_paper-0.2.2 lib/litmus_paper/configuration.rb
litmus_paper-0.2.1 lib/litmus_paper/configuration.rb
litmus_paper-0.2.0 lib/litmus_paper/configuration.rb
litmus_paper-0.1.0 lib/litmus_paper/configuration.rb