Created
July 22, 2009 21:07
-
-
Save gumayunov/152273 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set :git_reuse_repo, true | |
| class Vlad::Git | |
| def checkout(revision, destination) | |
| destination = File.join(destination, 'repo') | |
| revision = 'HEAD' if revision =~ /head/i | |
| cached_upate = [ | |
| "cd #{destination}", | |
| "#{git_cmd} fetch origin", | |
| "#{git_cmd} reset --hard origin/#{revision}" | |
| ].join " && " | |
| clone = [ | |
| "#{git_cmd} clone #{repository} #{destination}", | |
| "cd #{destination}", | |
| "#{git_cmd} checkout -f -b deployed-#{revision} #{revision}" | |
| ].join " && " | |
| update = if defined?(git_reuse_repo) && git_reuse_repo | |
| "if [ -e #{destination} ]; then #{cached_upate}; else #{clone}; fi" | |
| else | |
| "rm -rf #{destination} && #{clone}" | |
| end | |
| "sh -c \"#{update}\"" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 20:41 gva@dell:~/work/bookfeed autocomments >rake vlad:deploy --trace | |
| (in /home/gva/work/bookfeed) | |
| ./config/deploy.rb:18: warning: method redefined; discarding old checkout | |
| ** Invoke vlad:deploy (first_time) | |
| ** Invoke vlad:update (first_time) | |
| ** Execute vlad:update | |
| ssh bfeed.ru 'cd /home/gva/bookfeed_alpha/scm && sh -c "if [ -e /home/gva/bookfeed_alpha/scm/repo ]; then cd /home/gva/bookfeed_alpha/scm/repo && git fetch origin && git reset --hard origin/HEAD; else git clone git@github.com:gumayunov/bookfeed.git /home/gva/bookfeed_alpha/scm/repo && cd /home/gva/bookfeed_alpha/scm/repo && git checkout -f -b deployed-HEAD HEAD; fi" && mkdir -p /home/gva/bookfeed_alpha/releases/20090722211501 && cd repo && git archive --format=tar deployed-HEAD | (cd /home/gva/bookfeed_alpha/releases/20090722211501 && tar xf -) && cd - && cd .. && chmod -R g+w /home/gva/bookfeed_alpha/releases/20090722211501 && rm -rf /home/gva/bookfeed_alpha/releases/20090722211501/log /home/gva/bookfeed_alpha/releases/20090722211501/public/system /home/gva/bookfeed_alpha/releases/20090722211501/tmp/pids && mkdir -p /home/gva/bookfeed_alpha/releases/20090722211501/db /home/gva/bookfeed_alpha/releases/20090722211501/tmp' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment