Environment#name is obtained from filename and not specs.
This commit is contained in:
parent
479dffc6a0
commit
0fa6ec01c9
@ -26,10 +26,9 @@ class Environment
|
||||
directory: "/srv/${ENVIRONMENT}"
|
||||
end
|
||||
|
||||
def initialize(specs : SpecParser)
|
||||
def initialize(@name, specs : SpecParser)
|
||||
assignments = specs.assignments
|
||||
|
||||
@name = assignments["name"].as_s
|
||||
assignments["type"].try &.as_s.tap do |type|
|
||||
@type = Type.parse type
|
||||
end
|
||||
@ -53,7 +52,10 @@ class Environment
|
||||
file_path = "#{path}/#{child}"
|
||||
|
||||
begin
|
||||
environment = Environment.new SpecParser.parse(File.read file_path).not_nil!
|
||||
name = File.basename(child, ".spec")
|
||||
specs = SpecParser.parse File.read(file_path)
|
||||
|
||||
environment = Environment.new name, specs
|
||||
rescue e
|
||||
STDERR << "error loading #{file_path}: " << e << "\n"
|
||||
# FIXME: Print stacktrace? Debug mode?
|
||||
|
Loading…
Reference in New Issue
Block a user