class Stevenson::Template::Git
Attributes
options[R]
template_url[R]
Public Class Methods
new(template_url, options)
click to toggle source
# File lib/stevenson/templates/git.rb, line 8 def initialize(template_url, options) @template_url, @options = template_url, options end
Public Instance Methods
close()
click to toggle source
Calls superclass method
# File lib/stevenson/templates/git.rb, line 29 def close FileUtils.rm_rf template_path if template_path super end
local_directory()
click to toggle source
Calls superclass method
# File lib/stevenson/templates/git.rb, line 12 def local_directory @_local_directory ||= begin @template_path ||= Dir.mktmpdir.tap do |dir| # Clone the repo to a temporary directory for later use ::Git.clone(template_url, dir).tap do |repo| # Switch_branch if set repo.checkout(options[:branch]) if options.has_key?(:branch) end end super end rescue ::Git::GitExecuteError # If the given repo URL is not valid, raise an exception raise InvalidTemplateException.new('Failed to clone the repository and/or branch') end