lib/shuttle/strategy.rb in shuttle-deploy-0.2.0.beta9 vs lib/shuttle/strategy.rb in shuttle-deploy-0.2.0.beta10

- old
+ new

@@ -92,10 +92,15 @@ branch = config.app.branch || 'master' ssh.run("cd #{scm_path} && git fetch") + # Make sure to pull changes from current non-master branch + if branch != 'master' + ssh.run("cd #{scm_path} && git pull origin #{branch}") + end + log "Using branch '#{branch}'" result = ssh.run("cd #{scm_path} && git checkout -m #{branch}") if result.failure? error "Failed to checkout #{branch}: #{result.output}" @@ -141,18 +146,24 @@ end end end def checkout_code(path=nil) + # Trigger hook before checking out code + execute_hook(:before_checkout_code) + checkout_path = [release_path, path].compact.join('/') res = ssh.run("cp -a #{scm_path} #{checkout_path}") if res.failure? error "Failed to checkout code. Reason: #{res.output}" else ssh.run("cd #{release_path} && rm -rf $(find . | grep .git)") ssh.run("cd #{release_path} && rm -rf $(find . -name .svn)") end + + # Trigger hook after checking out code + execute_hook(:after_checkout_code) end def link_release if !release_exists? error "Release does not exist" \ No newline at end of file