Skip to content

Commit

Permalink
(PDK-430) Do not cache template-url answer if using the default template
Browse files Browse the repository at this point in the history
  • Loading branch information
rodjek committed Aug 22, 2017
1 parent d02f959 commit cc32bfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pdk/generators/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.invoke(opts = {})
end
end

PDK.answers.update!('template-url' => template_url)
PDK.answers.update!('template-url' => template_url) unless template_url == default_template_url

begin
FileUtils.mv(temp_target_dir, target_dir)
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/pdk/generate/module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@

it 'uses the vendored template url' do
expect(PDK::Module::TemplateDir).to receive(:new).with('file:///tmp/package/cache/pdk-module-template.git', anything).and_yield(test_template_dir)
expect(PDK.answers).not_to receive(:update!).with(:'template-url' => anything)

described_class.invoke(invoke_opts)
end
Expand All @@ -199,6 +200,7 @@
context 'and pdk is not installed from packages' do
it 'uses the default template to generate the module' do
expect(PDK::Module::TemplateDir).to receive(:new).with(described_class.default_template_url, anything).and_yield(test_template_dir)
expect(PDK.answers).not_to receive(:update!).with(:'template-url' => anything)

described_class.invoke(invoke_opts)
end
Expand Down

0 comments on commit cc32bfd

Please sign in to comment.