Clone template from full repository urls

remove_hooks
Alessandro Tagliapietra 2015-02-12 15:40:54 +01:00
parent 986b9fcf51
commit 640c87c13a
1 changed files with 8 additions and 3 deletions

View File

@ -53,6 +53,11 @@ module Middleman::Cli
run("git clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
unless File.directory?(dir)
say 'Git clone failed, maybe the url is invalid or you don\'t have the permissions?', :red
exit
end
inside(target) do
thorfile = File.join(dir, 'Thorfile')
@ -68,18 +73,18 @@ module Middleman::Cli
run('bundle install') unless ENV['TEST'] || options[:'skip-bundle']
end
ensure
FileUtils.remove_entry(dir)
FileUtils.remove_entry(dir) if File.directory?(dir)
end
end
protected
def shortname?(repo)
repo.split('/').length != 2
repo.split('/').length == 1
end
def repository_path(repo)
"git://github.com/#{repo}.git"
repo.include?('://') ? repo : "git://github.com/#{repo}.git"
end
# Add to CLI