Skip to content

Commit

Permalink
Additional fixes for metadata during convert
Browse files Browse the repository at this point in the history
  • Loading branch information
Helen Campbell committed Dec 8, 2017
1 parent 4fa7f50 commit d056194
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pdk/generate/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def self.module_interview(metadata, opts = {})
puts

continue = PDK::CLI::Util.prompt_for_yes(
_('About to generate this module, continue?'),
_('Metadata will be generated based on this information, continue?'),
prompt: prompt,
cancel_message: _('Interview cancelled; exiting.'),
)
Expand Down
6 changes: 5 additions & 1 deletion lib/pdk/module/convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def self.invoke(options)
template_url = options.fetch(:'template-url', PDK::Util.default_template_url)

PDK::Module::TemplateDir.new(template_url, nil, false) do |templates|
update_manager.modify_file('metadata.json', update_metadata('metadata.json', templates.metadata))
if File.file?('metadata.json')
update_manager.modify_file('metadata.json', update_metadata('metadata.json', templates.metadata))
else
update_manager.add_file('metadata.json', update_metadata('metadata.json', templates.metadata))
end

templates.render do |file_path, file_content|
if File.exist? file_path
Expand Down

0 comments on commit d056194

Please sign in to comment.