Class: Servitor::ServiceFileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/service/service_file_parser.rb

Class Method Summary collapse

Class Method Details

.parse(file, service_root) ⇒ Object

Parses the given service file, returning a service config



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/service/service_file_parser.rb', line 6

def self.parse(file, service_root)
  begin
  file_content = File.read(file)
  ServiceDefinition.new(file, service_root).tap do |sc|
    sc.instance_exec do
      eval(file_content)
    end
  end
  rescue StandardError => e
    raise e, "Error parsing #{file}: #{e.message}", e.backtrace
  end
end