Don't crash the generator if api_names_out.yaml is absent (#746)
This commit is contained in:
parent
b1942bdc3e
commit
5f4abfdfec
|
@ -42,13 +42,13 @@ module Google
|
||||||
include NameHelpers
|
include NameHelpers
|
||||||
|
|
||||||
def initialize(names_out_file_path = nil, names_file_path = nil)
|
def initialize(names_out_file_path = nil, names_file_path = nil)
|
||||||
if names_out_file_path
|
if names_out_file_path && File.file?(names_out_file_path)
|
||||||
logger.info { sprintf('Loading API names from %s', names_out_file_path) }
|
logger.info { sprintf('Loading API names from %s', names_out_file_path) }
|
||||||
@names = YAML.load(File.read(names_out_file_path)) || {}
|
@names = YAML.load(File.read(names_out_file_path)) || {}
|
||||||
else
|
else
|
||||||
@names = {}
|
@names = {}
|
||||||
end
|
end
|
||||||
if names_file_path
|
if names_file_path && File.file?(names_file_path)
|
||||||
logger.info { sprintf('Loading API names from %s', names_file_path) }
|
logger.info { sprintf('Loading API names from %s', names_file_path) }
|
||||||
@names = @names.merge(YAML.load(File.read(names_file_path)) || {})
|
@names = @names.merge(YAML.load(File.read(names_file_path)) || {})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue