Created
July 28, 2010 14:48
-
-
Save jkraemer/494755 to your computer and use it in GitHub Desktop.
This file contains 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
lib/cap-git-archive.rb: | |
------------------------------------------------- | |
require 'capistrano/recipes/deploy/scm/git' | |
Capistrano::Deploy::SCM::Git.class_eval do | |
def export(revision, destination) | |
git = command | |
execute = [] | |
args = [] | |
args << '--format=tar' | |
args << "--remote=#{configuration[:repository]}" | |
if app_root = configuration[:app_root] | |
args << "#{revision}:#{app_root}" | |
else | |
args << revision | |
end | |
# export (using git archive) | |
execute << "mkdir -p #{destination}" | |
execute << "cd #{destination}" | |
execute << "#{git} archive #{args.join(' ')} | tar xf -" | |
execute.join(" && ") | |
end | |
end | |
------------------------------------------------- | |
config/deploy.rb: | |
------------------------------------------------- | |
load 'lib/cap-git-archive.rb' | |
set :scm, :git | |
set :deploy_via, :copy | |
set :copy_strategy, :export # obige export-methode verwenden (per default macht er 'nen checkout) | |
set :app_root, 'serviceportal' # das ist der Pfad innerhalb des repositories, der exportiert werden soll | |
------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment