Class: ProcfileUpstartExporter::EnvironmentParser

Inherits:
Object
  • Object
show all
Defined in:
lib/procfile_upstart_exporter/environment_parser.rb

Instance Method Summary collapse

Instance Method Details

#parse(environment) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/procfile_upstart_exporter/environment_parser.rb', line 2

def parse environment
  ProcfileUpstartExporter.logger.debug "Start parsing environment file " \
                                       "`#{ environment }'"
  if File.exists? environment
    File.read(environment).split("\n").reject { |line|
      line =~ /\A\s*(?:#.*)?\z/
    }
  else
    ProcfileUpstartExporter.logger.warn "Environment file " \
                                        "`#{ environment }' does not exist"
    []
  end
end