wordmove 5.1.0 → 6.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +37 -0
- data/.rubocop.yml +2 -5
- data/.ruby-version +1 -1
- data/.yardopts +1 -0
- data/CONTRIBUTING.md +15 -0
- data/README.mdown +1 -1
- data/Rakefile +4 -3
- data/exe/wordmove +2 -1
- data/lib/wordmove/actions/adapt_local_db.rb +95 -0
- data/lib/wordmove/actions/adapt_remote_db.rb +87 -0
- data/lib/wordmove/actions/backup_local_db.rb +54 -0
- data/lib/wordmove/actions/delete_local_file.rb +34 -0
- data/lib/wordmove/actions/delete_remote_file.rb +43 -0
- data/lib/wordmove/actions/filter_and_setup_tasks_to_run.rb +42 -0
- data/lib/wordmove/actions/ftp/backup_remote_db.rb +54 -0
- data/lib/wordmove/actions/ftp/cleanup_after_adapt.rb +70 -0
- data/lib/wordmove/actions/ftp/download_remote_db.rb +69 -0
- data/lib/wordmove/actions/ftp/get_directory.rb +67 -0
- data/lib/wordmove/actions/ftp/helpers.rb +91 -0
- data/lib/wordmove/actions/ftp/pull_wordpress.rb +56 -0
- data/lib/wordmove/actions/ftp/push_wordpress.rb +54 -0
- data/lib/wordmove/actions/ftp/put_and_import_dump_remotely.rb +74 -0
- data/lib/wordmove/actions/ftp/put_directory.rb +67 -0
- data/lib/wordmove/actions/get_file.rb +38 -0
- data/lib/wordmove/actions/helpers.rb +142 -0
- data/lib/wordmove/actions/put_file.rb +48 -0
- data/lib/wordmove/actions/run_after_pull_hook.rb +26 -0
- data/lib/wordmove/actions/run_after_push_hook.rb +26 -0
- data/lib/wordmove/actions/run_before_pull_hook.rb +26 -0
- data/lib/wordmove/actions/run_before_push_hook.rb +26 -0
- data/lib/wordmove/actions/run_local_command.rb +34 -0
- data/lib/wordmove/actions/setup_context_for_db.rb +79 -0
- data/lib/wordmove/actions/ssh/backup_remote_db.rb +49 -0
- data/lib/wordmove/actions/ssh/cleanup_after_adapt.rb +42 -0
- data/lib/wordmove/actions/ssh/download_remote_db.rb +76 -0
- data/lib/wordmove/actions/ssh/get_directory.rb +76 -0
- data/lib/wordmove/actions/ssh/helpers.rb +128 -0
- data/lib/wordmove/actions/ssh/pull_wordpress.rb +56 -0
- data/lib/wordmove/actions/ssh/push_wordpress.rb +54 -0
- data/lib/wordmove/actions/ssh/put_and_import_dump_remotely.rb +70 -0
- data/lib/wordmove/actions/ssh/put_directory.rb +76 -0
- data/lib/wordmove/actions/ssh/run_remote_command.rb +39 -0
- data/lib/wordmove/assets/dump.php.erb +6 -6
- data/lib/wordmove/assets/import.php.erb +7 -7
- data/lib/wordmove/assets/wordmove_schema_global.yml +2 -0
- data/lib/wordmove/assets/wordmove_schema_remote.yml +2 -2
- data/lib/wordmove/cli.rb +152 -91
- data/lib/wordmove/db_paths_config.rb +44 -0
- data/lib/wordmove/doctor/movefile.rb +8 -8
- data/lib/wordmove/doctor/mysql.rb +18 -15
- data/lib/wordmove/doctor/rsync.rb +2 -2
- data/lib/wordmove/doctor/ssh.rb +3 -3
- data/lib/wordmove/doctor/wpcli.rb +4 -4
- data/lib/wordmove/environments_list.rb +4 -4
- data/lib/wordmove/exceptions.rb +13 -0
- data/lib/wordmove/generators/movefile.rb +7 -5
- data/lib/wordmove/generators/movefile_adapter.rb +11 -5
- data/lib/wordmove/guardian.rb +5 -5
- data/lib/wordmove/hook.rb +15 -16
- data/lib/wordmove/logger.rb +11 -10
- data/lib/wordmove/movefile.rb +63 -59
- data/lib/wordmove/organizers/ftp/pull.rb +52 -0
- data/lib/wordmove/organizers/ftp/push.rb +53 -0
- data/lib/wordmove/organizers/ssh/pull.rb +52 -0
- data/lib/wordmove/organizers/ssh/push.rb +53 -0
- data/lib/wordmove/version.rb +1 -1
- data/lib/wordmove/wordpress_directory.rb +76 -8
- data/lib/wordmove/wpcli.rb +85 -0
- data/lib/wordmove.rb +33 -11
- data/wordmove.gemspec +37 -30
- metadata +143 -45
- data/.travis.yml +0 -20
- data/lib/wordmove/deployer/base.rb +0 -193
- data/lib/wordmove/deployer/ftp.rb +0 -160
- data/lib/wordmove/deployer/ssh/default_sql_adapter.rb +0 -47
- data/lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb +0 -55
- data/lib/wordmove/deployer/ssh.rb +0 -169
- data/lib/wordmove/sql_adapter/default.rb +0 -68
- data/lib/wordmove/sql_adapter/wpcli.rb +0 -54
- data/lib/wordmove/wordpress_directory/path.rb +0 -11
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordmove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Fabrizio Monti
|
10
10
|
- Alessandro Fazzi
|
11
11
|
- Filippo Gangi Dino
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2021-12-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|
@@ -20,20 +20,14 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 5.1.1
|
23
|
+
version: '6.1'
|
27
24
|
type: :runtime
|
28
25
|
prerelease: false
|
29
26
|
version_requirements: !ruby/object:Gem::Requirement
|
30
27
|
requirements:
|
31
28
|
- - "~>"
|
32
29
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 5.1.1
|
30
|
+
version: '6.1'
|
37
31
|
- !ruby/object:Gem::Dependency
|
38
32
|
name: colorize
|
39
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,82 +56,110 @@ dependencies:
|
|
62
56
|
- - "~>"
|
63
57
|
- !ruby/object:Gem::Version
|
64
58
|
version: 2.7.5
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: dry-configurable
|
61
|
+
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.13.0
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 0.13.0
|
65
73
|
- !ruby/object:Gem::Dependency
|
66
74
|
name: kwalify
|
67
75
|
requirement: !ruby/object:Gem::Requirement
|
68
76
|
requirements:
|
69
77
|
- - "~>"
|
70
78
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
79
|
+
version: 0.7.2
|
72
80
|
type: :runtime
|
73
81
|
prerelease: false
|
74
82
|
version_requirements: !ruby/object:Gem::Requirement
|
75
83
|
requirements:
|
76
84
|
- - "~>"
|
77
85
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
86
|
+
version: 0.7.2
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: light-service
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.17.0
|
94
|
+
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 0.17.0
|
79
101
|
- !ruby/object:Gem::Dependency
|
80
102
|
name: photocopier
|
81
103
|
requirement: !ruby/object:Gem::Requirement
|
82
104
|
requirements:
|
83
105
|
- - "~>"
|
84
106
|
- !ruby/object:Gem::Version
|
85
|
-
version: '1.
|
107
|
+
version: '1.4'
|
86
108
|
- - ">="
|
87
109
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
110
|
+
version: 1.4.0
|
89
111
|
type: :runtime
|
90
112
|
prerelease: false
|
91
113
|
version_requirements: !ruby/object:Gem::Requirement
|
92
114
|
requirements:
|
93
115
|
- - "~>"
|
94
116
|
- !ruby/object:Gem::Version
|
95
|
-
version: '1.
|
117
|
+
version: '1.4'
|
96
118
|
- - ">="
|
97
119
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.
|
120
|
+
version: 1.4.0
|
99
121
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
122
|
+
name: dry-cli
|
101
123
|
requirement: !ruby/object:Gem::Requirement
|
102
124
|
requirements:
|
103
125
|
- - "~>"
|
104
126
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
127
|
+
version: 0.7.0
|
106
128
|
type: :runtime
|
107
129
|
prerelease: false
|
108
130
|
version_requirements: !ruby/object:Gem::Requirement
|
109
131
|
requirements:
|
110
132
|
- - "~>"
|
111
133
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.
|
134
|
+
version: 0.7.0
|
113
135
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
136
|
+
name: dry-files
|
115
137
|
requirement: !ruby/object:Gem::Requirement
|
116
138
|
requirements:
|
117
139
|
- - "~>"
|
118
140
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
120
|
-
type: :
|
141
|
+
version: 0.1.0
|
142
|
+
type: :runtime
|
121
143
|
prerelease: false
|
122
144
|
version_requirements: !ruby/object:Gem::Requirement
|
123
145
|
requirements:
|
124
146
|
- - "~>"
|
125
147
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
148
|
+
version: 0.1.0
|
127
149
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
150
|
+
name: bundler
|
129
151
|
requirement: !ruby/object:Gem::Requirement
|
130
152
|
requirements:
|
131
153
|
- - "~>"
|
132
154
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
155
|
+
version: 2.3.3
|
134
156
|
type: :development
|
135
157
|
prerelease: false
|
136
158
|
version_requirements: !ruby/object:Gem::Requirement
|
137
159
|
requirements:
|
138
160
|
- - "~>"
|
139
161
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
162
|
+
version: 2.3.3
|
141
163
|
- !ruby/object:Gem::Dependency
|
142
164
|
name: pry-byebug
|
143
165
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,28 +208,70 @@ dependencies:
|
|
186
208
|
requirements:
|
187
209
|
- - "~>"
|
188
210
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
211
|
+
version: 1.24.0
|
212
|
+
type: :development
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.24.0
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: rubocop-rspec
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: 2.6.0
|
190
226
|
type: :development
|
191
227
|
prerelease: false
|
192
228
|
version_requirements: !ruby/object:Gem::Requirement
|
193
229
|
requirements:
|
194
230
|
- - "~>"
|
195
231
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
232
|
+
version: 2.6.0
|
197
233
|
- !ruby/object:Gem::Dependency
|
198
234
|
name: simplecov
|
199
235
|
requirement: !ruby/object:Gem::Requirement
|
200
236
|
requirements:
|
201
237
|
- - "~>"
|
202
238
|
- !ruby/object:Gem::Version
|
203
|
-
version: 0.
|
239
|
+
version: 0.21.2
|
204
240
|
type: :development
|
205
241
|
prerelease: false
|
206
242
|
version_requirements: !ruby/object:Gem::Requirement
|
207
243
|
requirements:
|
208
244
|
- - "~>"
|
209
245
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0.
|
246
|
+
version: 0.21.2
|
247
|
+
- !ruby/object:Gem::Dependency
|
248
|
+
name: yard
|
249
|
+
requirement: !ruby/object:Gem::Requirement
|
250
|
+
requirements:
|
251
|
+
- - ">="
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
254
|
+
type: :development
|
255
|
+
prerelease: false
|
256
|
+
version_requirements: !ruby/object:Gem::Requirement
|
257
|
+
requirements:
|
258
|
+
- - ">="
|
259
|
+
- !ruby/object:Gem::Version
|
260
|
+
version: '0'
|
261
|
+
- !ruby/object:Gem::Dependency
|
262
|
+
name: yard-activesupport-concern
|
263
|
+
requirement: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - ">="
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0'
|
268
|
+
type: :development
|
269
|
+
prerelease: false
|
270
|
+
version_requirements: !ruby/object:Gem::Requirement
|
271
|
+
requirements:
|
272
|
+
- - ">="
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '0'
|
211
275
|
description: Wordmove deploys your WordPress websites at the speed of light.
|
212
276
|
email:
|
213
277
|
- stefano.verna@welaika.com
|
@@ -224,13 +288,14 @@ files:
|
|
224
288
|
- ".github/ISSUE_TEMPLATE/discussion.md"
|
225
289
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
226
290
|
- ".github/stale.yml"
|
291
|
+
- ".github/workflows/ruby.yml"
|
227
292
|
- ".gitignore"
|
228
293
|
- ".rspec"
|
229
294
|
- ".rubocop.yml"
|
230
295
|
- ".ruby-gemset"
|
231
296
|
- ".ruby-version"
|
232
|
-
- ".travis.yml"
|
233
297
|
- ".vscode/launch.json"
|
298
|
+
- ".yardopts"
|
234
299
|
- CHANGELOG.md
|
235
300
|
- CONTRIBUTING.md
|
236
301
|
- Gemfile
|
@@ -259,17 +324,47 @@ files:
|
|
259
324
|
- deploy/deploy.sh
|
260
325
|
- exe/wordmove
|
261
326
|
- lib/wordmove.rb
|
327
|
+
- lib/wordmove/actions/adapt_local_db.rb
|
328
|
+
- lib/wordmove/actions/adapt_remote_db.rb
|
329
|
+
- lib/wordmove/actions/backup_local_db.rb
|
330
|
+
- lib/wordmove/actions/delete_local_file.rb
|
331
|
+
- lib/wordmove/actions/delete_remote_file.rb
|
332
|
+
- lib/wordmove/actions/filter_and_setup_tasks_to_run.rb
|
333
|
+
- lib/wordmove/actions/ftp/backup_remote_db.rb
|
334
|
+
- lib/wordmove/actions/ftp/cleanup_after_adapt.rb
|
335
|
+
- lib/wordmove/actions/ftp/download_remote_db.rb
|
336
|
+
- lib/wordmove/actions/ftp/get_directory.rb
|
337
|
+
- lib/wordmove/actions/ftp/helpers.rb
|
338
|
+
- lib/wordmove/actions/ftp/pull_wordpress.rb
|
339
|
+
- lib/wordmove/actions/ftp/push_wordpress.rb
|
340
|
+
- lib/wordmove/actions/ftp/put_and_import_dump_remotely.rb
|
341
|
+
- lib/wordmove/actions/ftp/put_directory.rb
|
342
|
+
- lib/wordmove/actions/get_file.rb
|
343
|
+
- lib/wordmove/actions/helpers.rb
|
344
|
+
- lib/wordmove/actions/put_file.rb
|
345
|
+
- lib/wordmove/actions/run_after_pull_hook.rb
|
346
|
+
- lib/wordmove/actions/run_after_push_hook.rb
|
347
|
+
- lib/wordmove/actions/run_before_pull_hook.rb
|
348
|
+
- lib/wordmove/actions/run_before_push_hook.rb
|
349
|
+
- lib/wordmove/actions/run_local_command.rb
|
350
|
+
- lib/wordmove/actions/setup_context_for_db.rb
|
351
|
+
- lib/wordmove/actions/ssh/backup_remote_db.rb
|
352
|
+
- lib/wordmove/actions/ssh/cleanup_after_adapt.rb
|
353
|
+
- lib/wordmove/actions/ssh/download_remote_db.rb
|
354
|
+
- lib/wordmove/actions/ssh/get_directory.rb
|
355
|
+
- lib/wordmove/actions/ssh/helpers.rb
|
356
|
+
- lib/wordmove/actions/ssh/pull_wordpress.rb
|
357
|
+
- lib/wordmove/actions/ssh/push_wordpress.rb
|
358
|
+
- lib/wordmove/actions/ssh/put_and_import_dump_remotely.rb
|
359
|
+
- lib/wordmove/actions/ssh/put_directory.rb
|
360
|
+
- lib/wordmove/actions/ssh/run_remote_command.rb
|
262
361
|
- lib/wordmove/assets/dump.php.erb
|
263
362
|
- lib/wordmove/assets/import.php.erb
|
264
363
|
- lib/wordmove/assets/wordmove_schema_global.yml
|
265
364
|
- lib/wordmove/assets/wordmove_schema_local.yml
|
266
365
|
- lib/wordmove/assets/wordmove_schema_remote.yml
|
267
366
|
- lib/wordmove/cli.rb
|
268
|
-
- lib/wordmove/
|
269
|
-
- lib/wordmove/deployer/ftp.rb
|
270
|
-
- lib/wordmove/deployer/ssh.rb
|
271
|
-
- lib/wordmove/deployer/ssh/default_sql_adapter.rb
|
272
|
-
- lib/wordmove/deployer/ssh/wpcli_sql_adapter.rb
|
367
|
+
- lib/wordmove/db_paths_config.rb
|
273
368
|
- lib/wordmove/doctor.rb
|
274
369
|
- lib/wordmove/doctor/movefile.rb
|
275
370
|
- lib/wordmove/doctor/mysql.rb
|
@@ -285,18 +380,21 @@ files:
|
|
285
380
|
- lib/wordmove/hook.rb
|
286
381
|
- lib/wordmove/logger.rb
|
287
382
|
- lib/wordmove/movefile.rb
|
288
|
-
- lib/wordmove/
|
289
|
-
- lib/wordmove/
|
383
|
+
- lib/wordmove/organizers/ftp/pull.rb
|
384
|
+
- lib/wordmove/organizers/ftp/push.rb
|
385
|
+
- lib/wordmove/organizers/ssh/pull.rb
|
386
|
+
- lib/wordmove/organizers/ssh/push.rb
|
290
387
|
- lib/wordmove/version.rb
|
291
388
|
- lib/wordmove/wordpress_directory.rb
|
292
|
-
- lib/wordmove/
|
389
|
+
- lib/wordmove/wpcli.rb
|
293
390
|
- pkg/wordmove-0.0.1.gem
|
294
391
|
- pkg/wordmove-0.0.2.gem
|
295
392
|
- wordmove.gemspec
|
296
393
|
homepage: https://github.com/welaika/wordmove
|
297
394
|
licenses:
|
298
395
|
- MIT
|
299
|
-
metadata:
|
396
|
+
metadata:
|
397
|
+
rubygems_mfa_required: 'true'
|
300
398
|
post_install_message: |2
|
301
399
|
Starting from version 3.0.0 `database.charset` option is no longer accepted.
|
302
400
|
Pass the '--default-charecter-set' flag into `database.mysqldump_options` or to
|
@@ -315,12 +413,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
315
413
|
version: 2.6.0
|
316
414
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
317
415
|
requirements:
|
318
|
-
- - "
|
416
|
+
- - ">"
|
319
417
|
- !ruby/object:Gem::Version
|
320
|
-
version:
|
418
|
+
version: 1.3.1
|
321
419
|
requirements: []
|
322
|
-
rubygems_version: 3.
|
323
|
-
signing_key:
|
420
|
+
rubygems_version: 3.1.2
|
421
|
+
signing_key:
|
324
422
|
specification_version: 4
|
325
423
|
summary: Wordmove, Capistrano for Wordpress
|
326
424
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.6.5
|
5
|
-
|
6
|
-
cache: bundler
|
7
|
-
|
8
|
-
before_install:
|
9
|
-
- gem install bundler -v '~> 2.0'
|
10
|
-
|
11
|
-
install:
|
12
|
-
- bundle install --jobs=3 --retry=3
|
13
|
-
|
14
|
-
deploy:
|
15
|
-
provider: script
|
16
|
-
script: bash deploy/deploy.sh
|
17
|
-
on:
|
18
|
-
tags: true
|
19
|
-
branch: master
|
20
|
-
ruby: '2.6.5'
|
@@ -1,193 +0,0 @@
|
|
1
|
-
module Wordmove
|
2
|
-
module Deployer
|
3
|
-
class Base
|
4
|
-
attr_reader :options
|
5
|
-
attr_reader :logger
|
6
|
-
attr_reader :environment
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def deployer_for(cli_options)
|
10
|
-
movefile = Wordmove::Movefile.new(cli_options[:config])
|
11
|
-
movefile.load_dotenv(cli_options)
|
12
|
-
|
13
|
-
options = movefile.fetch.merge! cli_options
|
14
|
-
environment = movefile.environment(cli_options)
|
15
|
-
|
16
|
-
return FTP.new(environment, options) if options[environment][:ftp]
|
17
|
-
|
18
|
-
if options[environment][:ssh] && options[:global][:sql_adapter] == 'wpcli'
|
19
|
-
return Ssh::WpcliSqlAdapter.new(environment, options)
|
20
|
-
end
|
21
|
-
|
22
|
-
if options[environment][:ssh] && options[:global][:sql_adapter] == 'default'
|
23
|
-
return Ssh::DefaultSqlAdapter.new(environment, options)
|
24
|
-
end
|
25
|
-
|
26
|
-
raise NoAdapterFound, "No valid adapter found."
|
27
|
-
end
|
28
|
-
|
29
|
-
def current_dir
|
30
|
-
'.'
|
31
|
-
end
|
32
|
-
|
33
|
-
def logger(secrets)
|
34
|
-
Logger.new(STDOUT, secrets).tap { |l| l.level = Logger::DEBUG }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def initialize(environment, options = {})
|
39
|
-
@environment = environment.to_sym
|
40
|
-
@options = options
|
41
|
-
|
42
|
-
movefile_secrets = Wordmove::Movefile.new(options[:config]).secrets
|
43
|
-
@logger = self.class.logger(movefile_secrets)
|
44
|
-
end
|
45
|
-
|
46
|
-
def push_db
|
47
|
-
logger.task "Pushing Database"
|
48
|
-
end
|
49
|
-
|
50
|
-
def pull_db
|
51
|
-
logger.task "Pulling Database"
|
52
|
-
end
|
53
|
-
|
54
|
-
def remote_get_directory; end
|
55
|
-
|
56
|
-
def remote_put_directory; end
|
57
|
-
|
58
|
-
def exclude_dir_contents(path)
|
59
|
-
"#{path}/*"
|
60
|
-
end
|
61
|
-
|
62
|
-
def push_wordpress
|
63
|
-
logger.task "Pushing wordpress core"
|
64
|
-
|
65
|
-
local_path = local_options[:wordpress_path]
|
66
|
-
remote_path = remote_options[:wordpress_path]
|
67
|
-
exclude_wp_content = exclude_dir_contents(local_wp_content_dir.relative_path)
|
68
|
-
exclude_paths = paths_to_exclude.push(exclude_wp_content)
|
69
|
-
|
70
|
-
remote_put_directory(local_path, remote_path, exclude_paths)
|
71
|
-
end
|
72
|
-
|
73
|
-
def pull_wordpress
|
74
|
-
logger.task "Pulling wordpress core"
|
75
|
-
|
76
|
-
local_path = local_options[:wordpress_path]
|
77
|
-
remote_path = remote_options[:wordpress_path]
|
78
|
-
exclude_wp_content = exclude_dir_contents(remote_wp_content_dir.relative_path)
|
79
|
-
exclude_paths = paths_to_exclude.push(exclude_wp_content)
|
80
|
-
|
81
|
-
remote_get_directory(remote_path, local_path, exclude_paths)
|
82
|
-
end
|
83
|
-
|
84
|
-
protected
|
85
|
-
|
86
|
-
def paths_to_exclude
|
87
|
-
remote_options[:exclude] || []
|
88
|
-
end
|
89
|
-
|
90
|
-
def run(command)
|
91
|
-
logger.task_step true, command
|
92
|
-
return true if simulate?
|
93
|
-
|
94
|
-
system(command)
|
95
|
-
raise ShellCommandError, "Return code reports an error" unless $CHILD_STATUS.success?
|
96
|
-
end
|
97
|
-
|
98
|
-
def download(url, local_path)
|
99
|
-
logger.task_step true, "download #{url} > #{local_path}"
|
100
|
-
|
101
|
-
return true if simulate?
|
102
|
-
|
103
|
-
File.open(local_path, 'w') do |file|
|
104
|
-
file << URI.open(url).read
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def simulate?
|
109
|
-
options[:simulate]
|
110
|
-
end
|
111
|
-
|
112
|
-
[
|
113
|
-
WordpressDirectory::Path::WP_CONTENT,
|
114
|
-
WordpressDirectory::Path::PLUGINS,
|
115
|
-
WordpressDirectory::Path::MU_PLUGINS,
|
116
|
-
WordpressDirectory::Path::THEMES,
|
117
|
-
WordpressDirectory::Path::UPLOADS,
|
118
|
-
WordpressDirectory::Path::LANGUAGES
|
119
|
-
].each do |type|
|
120
|
-
%i[remote local].each do |location|
|
121
|
-
define_method "#{location}_#{type}_dir" do
|
122
|
-
options = send("#{location}_options")
|
123
|
-
WordpressDirectory.new(type, options)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def mysql_dump_command(options, save_to_path)
|
129
|
-
command = ["mysqldump"]
|
130
|
-
command << "--host=#{Shellwords.escape(options[:host])}" if options[:host].present?
|
131
|
-
command << "--port=#{Shellwords.escape(options[:port])}" if options[:port].present?
|
132
|
-
command << "--user=#{Shellwords.escape(options[:user])}" if options[:user].present?
|
133
|
-
if options[:password].present?
|
134
|
-
command << "--password=#{Shellwords.escape(options[:password])}"
|
135
|
-
end
|
136
|
-
command << "--result-file=\"#{save_to_path}\""
|
137
|
-
if options[:mysqldump_options].present?
|
138
|
-
command << Shellwords.split(options[:mysqldump_options])
|
139
|
-
end
|
140
|
-
command << Shellwords.escape(options[:name])
|
141
|
-
command.join(" ")
|
142
|
-
end
|
143
|
-
|
144
|
-
def mysql_import_command(dump_path, options)
|
145
|
-
command = ["mysql"]
|
146
|
-
command << "--host=#{Shellwords.escape(options[:host])}" if options[:host].present?
|
147
|
-
command << "--port=#{Shellwords.escape(options[:port])}" if options[:port].present?
|
148
|
-
command << "--user=#{Shellwords.escape(options[:user])}" if options[:user].present?
|
149
|
-
if options[:password].present?
|
150
|
-
command << "--password=#{Shellwords.escape(options[:password])}"
|
151
|
-
end
|
152
|
-
command << "--database=#{Shellwords.escape(options[:name])}"
|
153
|
-
command << Shellwords.split(options[:mysql_options]) if options[:mysql_options].present?
|
154
|
-
command << "--execute=\"SET autocommit=0;SOURCE #{dump_path};COMMIT\""
|
155
|
-
command.join(" ")
|
156
|
-
end
|
157
|
-
|
158
|
-
def compress_command(path)
|
159
|
-
command = ["gzip"]
|
160
|
-
command << "-9"
|
161
|
-
command << "-f"
|
162
|
-
command << "\"#{path}\""
|
163
|
-
command.join(" ")
|
164
|
-
end
|
165
|
-
|
166
|
-
def uncompress_command(path)
|
167
|
-
command = ["gzip"]
|
168
|
-
command << "-d"
|
169
|
-
command << "-f"
|
170
|
-
command << "\"#{path}\""
|
171
|
-
command.join(" ")
|
172
|
-
end
|
173
|
-
|
174
|
-
def local_delete(path)
|
175
|
-
logger.task_step true, "delete: '#{path}'"
|
176
|
-
File.delete(path) unless simulate?
|
177
|
-
end
|
178
|
-
|
179
|
-
def save_local_db(local_dump_path)
|
180
|
-
# dump local mysql into file
|
181
|
-
run mysql_dump_command(local_options[:database], local_dump_path)
|
182
|
-
end
|
183
|
-
|
184
|
-
def remote_options
|
185
|
-
options[environment].clone
|
186
|
-
end
|
187
|
-
|
188
|
-
def local_options
|
189
|
-
options[:local].clone
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|