lib/capistrano/tasks/wp.cap in capistrano-cul-0.0.6 vs lib/capistrano/tasks/wp.cap in capistrano-cul-0.0.7
- old
+ new
@@ -18,32 +18,32 @@
# Printing out wp_version here because the `set` command above only runs
# the first time its associated symbol is referenced, and we want to
# capture version before running any other commands.
puts "Setting up wp_version: #{fetch(:wp_version)}"
- require_cap_params!([:branch, :wp_version, :wp_docroot, :wp_data_path])
+ require_cap_params!([:branch, :wp_version, :wp_docroot, :wp_content_path])
on roles(:web) do
wp_docroot_wp_config_file_path = File.join(fetch(:wp_docroot), 'wp-config.php')
wp_docroot_robots_txt_file_path = File.join(fetch(:wp_docroot), 'robots.txt')
wp_docroot_wp_content_path = File.join(fetch(:wp_docroot), 'wp-content')
shared_wp_config_file_path = shared_path.join('wp-config.php')
shared_robots_txt_file_path = shared_path.join('robots.txt')
- wp_data_wp_content_path = File.join(fetch(:wp_data_path), 'wp-content')
+ wp_content_path = fetch(:wp_content_path)
invoke 'deploy' # Deploy before doing setup
# Create nginx logs directory if it doesn't already exist
execute :mkdir, '-p', deploy_path.join('logs')
# Make full path to wp_docroot directory if not exist
execute :mkdir, '-p', fetch(:wp_docroot)
- # Make full path to wp_data_path if not exist
- execute :mkdir, '-p', fetch(:wp_data_path)
+ # Make full path to wp_content_path if not exist
+ execute :mkdir, '-p', wp_content_path
# If wp_docroot/wp-includes does not exist, do wordpress download
unless test("[ -d #{File.join(fetch(:wp_docroot), 'wp-includes')} ]")
# Download and unpack new WP instance to wp_docroot
execute :wp, 'core', ['download', "--version=#{fetch(:wp_version)}", "--path=#{fetch(:wp_docroot)}"]
@@ -65,19 +65,19 @@
execute "echo -e \"User-agent: *\nDisallow: /\" > #{shared_robots_txt_file_path}"
end
# Create symlink for wp_document_root robots.txt to 'shared' version.
execute :ln, '-sf', shared_robots_txt_file_path, wp_docroot_robots_txt_file_path
- # Check for wp-content directory at wp_data_wp_content_path. Create if it doesn't exist.
- unless test("[ -d #{wp_data_wp_content_path} ]")
+ # Check for actual wp-content directory at wp_content_path. Create if it doesn't exist.
+ unless test("[ -d #{wp_content_path} ]")
# If no wp-config.php file is found in the 'shared' directory, copy WordPress built-in wp-config-sample.php to there
- execute :cp, '-r', wp_docroot_wp_content_path, wp_data_wp_content_path
+ execute :cp, '-r', wp_docroot_wp_content_path, wp_content_path
end
# Delete original wp-content directory
execute :rm, '-rf', wp_docroot_wp_content_path
- # Create symlink for wp_document_root wp-content to wp_data_wp_content_path
- execute :ln, '-sf', wp_data_wp_content_path, wp_docroot_wp_content_path
+ # Create symlink for wp_document_root wp-content to wp_content_path
+ execute :ln, '-sf', wp_content_path, wp_docroot_wp_content_path
end
symlink_custom_plugins_and_themes
end
@@ -110,37 +110,37 @@
end
end
def self.symlink_custom_plugins_and_themes
on roles(:web) do
- wp_data_wp_content_path = File.join(fetch(:wp_data_path), 'wp-content')
- wp_data_plugin_path = File.join(wp_data_wp_content_path, 'plugins')
- wp_data_mu_plugin_path = File.join(wp_data_wp_content_path, 'mu-plugins')
- wp_data_themes_path = File.join(wp_data_wp_content_path, 'themes')
+ wp_content_path = fetch(:wp_content_path)
+ wp_content_plugin_path = File.join(wp_content_path, 'plugins')
+ wp_content_mu_plugin_path = File.join(wp_content_path, 'mu-plugins')
+ wp_content_themes_path = File.join(wp_content_path, 'themes')
- if test("[ -d #{wp_data_wp_content_path} ]")
+ if test("[ -d #{wp_content_path} ]")
# Create necessary directories
- execute :mkdir, '-p', wp_data_plugin_path
- execute :mkdir, '-p', wp_data_mu_plugin_path
- execute :mkdir, '-p', wp_data_themes_path
+ execute :mkdir, '-p', wp_content_plugin_path
+ execute :mkdir, '-p', wp_content_mu_plugin_path
+ execute :mkdir, '-p', wp_content_themes_path
# Remove old symlinks
- [wp_data_plugin_path, wp_data_themes_path].each do |dir|
+ [wp_content_plugin_path, wp_content_mu_plugin_path, wp_content_themes_path].each do |dir|
execute :find, dir, '-maxdepth 1', '-type l', '-exec rm {} \;'
end
# Add latest symlinks
fetch(:wp_custom_plugins, {}).each do |plugin, repo_relative_path|
- execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_data_plugin_path, plugin)
+ execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_content_plugin_path, plugin)
end
fetch(:wp_custom_mu_plugins, {}).each do |mu_plugin, repo_relative_path|
- execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_data_mu_plugin_path, mu_plugin)
+ execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_content_mu_plugin_path, mu_plugin)
end
fetch(:wp_custom_themes, {}).each do |theme, repo_relative_path|
- execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_data_themes_path, theme)
+ execute :ln, '-sf', File.join(current_path, repo_relative_path), File.join(wp_content_themes_path, theme)
end
end
end
end