Skip to content

Commit

Permalink
fix merge conflicts with gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohnson-xx committed Aug 23, 2012
2 parents a6e63cb + e421b67 commit 6bc2107
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 103 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.19
1.2.0
6 changes: 3 additions & 3 deletions capistrano-ash.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

Gem::Specification.new do |s|
s.name = "capistrano-ash"
s.version = "1.1.19"

s.version = "1.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["August Ash"]
s.date = "2012-08-09"
s.date = "2012-08-23"
s.description = "August Ash recipes for Capistrano"
s.email = "code@augustash.com"
s.extra_rdoc_files = [
Expand All @@ -35,6 +34,7 @@ Gem::Specification.new do |s|
s.homepage = "https://github.com/augustash/capistrano-ash"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.23"
s.require "capistrano >= 2.11.2"
s.summary = "Useful task libraries for August Ash recipes for Capistrano"

if s.respond_to? :specification_version then
Expand Down
9 changes: 8 additions & 1 deletion lib/ash/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,15 @@
run "#{try_sudo} mkdir -p #{backups_path} #{tmp_backups_path} && #{try_sudo} chmod 755 #{backups_path}"
end

desc <<-DESC
Deprecated API. This has become deploy:create_symlink, please update your recipes
DESC
task :symlink, :except => { :no_release => true } do
logger.important "[Deprecation Warning] This API has changed, please hook `deploy:create_symlink` instead of `deploy:symlink`."
create_symlink
end

desc <<-DESC
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 \
other deployed revisions are removed from the servers. By default, this \
Expand Down
65 changes: 35 additions & 30 deletions lib/ash/drupal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
proc{_cset( :multisites, {"#{application}" => "#{application}"} )}
set :drush_bin, "drush"
_cset :dump_options, "" # blank options b/c of MYISAM engine (unless anyone knows options that should be included)


# --------------------------------------------
# Ubercart Files/Folders
# assumes ubercart files are located
# within a files/ubercart directory
# within a files/ubercart directory
# for each multisite
# --------------------------------------------
set :uc_root, "ubercart"
Expand All @@ -31,9 +31,14 @@
# --------------------------------------------
after "deploy:setup", "deploy:setup_local"
after "deploy:finalize_update", "ash:fixperms"
after "deploy:symlink", "drupal:symlink"
# after "deploy:create_symlink", "drupal:symlink"

# workaround for issues with capistrano v2.13.3 and
# before/after callbacks not firing for 'deploy:symlink'
# or 'deploy:create_symlink'
after "deploy", "drupal:symlink"
after "drupal:symlink","drupal:protect"
after "deploy", "drupal:clearcache"
after "drupal:symlink", "drupal:clearcache"
after "deploy", "deploy:cleanup"

# --------------------------------------------
Expand All @@ -45,7 +50,7 @@
# attempt to create files needed for proper deployment
system("cp .htaccess htaccess.dist")
end

desc "Setup shared application directories and permissions after initial setup"
task :setup_shared do
# remove Capistrano specific directories
Expand All @@ -66,7 +71,7 @@
task :finalize_update, :roles => :web, :except => { :no_release => true } do
# remove shared directories
multisites.each_pair do |folder, url|
if folder != url
if folder != url
run "mv #{latest_release}/sites/#{folder} #{latest_release}/sites/#{url}"
end
run "rm -Rf #{latest_release}/sites/#{url}/files"
Expand All @@ -89,26 +94,26 @@
end
end
end

# --------------------------------------------
# Remote/Local database migration tasks
# --------------------------------------------
namespace :db do
task :local_export do
mysqldump = fetch(:mysqldump, "mysqldump")
dump_options = fetch(:dump_options, "")

system "#{mysqldump} #{dump_options} --opt -h#{db_local_host} -u#{db_local_user} -p#{db_local_pass} #{db_local_name} | gzip -c --best > #{db_local_name}.sql.gz"
end

desc "Create a compressed MySQL dumpfile of the remote database"
task :remote_export, :roles => :db do
mysqldump = fetch(:mysqldump, "mysqldump")
dump_options = fetch(:dump_options, "")

run "#{mysqldump} #{dump_options} --opt -h#{db_remote_host} -u#{db_remote_user} -p#{db_remote_pass} #{db_remote_name} | gzip -c --best > #{deploy_to}/#{db_remote_name}.sql.gz"
end

end

namespace :backup do
Expand Down Expand Up @@ -137,23 +142,23 @@
multisites.each_pair do |folder, url|
# symlinks the appropriate environment's settings.php file
symlink_config_file

run "ln -nfs #{shared_path}/#{url}/files #{latest_release}/sites/#{url}/files"
run "#{drush_bin} -l #{url} -r #{current_path} vset --yes file_directory_path sites/#{url}/files"
end
end

desc <<-DESC
Symlinks the appropriate environment's settings file within the proper sites directory
Assumes the environment's settings file will be in one of two formats:
settings.<environment>.php => new default
settings.php.<environment> => deprecated
DESC
task :symlink_config_file, :roles => :web, :except => { :no_release => true} do
multisites.each_pair do |folder, url|
drupal_app_site_dir = " #{latest_release}/sites/#{url}"

case true
when remote_file_exists?("#{drupal_app_site_dir}/settings.#{stage}.php")
run "ln -nfs #{drupal_app_site_dir}/settings.#{stage}.php #{drupal_app_site_dir}/settings.php"
Expand All @@ -178,7 +183,7 @@
run "#{drush_bin} -l #{url} -r #{current_path} cache-clear all"
end
end

desc "Protect system files"
task :protect, :roles => :web, :except => { :no_release => true } do
multisites.each_pair do |folder, url|
Expand All @@ -196,7 +201,7 @@
# setup necessary directories within our shared directory
setup_ubercart_shared

# move the sites/*/files/downloadable_products
# move the sites/*/files/downloadable_products
# to the shared directory via rsync
secure_downloadable_files

Expand All @@ -219,15 +224,15 @@
end

desc <<-DESC
Moves downloadable files from the public directory (Drupal root) to the shared
Moves downloadable files from the public directory (Drupal root) to the shared
directories
Example:
sites/abc/files/ubercart/products
sites/xyz/files/ubercart/downloadable_products
sites/abc/files/ubercart/products
sites/xyz/files/ubercart/downloadable_products
are moved to:
shared/abc/ubercart/products
shared/abc/ubercart/products
shared/xyz/ubercart/downloadable_products
DESC
task :secure_downloadable_files, :except => { :no_release => true } do
Expand All @@ -245,32 +250,32 @@
end


# update the ubercart's database tracking of where the
# root file path is for downloadable products. This should
# update the ubercart's database tracking of where the
# root file path is for downloadable products. This should
# be set as relative to the root of the drupal directory
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_file_base_dir ../../shared/#{url}/#{uc_root}/#{uc_downloadable_products_root}"
end
end

desc <<-DESC
Moves encryption key files from the public directory (Drupal root) to the shared
Moves encryption key files from the public directory (Drupal root) to the shared
directories
Example:
sites/abc/files/ubercart/keys
sites/xyz/files/ubercart/keys
sites/abc/files/ubercart/keys
sites/xyz/files/ubercart/keys
are moved to:
shared/abc/ubercart/keys
shared/abc/ubercart/keys
shared/xyz/ubercart/keys
DESC
task :secure_encryption_key, :roles => :web, :except => { :no_release => true } do
# loop through the multisites and move keys
multisites.each_pair do |folder, url|
run "mkdir -p #{shared_path}/#{url}/#{uc_root}/#{uc_encryption_keys_root}"

# update the ubercart's database tracking of where the
# root file path is for encryption keys. This should
# update the ubercart's database tracking of where the
# root file path is for encryption keys. This should
# be set as relative to the root of the drupal directory
run "#{drush_bin} -l #{url} -r #{latest_release} vset --yes uc_credit_encryption_path ../../shared/#{url}/#{uc_root}/#{uc_encryption_keys_root}"
end
Expand Down
11 changes: 8 additions & 3 deletions lib/ash/magento.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
after "deploy:setup", "deploy:setup_local"
# after "deploy:setup_shared", "pma:install"
after "deploy:finalize_update", "magento:activate_config"
after "deploy:symlink", "magento:symlink"
after "deploy", "magento:purge_cache"
# after "deploy:create_symlink", "magento:symlink"

# workaround for issues with capistrano v2.13.3 and
# before/after callbacks not firing for 'deploy:symlink'
# or 'deploy:create_symlink'
after "deploy", "magento:symlink"
after "magento:symlink", "magento:purge_cache"

# --------------------------------------------
# Overloaded tasks
Expand Down Expand Up @@ -123,7 +128,7 @@
end
end
end

# --------------------------------------------
# Override the base.rb backup tasks
# --------------------------------------------
Expand Down
122 changes: 64 additions & 58 deletions lib/ash/wordpress.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,76 @@
Capistrano.configuration(:must_exist)

configuration.load do

# --------------------------------------------
# Setting defaults
# --------------------------------------------
set :uploads_path, "wp-content/uploads"

# --------------------------------------------
# Calling our Methods
# --------------------------------------------
after "deploy:setup", "deploy:setup_shared"
after "deploy:symlink", "wordpress:symlink"
after "ash:fixperms", "wordpress:protect"
# --------------------------------------------
# Setting defaults
# --------------------------------------------
set :uploads_path, "wp-content/uploads"

# --------------------------------------------
# Overloaded Methods
# --------------------------------------------
namespace :deploy do
desc "Setup shared application directories and permissions after initial setup"
task :setup_shared, :roles => :web do
# remove Capistrano specific directories
run "rm -Rf #{shared_path}/log"
run "rm -Rf #{shared_path}/pids"
run "rm -Rf #{shared_path}/system"

# create shared directories
run "mkdir -p #{shared_path}/uploads"
run "mkdir -p #{shared_path}/cache"
# --------------------------------------------
# Calling our Methods
# --------------------------------------------
after "deploy:setup", "deploy:setup_shared"
# after "deploy:create_symlink", "wordpress:symlink"

# set correct permissions
run "chmod -R 777 #{shared_path}/*"
end
# workaround for issues with capistrano v2.13.3 and
# before/after callbacks not firing for 'deploy:symlink'
# or 'deploy:create_symlink'
after "deploy", "wordpress:symlink"
after "wordpress:symlink", "ash:fixperms"
after "ash:fixperms", "wordpress:protect"

desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
task :finalize_update, :roles => :web, :except => { :no_release => true } do
# remove shared directories
run "rm -Rf #{latest_release}/#{uploads_path}"
run "rm -Rf #{latest_release}/wp-content/cache"

# Removing cruft files.
run "rm -Rf #{latest_release}/license.txt"
run "rm -Rf #{latest_release}/readme.html"
end
end
# --------------------------------------------
# Overloaded Methods
# --------------------------------------------
namespace :deploy do
desc "Setup shared application directories and permissions after initial setup"
task :setup_shared, :roles => :web do
# remove Capistrano specific directories
run "rm -Rf #{shared_path}/log"
run "rm -Rf #{shared_path}/pids"
run "rm -Rf #{shared_path}/system"

# --------------------------------------------
# Wordpress-specific methods
# --------------------------------------------
namespace :wordpress do
desc "Links the correct settings file"
task :symlink, :roles => :web, :except => { :no_release => true } do
run "ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path}"
run "ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache"
run "ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php"
end

desc "Set URL in database"
task :updatedb, :roles => :db, :except => { :no_release => true } do
run "mysql -u #{dbuser} -p #{dbpass} #{dbname} -e 'UPDATE #{dbprefix}options SET option_value = \"#{application}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
# create shared directories
run "mkdir -p #{shared_path}/uploads"
run "mkdir -p #{shared_path}/cache"

# set correct permissions
run "chmod -R 777 #{shared_path}/*"
end

desc "[internal] Touches up the released code. This is called by update_code after the basic deploy finishes."
task :finalize_update, :roles => :web, :except => { :no_release => true } do
# remove shared directories
run "rm -Rf #{latest_release}/#{uploads_path}"
run "rm -Rf #{latest_release}/wp-content/cache"

# Removing cruft files.
run "rm -Rf #{latest_release}/license.txt"
run "rm -Rf #{latest_release}/readme.html"
end
end

desc "Protect system files"
task :protect, :except => { :no_release => true } do
run "chmod 440 #{latest_release}/wp-config.php*"

# --------------------------------------------
# Wordpress-specific methods
# --------------------------------------------
namespace :wordpress do
desc "Links the correct settings file"
task :symlink, :roles => :web, :except => { :no_release => true } do
run "ln -nfs #{shared_path}/uploads #{current_release}/#{uploads_path}"
run "ln -nfs #{shared_path}/cache #{current_release}/wp-content/cache"
run "ln -nfs #{latest_release}/wp-config.php.#{stage} #{latest_release}/wp-config.php"
end

desc "Set URL in database"
task :updatedb, :roles => :db, :except => { :no_release => true } do
run "mysql -u #{dbuser} -p #{dbpass} #{dbname} -e 'UPDATE #{dbprefix}options SET option_value = \"#{application}\" WHERE option_name = \"siteurl\" OR option_name = \"home\"'"
end

desc "Protect system files"
task :protect, :except => { :no_release => true } do
run "chmod 440 #{latest_release}/wp-config.php*"
end
end
end

end
Loading

0 comments on commit 6bc2107

Please sign in to comment.