Skip to content

Commit

Permalink
(PDK-789) Add template metadata even if template-url is a file path
Browse files Browse the repository at this point in the history
  • Loading branch information
bmjen committed Feb 15, 2018
1 parent cae1b63 commit 7e46f82
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/pdk/module/templatedir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,16 @@ def initialize(path_or_url, module_metadata = {}, init = false)
#
# @api public
def metadata
return {} unless @repo
result = {
'pdk-version' => PDK::Util::Version.version_string,
}

result['template-url'] = @repo ? @repo : @path

ref_result = PDK::Util::Git.git('--git-dir', File.join(@path, '.git'), 'describe', '--all', '--long', '--always')
if ref_result[:exit_code].zero?
{
'pdk-version' => PDK::Util::Version.version_string,
'template-url' => @repo,
'template-ref' => ref_result[:stdout].strip,
}
else
{}
end
result['template-ref'] = ref_result[:stdout].strip if ref_result[:exit_code].zero?

result
end

# Loop through the files in the template, yielding each rendered file to
Expand Down

0 comments on commit 7e46f82

Please sign in to comment.