capistrano-cul 0.1.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0229d59429d92fb3ad6b6316d2e0cb4b3e35cd5f6541058da2cdce27cff86632'
4
- data.tar.gz: 00e342d9bbf5ad0953b34630495b0c1f7d8bec69a53749e628c12c0c040f8c6f
3
+ metadata.gz: e45a37c83d7409c27a9363783d566178c6c9de89b308ac06fcb75fc062a3d679
4
+ data.tar.gz: ed9b25f8a4faf0753ff16f5a8bc3c7447e298559165fef4abb176432b5968fb6
5
5
  SHA512:
6
- metadata.gz: 6c2c1a1ad4803773a7aedf38c858cbb5f6c6f0ee1f841ee385ca6b5f64f7674eca3f26279ba367e5ae116ddb9fac7e1edfd30d740d91cd6500616762d558e02a
7
- data.tar.gz: 72be52d3afe3145f88bd8aba8956fd889e7e5880da618ec4ba7af6ff7fd63d604c8369828d78b8f9c42d2f892937587a3aa34decd522c67bdc5e346499ef6106
6
+ metadata.gz: '0568d92354d3b8fdf8583ba3b579803813ef27158f4fa6fbf32180f6eff1945c10a60e3f5586785d432daf03be96fad388c63d3c16673ddba86a6688a7daf062'
7
+ data.tar.gz: 1d19fe901a4a1307e08a383f062fafae414a9fbebd17d03bb8fb6485913f947f1ec82c9bccc8a360e2832975b5bccce59bca8e493a3f68036c17162970ab06c9
data/README.md CHANGED
@@ -109,9 +109,11 @@ set :wp_custom_plugins, {
109
109
  'custom-plugin-directory' => 'plugins/custom-plugin-directory'
110
110
  }
111
111
 
112
- set :additional_plugins_from_remote_zip, [
113
- 'https://github.com/cul/cf-byline/archive/v1.0.0.zip'
114
- ]
112
+ # NOTE: It is important that the keys in the hash below match the plugin name
113
+ # keys exactly. The zip file url can be any valid, publicly-accessible url.
114
+ set :additional_plugins_from_remote_zip, {
115
+ 'cf-byline' => 'https://github.com/cul/cf-byline/archive/v1.0.0.zip'
116
+ }
115
117
 
116
118
  set :wp_custom_themes, {
117
119
  'mytheme' => 'themes/mytheme'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.3.0
@@ -44,10 +44,10 @@ namespace :cul do
44
44
  task :install_additional_plugins_from_remote_zip do
45
45
  on roles(:web) do
46
46
  within File.join(fetch(:wp_docroot)) do
47
- plugin_zip_urls = fetch(:additional_plugins_from_remote_zip) || []
47
+ plugin_zip_names_and_urls = fetch(:additional_plugins_from_remote_zip) || {}
48
48
  # Make sure that all of the URLs start with http:// or https://
49
- raise 'Found non-http/https url in :additional_plugins_from_remote_zip' if plugin_zip_urls.detect { |val| val !~ /^https?:\/\// }
50
- plugin_zip_urls.each do |plugin_url|
49
+ raise 'Found non-http/https url in :additional_plugins_from_remote_zip' if plugin_zip_names_and_urls.values.detect { |val| val !~ /^https?:\/\// }
50
+ plugin_zip_names_and_urls.each do |plugin_name, plugin_url|
51
51
  execute :wp, (fetch(:multisite, false) ? "--url=#{fetch(:dest_multisite_domain)}" : ''), 'plugin', 'install', plugin_url, '--force'
52
52
  end
53
53
  end
@@ -106,23 +106,23 @@ namespace :cul do
106
106
 
107
107
  desc 'Symlink the wp-content wflogs directory to a corresponding directory in /var'
108
108
  task :symlink_wflogs_to_var_directory do
109
- opt_wflogs_path = File.join(fetch(:wp_docroot), 'wp-content', 'wflogs')
110
- var_wflogs_path = opt_wflogs_path.sub(/^\/opt/, '/var')
109
+ wp_docroot_wflogs_path = File.join(fetch(:wp_docroot), 'wp-content', 'wflogs')
110
+ local_disk_wflogs_path = File.join(fetch(:local_disk_wflogs_path), wp_docroot_wflogs_path.sub(/^\/opt/, '/var'))
111
111
 
112
112
  on roles(:web) do
113
113
  # Create target var wflogs dir if it doesn't exist
114
- execute :mkdir, '-p', var_wflogs_path
114
+ execute :mkdir, '-p', local_disk_wflogs_path
115
115
 
116
116
  # Check if a file or directory already exists at opt wflogs
117
- if test "[ -e #{opt_wflogs_path} ]"
118
- if test "[ -L #{opt_wflogs_path} ]"
117
+ if test "[ -e #{wp_docroot_wflogs_path} ]"
118
+ if test "[ -L #{wp_docroot_wflogs_path} ]"
119
119
  # If it's a symlink, delete it and re-create it
120
- execute :rm, opt_wflogs_path,
121
- '&&', 'ln', '-s', var_wflogs_path, opt_wflogs_path
120
+ execute :rm, wp_docroot_wflogs_path,
121
+ '&&', 'ln', '-s', local_disk_wflogs_path, wp_docroot_wflogs_path
122
122
  else
123
123
  # If it's NOT a symlink, move it and symlink to the var wflogs dir
124
- execute :mv, opt_wflogs_path, "#{opt_wflogs_path}-#{Time.now.strftime("%Y-%m-%d-%H%M")}",
125
- '&&', 'ln', '-s', var_wflogs_path, opt_wflogs_path
124
+ execute :mv, wp_docroot_wflogs_path, "#{wp_docroot_wflogs_path}-#{Time.now.strftime("%Y-%m-%d-%H%M")}",
125
+ '&&', 'ln', '-s', local_disk_wflogs_path, wp_docroot_wflogs_path
126
126
  end
127
127
  end
128
128
  end
@@ -104,7 +104,10 @@ namespace :cul do
104
104
  '--exclude="mu-plugins"',
105
105
  '--exclude="themes"',
106
106
  '--exclude="uploads"',
107
- '--exclude="blogs.dir"'
107
+ '--exclude="blogs.dir"',
108
+ # We don't want to copy wflogs because we will be symlinking the
109
+ # dir on the other side, and Wordfence will recreate it anyway.
110
+ '--exclude="wflogs"'
108
111
  ] +
109
112
  # Apply user-defined exclusion filters, if present
110
113
  fetch(:wp_content_rsync_exclude_filters, []).map{ |filter_value| "--exclude=\"#{filter_value}\"" } +
@@ -149,8 +152,8 @@ namespace :cul do
149
152
  on roles(:web) do
150
153
  within dest_wp_content_path do
151
154
  files_not_copied = capture(:comm, '-23',
152
- "<(ssh #{fetch(:remote_user)}@#{fetch(:src_wp_server)} \"cd #{src_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\) | sort\")",
153
- "<(cd #{dest_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\) | sort)"
155
+ "<(ssh #{fetch(:remote_user)}@#{fetch(:src_wp_server)} \"cd #{src_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\) | LC_ALL=C sort\")",
156
+ "<(cd #{dest_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\) | LC_ALL=C sort)"
154
157
  )
155
158
 
156
159
  # Generate list of files that weren't copied. Display this list to the user.
@@ -258,7 +261,14 @@ namespace :cul do
258
261
 
259
262
  puts "Downloading new copies of non-repo-managed plugins and themes..."
260
263
 
261
- data_for_plugins.delete_if{|plugin_info| repo_managed_plugin_names.include?(plugin_info['name']) }.each do |plugin_info|
264
+ remote_zip_plugin_names = (fetch(:additional_plugins_from_remote_zip) || {}).keys
265
+
266
+ # Skip plugins that are repo-managed
267
+ data_for_plugins.delete_if{|plugin_info| repo_managed_plugin_names.include?(plugin_info['name']) }
268
+ # Skip plugins that come from a remote zip url
269
+ data_for_plugins.delete_if{|plugin_info| remote_zip_plugin_names.include?(plugin_info['name']) }
270
+
271
+ data_for_plugins.each do |plugin_info|
262
272
  name = plugin_info['name']
263
273
  version = plugin_info['version']
264
274
  status = plugin_info['status']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-cul
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carla Galarza
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-11-29 00:00:00.000000000 Z
13
+ date: 2024-10-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.2.32
143
+ rubygems_version: 3.4.10
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Common capistrano tasks shared across projects at CUL