ServiceDefinition#name based on filename and not specs.
parent
bdeb23c275
commit
a3c32905ee
|
@ -47,10 +47,9 @@ class ServiceDefinition
|
|||
getter checks : Array(Checks)
|
||||
getter provides : Array(Provides)
|
||||
|
||||
def initialize(specs : SpecParser)
|
||||
def initialize(@name, specs : SpecParser)
|
||||
sections = specs.sections
|
||||
specs = specs.assignments
|
||||
@name = specs["name"].as_s
|
||||
@command = specs["command"].as_s
|
||||
@stop_command = specs["stop-command"]?.try &.as_s
|
||||
@directory = specs["directory"]?.try &.as_s
|
||||
|
@ -64,7 +63,10 @@ class ServiceDefinition
|
|||
def self.load(path)
|
||||
Dir.each_child path do |child|
|
||||
if child.match /\.spec$/
|
||||
@@all << ServiceDefinition.new SpecParser.parse(File.read "#{path}/#{child}").not_nil!
|
||||
name = File.basename(child, ".spec")
|
||||
specs = SpecParser.parse File.read "#{path}/#{child}"
|
||||
|
||||
@@all << ServiceDefinition.new name, specs
|
||||
else
|
||||
next
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue