capistrano-cul 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50d8c0153adc0398b98d587bde126f299cdedc8700339c42331d87163b9842e3
4
- data.tar.gz: 6eb49f3abfc755194f3833d65563210d4bc879f7ff93a71d7493bbcca3b72601
3
+ metadata.gz: 77f9d175ae1d9c1d8328e1c709c9c0a1c0d56fde512c0b93a924d5b70c840791
4
+ data.tar.gz: fb00f2da7b0c269d5aa68ede5397e1bb5de1f5fb330511b383095b9f5df54802
5
5
  SHA512:
6
- metadata.gz: 7f758050b607bc1e66b27d8dc8ee52f6824fc4f2650f2f5e4a0197786dde6697afb8c33806b9833c4bb43aa9f44bf212c80ace9e028c604b09fbd5e4dc649acf
7
- data.tar.gz: '09c962e938ddb7339e397a24d09e370694310c4bb4abc7e0916b13ac9078eb11baa285565469e3d77306e0faf85ef7d4fecdcaf52bbd7287e228bf78c2a7e6b7'
6
+ metadata.gz: 6cb3f7c325d7d064ab6c55ccdba0c94ca5dfb03647eca12b665658dcd2a8e09cad5206136eb3fea29a94e152ddc2e34ede0f2c0dd3b15b8d6e73ef0672a76f40
7
+ data.tar.gz: 527e8c89c2cbf83d5589c749b6993057bf58240cedeccac84160903f8ce7d29891e417794f2a1cd04cc84e7337a468fc4acf0cf0d26982ad77a65436643f8f65
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -143,6 +143,21 @@ namespace :cul do
143
143
  ]
144
144
  )
145
145
 
146
+ # Then copy all .htaccess files in the docroot
147
+ execute :rsync, (
148
+ rsync_base_params +
149
+ [
150
+ # Include .htaccess files
151
+ '--include=".htaccess"',
152
+ # Exclude everything else not included by --include filters
153
+ '--exclude="*"',
154
+ # src directory
155
+ fetch(:remote_user) + '@' + fetch(:src_wp_server) + ':' + File.join(fetch(:src_wp_docroot), '/.'), # trailing '/.' so that .htaccess files are included in the sync scope
156
+ # dest directory
157
+ fetch(:wp_docroot)
158
+ ]
159
+ )
160
+
146
161
  end
147
162
  end
148
163
 
@@ -151,10 +166,24 @@ namespace :cul do
151
166
 
152
167
  on roles(:web) do
153
168
  within dest_wp_content_path do
154
- files_not_copied = capture(:comm, '-23',
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)"
157
- )
169
+ copy_source_file_list = File.join(fetch(:deploy_to), 'copy-source-file-list.txt')
170
+ copy_dest_file_list = File.join(fetch(:deploy_to), 'copy-dest-local-file-list.txt')
171
+
172
+ # NOTE: We write the output of file scan operations to a file because there are sometime newline
173
+ # character issues with the `find` operation output is streamed through the capistrano `execute` method.
174
+ source_file_list_command = "ssh #{fetch(:remote_user)}@#{fetch(:src_wp_server)} \"cd #{src_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\)\" > #{copy_source_file_list}"
175
+ destination_file_list_command = "cd #{dest_wp_content_path} && find . -type f \\( -path '*/uploads/*' -o -path '*/blogs.dir/*' \\) > #{copy_dest_file_list}"
176
+
177
+ execute(source_file_list_command)
178
+ execute(destination_file_list_command)
179
+
180
+ source_file_list_raw_output = capture("cat #{copy_source_file_list} && rm #{copy_source_file_list}")
181
+ destination_file_list_raw_output = capture("cat #{copy_dest_file_list} && rm #{copy_dest_file_list}")
182
+
183
+ source_file_set = Set.new(source_file_list_raw_output.split("\n"))
184
+ destination_file_set = Set.new(destination_file_list_raw_output.split("\n"))
185
+
186
+ files_not_copied = (source_file_set - destination_file_set).to_a.sort
158
187
 
159
188
  # Generate list of files that weren't copied. Display this list to the user.
160
189
  puts (
@@ -163,18 +192,23 @@ namespace :cul do
163
192
  "./plugins\n" +
164
193
  "./mu-plugins\n" +
165
194
  "./themes\n" +
166
- (files_not_copied.length > 0 ? files_not_copied + "\n" : '') +
195
+ (files_not_copied.length > 0 ? files_not_copied.join("\n") + "\n" : '') +
167
196
  "-------------------------"
168
197
  )
169
198
  end
170
199
  end
171
-
200
+ unless enter_y_to_continue("Does that list look okay? Normally it should only include plugins, mu-plugins, and themes.")
201
+ puts 'Exiting because the list did not look okay.'
202
+ exit
203
+ puts 'nope'
204
+ end
172
205
  end
173
206
 
174
207
  desc "Copies certain wp-content (everything other than plugins, themes, and mu-plugins) from one environment to another (e.g. prod to dev). This task is part of the :copy_from task and isn't meant to be called directly."
175
208
  task :copy_database do
176
- remote_server_db_export_tempfile_path = Tempfile.create(['db_export_tempfile', '.sql'], '/tmp/').path
177
- local_server_db_export_file_path = File.join(fetch(:wp_docroot), File.basename(remote_server_db_export_tempfile_path))
209
+ export_filename = "db_export_tempfile-#{SecureRandom.uuid}.sql"
210
+ remote_server_db_export_tempfile_path = File.join(fetch(:src_wp_docroot), '..', export_filename)
211
+ local_server_db_export_file_path = File.join(fetch(:wp_docroot), '..', export_filename)
178
212
 
179
213
  # Export database from source WordPress instance
180
214
  on fetch(:remote_user) + '@' + fetch(:src_wp_server) do
@@ -19,6 +19,9 @@ namespace :cul do
19
19
  # Download and unpack latest version of WP to wp_docroot
20
20
  execute :wp, 'core', ['download', "--version=latest", "--path=#{fetch(:wp_docroot)}"]
21
21
 
22
+ # Delete the unnecessary hello.php plugin that's included with a default installation
23
+ execute :rm, File.join(fetch(:wp_docroot), 'wp-content/plugins/hello.php')
24
+
22
25
  # Create a limited-content wp-config.php file that requires our shared
23
26
  # wp-config-include.php file. We do this so that wordpress still has a
24
27
  # wp-config.php file at the expected location, and that file correctly
@@ -1,4 +1,4 @@
1
- set :cul_allowed_upload_types_version, 'v0.5.0' # can be overridden by an app's deploy.rb file
1
+ set :cul_allowed_upload_types_version, 'v0.6.0' # can be overridden by an app's deploy.rb file
2
2
  set :cul_allowed_upload_types_plugin_name, 'cul-allowed-upload-types'
3
3
  set :cul_allowed_upload_types_downloaded_plugin_path, ->{current_path.join(fetch(:cul_allowed_upload_types_plugin_name))} # can be overridden by an app's deploy.rb file
4
4
 
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.3.3
4
+ version: 0.3.4
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: 2024-10-31 00:00:00.000000000 Z
13
+ date: 2024-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capistrano