wordmove 6.0.0.alpha.1 → 6.0.0.alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wordmove/actions/adapt_local_db.rb +12 -6
- data/lib/wordmove/actions/adapt_remote_db.rb +2 -1
- data/lib/wordmove/actions/backup_local_db.rb +4 -2
- data/lib/wordmove/actions/ftp/cleanup_after_adapt.rb +1 -1
- data/lib/wordmove/actions/ftp/put_and_import_dump_remotely.rb +8 -1
- data/lib/wordmove/actions/setup_context_for_db.rb +0 -6
- data/lib/wordmove/actions/ssh/cleanup_after_adapt.rb +15 -3
- data/lib/wordmove/actions/ssh/download_remote_db.rb +6 -1
- data/lib/wordmove/actions/ssh/put_and_import_dump_remotely.rb +6 -1
- data/lib/wordmove/doctor/wpcli.rb +1 -1
- data/lib/wordmove/organizers/ftp/pull.rb +9 -8
- data/lib/wordmove/organizers/ftp/push.rb +10 -9
- data/lib/wordmove/organizers/ssh/pull.rb +9 -8
- data/lib/wordmove/organizers/ssh/push.rb +10 -9
- data/lib/wordmove/version.rb +1 -1
- data/lib/wordmove/wpcli.rb +11 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ea52bea7c72c65b2b9a55a425d54bfd586b2c8c71e998517d489f4f55fd1616
|
4
|
+
data.tar.gz: 90430c49a99da9c6ded3519a103066b26c13ee6771d89114ed85b46dad39860f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95dd8ab8d22c5f8ec4faa15deb9b95792ecce5e2826d43266cbfdebac551e3f1ee6d646a86b2248ae5a16696849dc6e403ccd1a01d3cbadaa629ae0d62148ea4
|
7
|
+
data.tar.gz: e2413aaf068bd8993a1d4701504eddcdd3259b713f1bd1de92e1b10d7523234862c5e398e367277b8ddc80fb4ab00c717575ad6ac50cb6cb01fdfd6f53e4136f
|
@@ -38,7 +38,7 @@ module Wordmove
|
|
38
38
|
|
39
39
|
next context if simulate?(cli_options: context.cli_options)
|
40
40
|
|
41
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
41
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
42
42
|
cli_options: context.cli_options,
|
43
43
|
logger: context.logger,
|
44
44
|
command: mysql_dump_command(
|
@@ -46,24 +46,27 @@ module Wordmove
|
|
46
46
|
save_to_path: context.db_paths.local.path
|
47
47
|
)
|
48
48
|
)
|
49
|
+
context.fail_and_return!(result.message) if result.failure?
|
49
50
|
|
50
51
|
if context.cli_options[:no_adapt]
|
51
52
|
context.logger.warn 'Skipping DB adapt'
|
52
53
|
else
|
53
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
54
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
54
55
|
cli_options: context.cli_options,
|
55
56
|
logger: context.logger,
|
56
57
|
command: wpcli_search_replace_command(context, :vhost)
|
57
58
|
)
|
59
|
+
context.fail_and_return!(result.message) if result.failure?
|
58
60
|
|
59
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
61
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
60
62
|
cli_options: context.cli_options,
|
61
63
|
logger: context.logger,
|
62
64
|
command: wpcli_search_replace_command(context, :wordpress_path)
|
63
65
|
)
|
66
|
+
context.fail_and_return!(result.message) if result.failure?
|
64
67
|
end
|
65
68
|
|
66
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
69
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
67
70
|
cli_options: context.cli_options,
|
68
71
|
|
69
72
|
logger: context.logger,
|
@@ -72,16 +75,18 @@ module Wordmove
|
|
72
75
|
save_to_path: context.db_paths.local.adapted_path
|
73
76
|
)
|
74
77
|
)
|
78
|
+
context.fail_and_return!(result.message) if result.failure?
|
75
79
|
|
76
80
|
if context.photocopier.is_a? Photocopier::SSH
|
77
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
81
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
78
82
|
cli_options: context.cli_options,
|
79
83
|
logger: context.logger,
|
80
84
|
command: compress_command(file_path: context.db_paths.local.adapted_path)
|
81
85
|
)
|
86
|
+
context.fail_and_return!(result.message) if result.failure?
|
82
87
|
end
|
83
88
|
|
84
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
89
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
85
90
|
cli_options: context.cli_options,
|
86
91
|
logger: context.logger,
|
87
92
|
command: mysql_import_command(
|
@@ -89,6 +94,7 @@ module Wordmove
|
|
89
94
|
env_db_options: context.local_options[:database]
|
90
95
|
)
|
91
96
|
)
|
97
|
+
context.fail_and_return!(result.message) if result.failure?
|
92
98
|
end
|
93
99
|
end
|
94
100
|
end
|
@@ -52,7 +52,7 @@ module Wordmove
|
|
52
52
|
)
|
53
53
|
end
|
54
54
|
|
55
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
55
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
56
56
|
cli_options: context.cli_options,
|
57
57
|
logger: context.logger,
|
58
58
|
command: mysql_import_command(
|
@@ -60,6 +60,7 @@ module Wordmove
|
|
60
60
|
env_db_options: context.local_options[:database]
|
61
61
|
)
|
62
62
|
)
|
63
|
+
context.fail_and_return!(result.message) if result.failure?
|
63
64
|
|
64
65
|
if context.cli_options[:no_adapt]
|
65
66
|
context.logger.warn 'Skipping DB adapt'
|
@@ -30,7 +30,7 @@ module Wordmove
|
|
30
30
|
next context
|
31
31
|
end
|
32
32
|
|
33
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
33
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
34
34
|
cli_options: context.cli_options,
|
35
35
|
logger: context.logger,
|
36
36
|
command: mysql_dump_command(
|
@@ -38,12 +38,14 @@ module Wordmove
|
|
38
38
|
save_to_path: context.db_paths.backup.local.path
|
39
39
|
)
|
40
40
|
)
|
41
|
+
context.fail_and_return!(result.message) if result.failure?
|
41
42
|
|
42
|
-
Wordmove::Actions::RunLocalCommand.execute(
|
43
|
+
result = Wordmove::Actions::RunLocalCommand.execute(
|
43
44
|
cli_options: context.cli_options,
|
44
45
|
logger: context.logger,
|
45
46
|
command: compress_command(file_path: context.db_paths.backup.local.path)
|
46
47
|
)
|
48
|
+
context.fail_and_return!(result.message) if result.failure?
|
47
49
|
|
48
50
|
context.logger.success(
|
49
51
|
"Backup saved at #{context.db_paths.backup.local.gzipped_path}"
|
@@ -33,7 +33,7 @@ module Wordmove
|
|
33
33
|
)
|
34
34
|
|
35
35
|
if result.failure?
|
36
|
-
context.logger.warning 'Failed to delete
|
36
|
+
context.logger.warning 'Failed to delete local file ' \
|
37
37
|
"#{context.db_paths.local.path} because: " \
|
38
38
|
"#{result.message}" \
|
39
39
|
'. Manual intervention required'
|
@@ -61,11 +61,18 @@ module Wordmove
|
|
61
61
|
if context.cli_options[:debug]
|
62
62
|
context.logger.debug "Operation log located at: #{context.db_paths.ftp.local.temp_path}"
|
63
63
|
else
|
64
|
-
Wordmove::Actions::DeleteLocalFile.execute(
|
64
|
+
result = Wordmove::Actions::DeleteLocalFile.execute(
|
65
65
|
cli_options: context.cli_options,
|
66
66
|
logger: context.logger,
|
67
67
|
file_path: context.db_paths.ftp.local.temp_path
|
68
68
|
)
|
69
|
+
|
70
|
+
if result.failure?
|
71
|
+
context.logger.warning 'Failed to delete local file ' \
|
72
|
+
"#{context.db_paths.ftp.local.temp_path} because: " \
|
73
|
+
"#{result.message}" \
|
74
|
+
'. Manual intervention required'
|
75
|
+
end
|
69
76
|
end
|
70
77
|
end
|
71
78
|
end
|
@@ -16,12 +16,6 @@ module Wordmove
|
|
16
16
|
promises :db_paths
|
17
17
|
|
18
18
|
executed do |context| # rubocop:disable Metrics/BlockLength
|
19
|
-
if context.database_task == false
|
20
|
-
context.skip_remaining!
|
21
|
-
context.db_paths = false
|
22
|
-
next context
|
23
|
-
end
|
24
|
-
|
25
19
|
next context if simulate?(cli_options: context.cli_options)
|
26
20
|
|
27
21
|
content_dir = local_wp_content_dir(local_options: context.local_options)
|
@@ -16,7 +16,7 @@ module Wordmove
|
|
16
16
|
# @param logger [Wordmove::Logger]
|
17
17
|
# @!scope class
|
18
18
|
# @return [LightService::Context] Action's context
|
19
|
-
executed do |context|
|
19
|
+
executed do |context| # rubocop:disable Metrics/BlockLength
|
20
20
|
context.logger.task 'Cleanup'
|
21
21
|
|
22
22
|
if simulate?(cli_options: context.cli_options)
|
@@ -24,17 +24,29 @@ module Wordmove
|
|
24
24
|
next context
|
25
25
|
end
|
26
26
|
|
27
|
-
Wordmove::Actions::DeleteLocalFile.execute(
|
27
|
+
result = Wordmove::Actions::DeleteLocalFile.execute(
|
28
28
|
logger: context.logger,
|
29
29
|
cli_options: context.cli_options,
|
30
30
|
file_path: context.db_paths.local.path
|
31
31
|
)
|
32
|
+
if result.failure?
|
33
|
+
context.logger.warning 'Failed to delete local file ' \
|
34
|
+
"#{context.db_paths.local.path} because: " \
|
35
|
+
"#{result.message}" \
|
36
|
+
'. Manual intervention required'
|
37
|
+
end
|
32
38
|
|
33
|
-
Wordmove::Actions::DeleteLocalFile.execute(
|
39
|
+
result = Wordmove::Actions::DeleteLocalFile.execute(
|
34
40
|
cli_options: context.cli_options,
|
35
41
|
logger: context.logger,
|
36
42
|
file_path: context.db_paths.local.gzipped_adapted_path
|
37
43
|
)
|
44
|
+
if result.failure?
|
45
|
+
context.logger.warning 'Failed to delete local file ' \
|
46
|
+
"#{context.db_paths.local.gzipped_adapted_path} because: " \
|
47
|
+
"#{result.message}" \
|
48
|
+
'. Manual intervention required'
|
49
|
+
end
|
38
50
|
end
|
39
51
|
end
|
40
52
|
end
|
@@ -64,7 +64,12 @@ module Wordmove
|
|
64
64
|
cli_options: context.cli_options,
|
65
65
|
remote_file: context.db_paths.remote.gzipped_path
|
66
66
|
)
|
67
|
-
|
67
|
+
if result.failure?
|
68
|
+
context.logger.warning 'Failed to delete remote file ' \
|
69
|
+
"#{context.db_paths.remote.gzipped_path} because: " \
|
70
|
+
"#{result.message}" \
|
71
|
+
'. Manual intervention required'
|
72
|
+
end
|
68
73
|
|
69
74
|
context.logger.success(
|
70
75
|
"Remote DB dump downloaded in #{context.db_paths.local.gzipped_path}"
|
@@ -62,7 +62,12 @@ module Wordmove
|
|
62
62
|
cli_options: context.cli_options,
|
63
63
|
remote_file: context.db_paths.remote.path
|
64
64
|
)
|
65
|
-
|
65
|
+
if result.failure?
|
66
|
+
context.logger.warning 'Failed to delete remote file ' \
|
67
|
+
"#{context.db_paths.remote.path} because: " \
|
68
|
+
"#{result.message}" \
|
69
|
+
'. Manual intervention required'
|
70
|
+
end
|
66
71
|
end
|
67
72
|
end
|
68
73
|
end
|
@@ -35,14 +35,15 @@ module Wordmove
|
|
35
35
|
->(ctx) { ctx.wordpress_task },
|
36
36
|
[Wordmove::Actions::Ftp::PullWordpress]
|
37
37
|
),
|
38
|
-
iterate(:folder_tasks, [Wordmove::Actions::Ftp::GetDirectory])
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
iterate(:folder_tasks, [Wordmove::Actions::Ftp::GetDirectory]),
|
39
|
+
reduce_if(->(ctx) { ctx.database_task },
|
40
|
+
[
|
41
|
+
Wordmove::Actions::SetupContextForDb,
|
42
|
+
Wordmove::Actions::BackupLocalDb,
|
43
|
+
Wordmove::Actions::Ftp::DownloadRemoteDb,
|
44
|
+
Wordmove::Actions::AdaptRemoteDb,
|
45
|
+
Wordmove::Actions::Ftp::CleanupAfterAdapt
|
46
|
+
]),
|
46
47
|
Wordmove::Actions::RunAfterPullHook # Will fail and warn the user
|
47
48
|
]
|
48
49
|
end
|
@@ -35,15 +35,16 @@ module Wordmove
|
|
35
35
|
->(ctx) { ctx.wordpress_task },
|
36
36
|
[Wordmove::Actions::Ftp::PushWordpress]
|
37
37
|
),
|
38
|
-
iterate(:folder_tasks, [Wordmove::Actions::Ftp::PutDirectory])
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
iterate(:folder_tasks, [Wordmove::Actions::Ftp::PutDirectory]),
|
39
|
+
reduce_if(->(ctx) { ctx.database_task },
|
40
|
+
[
|
41
|
+
Wordmove::Actions::SetupContextForDb,
|
42
|
+
Wordmove::Actions::Ftp::DownloadRemoteDb,
|
43
|
+
Wordmove::Actions::Ftp::BackupRemoteDb,
|
44
|
+
Wordmove::Actions::AdaptLocalDb,
|
45
|
+
Wordmove::Actions::Ftp::PutAndImportDumpRemotely,
|
46
|
+
Wordmove::Actions::Ftp::CleanupAfterAdapt
|
47
|
+
]),
|
47
48
|
Wordmove::Actions::RunAfterPushHook # Will fail and warn the user
|
48
49
|
]
|
49
50
|
end
|
@@ -35,14 +35,15 @@ module Wordmove
|
|
35
35
|
->(ctx) { ctx.wordpress_task },
|
36
36
|
[Wordmove::Actions::Ssh::PullWordpress]
|
37
37
|
),
|
38
|
-
iterate(:folder_tasks, [Wordmove::Actions::Ssh::GetDirectory])
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
iterate(:folder_tasks, [Wordmove::Actions::Ssh::GetDirectory]),
|
39
|
+
reduce_if(->(ctx) { ctx.database_task },
|
40
|
+
[
|
41
|
+
Wordmove::Actions::SetupContextForDb,
|
42
|
+
Wordmove::Actions::BackupLocalDb,
|
43
|
+
Wordmove::Actions::Ssh::DownloadRemoteDb,
|
44
|
+
Wordmove::Actions::AdaptRemoteDb,
|
45
|
+
Wordmove::Actions::Ssh::CleanupAfterAdapt
|
46
|
+
]),
|
46
47
|
Wordmove::Actions::RunAfterPullHook
|
47
48
|
]
|
48
49
|
end
|
@@ -35,15 +35,16 @@ module Wordmove
|
|
35
35
|
->(ctx) { ctx.wordpress_task },
|
36
36
|
[Wordmove::Actions::Ssh::PushWordpress]
|
37
37
|
),
|
38
|
-
iterate(:folder_tasks, [Wordmove::Actions::Ssh::PutDirectory])
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
iterate(:folder_tasks, [Wordmove::Actions::Ssh::PutDirectory]),
|
39
|
+
reduce_if(->(ctx) { ctx.database_task },
|
40
|
+
[
|
41
|
+
Wordmove::Actions::SetupContextForDb,
|
42
|
+
Wordmove::Actions::Ssh::DownloadRemoteDb,
|
43
|
+
Wordmove::Actions::Ssh::BackupRemoteDb,
|
44
|
+
Wordmove::Actions::AdaptLocalDb,
|
45
|
+
Wordmove::Actions::Ssh::PutAndImportDumpRemotely,
|
46
|
+
Wordmove::Actions::Ssh::CleanupAfterAdapt
|
47
|
+
]),
|
47
48
|
Wordmove::Actions::RunAfterPushHook
|
48
49
|
]
|
49
50
|
end
|
data/lib/wordmove/version.rb
CHANGED
data/lib/wordmove/wpcli.rb
CHANGED
@@ -33,8 +33,11 @@ module Wordmove
|
|
33
33
|
[
|
34
34
|
'wp search-replace',
|
35
35
|
"--path=#{wpcli_config_path(context)}",
|
36
|
-
context.remote_options
|
37
|
-
context.local_options
|
36
|
+
'"\A' + context.dig(:remote_options, config_key) + '\Z"', # rubocop:disable Style/StringConcatenation
|
37
|
+
'"' + context.dig(:local_options, config_key) + '"', # rubocop:disable Style/StringConcatenation
|
38
|
+
'--regex-delimiter="|"',
|
39
|
+
'--regex',
|
40
|
+
'--precise',
|
38
41
|
'--quiet',
|
39
42
|
'--skip-columns=guid',
|
40
43
|
'--all-tables',
|
@@ -50,7 +53,7 @@ module Wordmove
|
|
50
53
|
# @return [String]
|
51
54
|
# @!scope class
|
52
55
|
def wpcli_config_path(context)
|
53
|
-
load_from_yml(context) || load_from_wpcli || context.local_options
|
56
|
+
load_from_yml(context) || load_from_wpcli || context.dig(:local_options, :wordpress_path)
|
54
57
|
end
|
55
58
|
|
56
59
|
# If wordpress installation brings a `wp-cli.yml` file in its root folder,
|
@@ -60,7 +63,7 @@ module Wordmove
|
|
60
63
|
# @!scope class
|
61
64
|
# @!visibility private
|
62
65
|
def load_from_yml(context)
|
63
|
-
yml_path = File.join(context.local_options
|
66
|
+
yml_path = File.join(context.dig(:local_options, :wordpress_path), 'wp-cli.yml')
|
64
67
|
|
65
68
|
return unless File.exist?(yml_path)
|
66
69
|
|
@@ -75,7 +78,10 @@ module Wordmove
|
|
75
78
|
# @!scope class
|
76
79
|
# @!visibility private
|
77
80
|
def load_from_wpcli
|
78
|
-
wpcli_config = JSON.parse(
|
81
|
+
wpcli_config = JSON.parse(
|
82
|
+
`wp cli param-dump --with-values --allow-root`,
|
83
|
+
symbolize_names: true
|
84
|
+
)
|
79
85
|
wpcli_config.dig(:path, :current)
|
80
86
|
rescue JSON::ParserError => _e
|
81
87
|
nil
|
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: 6.0.0.alpha.
|
4
|
+
version: 6.0.0.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2021-12-
|
15
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|