lib/pdk/template/fetcher/git.rb in pdk-2.7.1 vs lib/pdk/template/fetcher/git.rb in pdk-3.0.0
- old
+ new
@@ -12,21 +12,20 @@
end
# @see PDK::Template::Fetcher::AbstractTemplateFetcher.fetch!
def fetch!
return if fetched
+
super
# Default metadata for all git fetching methods
@metadata['template-url'] = uri.metadata_format
# We don't do a checkout of local-path repos. There are lots of edge
# cases or user un-expectations.
if PDK::Util::Git.work_tree?(uri.shell_path)
- PDK.logger.warn "Repository '%{repo}' has a work-tree; skipping git reset." % {
- repo: uri.shell_path,
- }
+ PDK.logger.warn format("Repository '%{repo}' has a work-tree; skipping git reset.", repo: uri.shell_path)
@path = uri.shell_path
@temporary = false
@metadata['template-ref'] = describe_path_and_ref(@path)
return
end
@@ -47,11 +46,11 @@
# Clone the repository
clone_result = PDK::Util::Git.git('clone', origin_repo, temp_dir)
unless clone_result[:exit_code].zero?
PDK.logger.error clone_result[:stdout]
PDK.logger.error clone_result[:stderr]
- raise PDK::CLI::FatalError, "Unable to clone git repository at '%{repo}' into '%{dest}'." % { repo: origin_repo, dest: temp_dir }
+ raise PDK::CLI::FatalError, format("Unable to clone git repository at '%{repo}' into '%{dest}'.", repo: origin_repo, dest: temp_dir)
end
@path = PDK::Util.canonical_path(temp_dir)
# Checkout the git reference
if PDK::Util::Git.work_dir_clean?(temp_dir)
@@ -61,25 +60,25 @@
reset_result = PDK::Util::Git.git('reset', '--hard', full_ref)
return if reset_result[:exit_code].zero?
PDK.logger.error reset_result[:stdout]
PDK.logger.error reset_result[:stderr]
- raise PDK::CLI::FatalError, "Unable to checkout '%{ref}' of git repository at '%{path}'." % { ref: git_ref, path: temp_dir }
+ raise PDK::CLI::FatalError, format("Unable to checkout '%{ref}' of git repository at '%{path}'.", ref: git_ref, path: temp_dir)
end
else
- PDK.logger.warn "Uncommitted changes found when attempting to checkout '%{ref}' of git repository at '%{path}'; skipping git reset." % { ref: git_ref, path: temp_dir }
+ PDK.logger.warn format("Uncommitted changes found when attempting to checkout '%{ref}' of git repository at '%{path}'; skipping git reset.", ref: git_ref, path: temp_dir)
@metadata['template-ref'] = describe_path_and_ref(temp_dir)
end
end
private
- #:nocov: This is a just a wrapper for another method
+ # :nocov: This is a just a wrapper for another method
def describe_path_and_ref(path, ref = nil)
require 'pdk/util/git'
PDK::Util::Git.describe(File.join(path, '.git'), ref)
end
- #:nocov:
+ # :nocov:
end
end
end
end