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