lib/terraspace_bundler/mod/fetcher/git.rb in terraspace-bundler-0.4.4 vs lib/terraspace_bundler/mod/fetcher/git.rb in terraspace-bundler-0.5.0
- old
+ new
@@ -2,15 +2,15 @@
class Git < Base
extend Memoist
def run
setup_tmp
- org_path = cache_path(@mod.org)
- FileUtils.mkdir_p(org_path)
+ org_folder = cache_path(@mod.org_folder)
+ FileUtils.mkdir_p(org_folder)
- Dir.chdir(org_path) do
- logger.debug "Current root dir: #{org_path}"
+ Dir.chdir(org_folder) do
+ logger.debug "Current root dir: #{org_folder}"
clone unless File.exist?(@mod.repo)
Dir.chdir(@mod.repo) do
logger.debug "Change dir: #{@mod.repo}"
git "pull"
@@ -43,15 +43,16 @@
origin = `git remote show origin`.strip
found = origin.split("\n").find { |l| l.include?("HEAD") }
if found
found.split(':').last.strip
else
- 'master'
+ ENV['TS_GIT_DEFAULT_BRANCH'] || 'master'
end
end
def switch_version(version)
stage_path = stage_path(rel_dest_dir)
+ logger.debug "stage_path #{stage_path}"
Dir.chdir(stage_path) do
git "checkout #{version}"
@sha = git("rev-parse HEAD").strip
end
end