lib/capistrano/tasks/stretcher.rake in capistrano-stretcher-0.2.0 vs lib/capistrano/tasks/stretcher.rake in capistrano-stretcher-0.3.0
- old
+ new
@@ -1,11 +1,17 @@
# -*- coding: utf-8; mode: ruby -*-
require 'erb'
require 'yaml'
+namespace :load do
+ task :defaults do
+ set :gzip_compress_level, "-9"
+ end
+end
+
namespace :stretcher do
- set :exclude_dirs, ['tmp']
+ set :exclude_dirs, ["tmp"]
def local_working_path_base
@_local_working_path_base ||= fetch(:local_working_path_base, "/var/tmp/#{fetch :application}")
end
@@ -65,24 +71,25 @@
set :current_revision, capture(:git, 'rev-parse', fetch(:branch)).chomp
execute :echo, fetch(:current_revision), "> #{local_checkout_path}/#{env.now}/REVISION"
execute :rsync, "-av", "--delete",
- *fetch(:exclude_dirs).map{|d| ['--exclude', d].join(' ')},
+ *fetch(:exclude_dirs, ["tmp"]).map{|d| ['--exclude', d].join(' ')},
"#{local_checkout_path}/#{env.now}/", "#{local_build_path}/",
"| pv -l -s $( find #{local_checkout_path}/#{env.now}/ -type f | wc -l ) >/dev/null"
end
end
end
task :create_tarball do
on application_builder_roles do
within local_build_path do
+ compress_level = fetch(:gzip_compress_level, "-9")
execute :mkdir, '-p', "#{local_tarball_path}/#{env.now}"
execute :tar, '-cf', '-',
"--exclude tmp", "--exclude spec", "./",
"| pv -s $( du -sb ./ | awk '{print $1}' )",
- "| gzip -9 > #{local_tarball_path}/#{env.now}/#{fetch(:local_tarball_name)}"
+ "| gzip #{compress_level} > #{local_tarball_path}/#{env.now}/#{fetch(:local_tarball_name)}"
end
within local_tarball_path do
execute :rm, '-f', 'current'
execute :ln, '-sf', env.now, 'current'
end