Sha256: 6d508e7cd1a56f14b5e87a783965d0fd0dd0386735253d3608888d293af1d1aa

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require_relative 'dsl/helpers'

Eye::BINDING = binding

class Eye::Dsl

  autoload :Main,                 'eye/dsl/main'
  autoload :ApplicationOpts,      'eye/dsl/application_opts'
  autoload :GroupOpts,            'eye/dsl/group_opts'
  autoload :ProcessOpts,          'eye/dsl/process_opts'
  autoload :ChildProcessOpts,     'eye/dsl/child_process_opts'
  autoload :Opts,                 'eye/dsl/opts'
  autoload :PureOpts,             'eye/dsl/pure_opts'
  autoload :Chain,                'eye/dsl/chain'
  autoload :ConfigOpts,           'eye/dsl/config_opts'
  autoload :Validation,           'eye/dsl/validation'

  class Error < Exception; end

  class << self
    attr_accessor :verbose

    def debug(msg = '')
      puts msg if verbose
    end

    def parse(content = nil, filename = nil)
      Eye.parsed_config = Eye::Config.new
      Eye.parsed_filename = filename

      content = File.read(filename) if content.blank?

      silence_warnings do
        Kernel.eval(content, Eye::BINDING, filename.to_s)
      end

      Eye.parsed_config.validate!
      Eye.parsed_config
    end

    def parse_apps(*args)
      parse(*args).applications
    end

    def check_name(name)
      raise Error, "':' is not allowed in name '#{name}'" if name.to_s.include?(':')
    end
  end
end

# extend here global module
Eye.send(:extend, Eye::Dsl::Main)

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
reel-eye-0.5.2.1 lib/eye/dsl.rb
reel-eye-0.5.2 lib/eye/dsl.rb
eye-0.5.2 lib/eye/dsl.rb