Does not raise on missing directories.
parent
794ffe16fa
commit
365e780055
|
@ -38,6 +38,8 @@ class Environment
|
||||||
class_getter all = [@@root] of Environment
|
class_getter all = [@@root] of Environment
|
||||||
|
|
||||||
def self.load(path)
|
def self.load(path)
|
||||||
|
return unless Dir.exists? path
|
||||||
|
|
||||||
Dir.each_child path do |child|
|
Dir.each_child path do |child|
|
||||||
unless child.match /\.spec$/
|
unless child.match /\.spec$/
|
||||||
next
|
next
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
require "yaml"
|
require "yaml"
|
||||||
require "colorize"
|
require "colorize"
|
||||||
|
require "file_utils"
|
||||||
|
|
||||||
require "./service_definition.cr"
|
require "./service_definition.cr"
|
||||||
require "./environment.cr"
|
require "./environment.cr"
|
||||||
|
@ -296,6 +297,8 @@ class Service
|
||||||
|
|
||||||
class_getter all = [] of Service
|
class_getter all = [] of Service
|
||||||
def self.load(path)
|
def self.load(path)
|
||||||
|
return unless Dir.exists? path
|
||||||
|
|
||||||
Dir.each_child path do |child|
|
Dir.each_child path do |child|
|
||||||
unless child.match /\.spec$/
|
unless child.match /\.spec$/
|
||||||
next
|
next
|
||||||
|
@ -312,6 +315,7 @@ class Service
|
||||||
end
|
end
|
||||||
|
|
||||||
def write(path)
|
def write(path)
|
||||||
|
FileUtils.mkdir_p "#{path}"
|
||||||
File.write "#{path}/#{name}.#{@environment.name}.spec", to_spec
|
File.write "#{path}/#{name}.#{@environment.name}.spec", to_spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue