Class: Eye::Dsl

Inherits:
Object show all
Defined in:
lib/eye/dsl.rb

Defined Under Namespace

Modules: Chain, Main, Validation Classes: ApplicationOpts, ChildProcessOpts, ConfigOpts, Error, GroupOpts, Opts, ProcessOpts, PureOpts

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.verboseObject

Returns the value of attribute verbose.



21
22
23
# File 'lib/eye/dsl.rb', line 21

def verbose
  @verbose
end

Class Method Details

.check_name(name) ⇒ Object

Raises:



46
47
48
# File 'lib/eye/dsl.rb', line 46

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

.debug(msg = '') ⇒ Object



23
24
25
# File 'lib/eye/dsl.rb', line 23

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

.parse(content = nil, filename = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/eye/dsl.rb', line 27

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

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

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

  Eye.parsed_config.validate!(false)
  Eye.parsed_config
end

.parse_apps(*args) ⇒ Object



42
43
44
# File 'lib/eye/dsl.rb', line 42

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