lib/demonz/base.rb in capistrano-demonz-0.0.5 vs lib/demonz/base.rb in capistrano-demonz-0.0.6
- old
+ new
@@ -12,14 +12,10 @@
Capistrano::Configuration.instance(:must_exist) :
Capistrano.configuration(:must_exist)
configuration.load do
- # Set default stages
- set :stages, %w(staging production)
- set :default_stage, "staging"
-
# Set shared path to be inside app directory
set :shared_path, File.join(deploy_to, 'shared')
# --------------------------------------------
# Task chains
@@ -38,11 +34,10 @@
# --------------------------------------------
# Default variables
# --------------------------------------------
# SSH
set :user, proc{text_prompt("SSH username: ")}
- set :group, :user
set :password, proc{Capistrano::CLI.password_prompt("SSH password for '#{user}':")}
# Database
# set :dbuser, proc{text_prompt("Database username: ")}
# set :dbpass, proc{Capistrano::CLI.password_prompt("Database password for '#{dbuser}':")}
@@ -59,11 +54,11 @@
set :scm_password, proc{Capistrano::CLI.password_prompt("Git password for '#{scm_username}': ")}
set :deploy_via, :remote_cache
set :copy_strategy, :checkout
set :copy_compression, :bz2
set :copy_exclude, [".svn", ".DS_Store", "*.sample", "LICENSE*", "Capfile",
- "RELEASE*", "*.rb", "*.sql", "nbproject", "_template", "*.sublime*"]
+ "RELEASE*", "*.sql", "nbproject", "_template", "*.sublime*"]
# Backups Path
_cset(:backups_path) { File.join(deploy_to, "backups") }
_cset(:tmp_backups_path) { File.join("#{backups_path}", "tmp") }
_cset(:backups) { capture("ls -x #{backups_path}", :except => { :no_release => true }).split.sort }
@@ -77,14 +72,12 @@
default_run_options[:pty] = true
# Release tracking
set :release_file, File.join(shared_path, "RELEASES")
- # SASS compilation support (via compass)
- set :uses_sass, false
-
# Add a dependency on compass and :themes if required
+ uses_sass = fetch(:uses_sass, false)
if uses_sass
depend :remote, :gem, "compass", ">=0.12"
_cset(:themes) { abort "Please specify themes on this site, set :themes, ['theme1', 'theme2']" }
end
@@ -118,11 +111,11 @@
run "#{try_sudo} chown -R #{user}:#{group} #{deploy_to}"
end
desc "Setup backup directory for database and web files"
task :setup_backup, :except => { :no_release => true } do
- run "#{try_sudo} mkdir -p #{backups_path} #{tmp_backups_path} && #{try_sudo} chmod 775 #{backups_path} && #{try_sudo} chmod 775 #{tmp_backups_path}"
+ run "#{try_sudo} mkdir -p #{backups_path} #{tmp_backups_path} && #{try_sudo} chmod 775 #{backups_path} && #{try_sudo} chmod 775 #{tmp_backups_path} && #{try_sudo} chown -R #{user}:#{group} #{backups_path}"
end
desc <<-DESC
Clean up old releases. By default, the last 5 releases are kept on each \
server (though you can change this with the keep_releases variable). All \
@@ -250,11 +243,11 @@
# Slashes are bad in directory names
clean_tag = tag.gsub("/", "-")
# Try to add tag to git
- if ! system "git tag #{release_name}"
- raise Capistrano::Error, "Failed to Git tag: #{release_name}"
+ if ! system "git tag #{clean_tag}"
+ raise Capistrano::Error, "Failed to Git tag: #{clean_tag}"
end
end
# If the release directory already exists, append timestamp
if remote_file_exists?(File.join(releases_path, clean_tag, 'REVISION'))