class Capistrano::GitArchive::SCM
SCM
plugin for capistrano uses a local clone and uploads a tar archive to the server
Public Instance Methods
archive_repository(&block)
click to toggle source
# File lib/capistrano/git_archive/scm.rb, line 24 def archive_repository(&block) block.call ensure temp_file.close temp_file.unlink end
define_tasks()
click to toggle source
define plugin tasks
# File lib/capistrano/git_archive/scm.rb, line 14 def define_tasks eval_rakefile File.expand_path('../tasks/git_archive.rake', __FILE__) end
git_archive_to_temp_file()
click to toggle source
# File lib/capistrano/git_archive/scm.rb, line 31 def git_archive_to_temp_file `git archive --remote=#{fetch(:repo_url)} --output=#{temp_file.path} #{fetch(:branch, 'master')}` end
register_hooks()
click to toggle source
register capistrano hooks
# File lib/capistrano/git_archive/scm.rb, line 19 def register_hooks after 'deploy:new_release_path', 'git_archive:create_release' before 'deploy:set_current_revision', 'git_archive:set_current_revision' end
release()
click to toggle source
Upload and extract release
@return void
# File lib/capistrano/git_archive/scm.rb, line 39 def release remote_archive_path = File.join(fetch(:deploy_to), File.basename(temp_file.path)) backend.execute :mkdir, '-p', release_path backend.upload!(temp_file.path, remote_archive_path) backend.execute(:tar, '-f', remote_archive_path, '-x', '-C', release_path) backend.execute(:rm, '-f', remote_archive_path) end
set_defaults()
click to toggle source
set default values
# File lib/capistrano/git_archive/scm.rb, line 10 def set_defaults end
temp_file()
click to toggle source
# File lib/capistrano/git_archive/scm.rb, line 48 def temp_file @temp_file ||= Tempfile.new([fetch(:application), '.tar.gz']) end