wordmove 1.4.0.pre → 1.4.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -0
- data/CHANGELOG.md +11 -3
- data/README.mdown +23 -3
- data/lib/wordmove/cli.rb +15 -5
- data/lib/wordmove/deployer/base.rb +23 -3
- data/lib/wordmove/deployer/ssh.rb +21 -10
- data/lib/wordmove/version.rb +1 -1
- data/lib/wordmove/wordpress_directory.rb +2 -2
- data/wordmove.gemspec +7 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33285baf64646768c1c8d392b23bac0b1fd1e2de
|
4
|
+
data.tar.gz: f49b9d7e9c054faf98d05cc5865ad45b9e8d1ea0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af73d79c48aa498fb61d7c2e7268ccd605290df440c9f9afabf19ff8c36cf7293477ef1183d4149ff75d9936aee2e4cf0b6625066b59d178c308e3aa85990c57
|
7
|
+
data.tar.gz: eda4854ee0f42be50e108b0c6db0746fa1b09385b6c6bf54f2f57dc82d97662744b1e2fbca4f420c23a3bd3d1cfc9a98e3411b49f2ef4ca72a28e05228b61efd
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
# 1.
|
2
|
-
|
1
|
+
# 1.4.0
|
2
|
+
- Implemented compression of sql files before and after transfers
|
3
|
+
- Implemented compression of sql backup files inside wp-content
|
4
|
+
- Implemented support to mu-plugins directory. Thanks connormckelvey
|
5
|
+
# 1.3.0
|
6
|
+
- fix UTF-8 encoding issue when `wordmove init` with a wrong .sample file
|
7
|
+
- fix problem with ftp password and special chars
|
8
|
+
- fix duplicated wordpress tree in languages folder (ftp only)
|
9
|
+
- update db import / export php libraries
|
10
|
+
- add `--version` option
|
3
11
|
- required ruby version ~> 2.0
|
4
|
-
-
|
12
|
+
- updated test suite with rspec 3.x
|
data/README.mdown
CHANGED
@@ -60,7 +60,7 @@ local:
|
|
60
60
|
password: "password"
|
61
61
|
host: "127.0.0.1"
|
62
62
|
|
63
|
-
|
63
|
+
production:
|
64
64
|
vhost: "http://example.com"
|
65
65
|
wordpress_path: "/var/www/your_site" # use an absolute path here
|
66
66
|
|
@@ -109,7 +109,7 @@ staging:
|
|
109
109
|
# passive: true
|
110
110
|
# scheme: "ftps" # default "ftp"
|
111
111
|
|
112
|
-
#
|
112
|
+
# staging: # multiple environments can be specified
|
113
113
|
# [...]
|
114
114
|
```
|
115
115
|
|
@@ -151,6 +151,16 @@ too much about security though: the script is deleted just after the usage,
|
|
151
151
|
and can only be executed by `wordmove`, as each time it requires a pre-shared
|
152
152
|
one-time-password to be run.
|
153
153
|
|
154
|
+
## Multi environment
|
155
|
+
You can define multiple environments in your `Movefile`, such as production, staging, etc.
|
156
|
+
Use `-e` with `pull` or `push` to run the command on the specified environment.
|
157
|
+
|
158
|
+
For example:
|
159
|
+
```
|
160
|
+
wordmove push -e staging -d
|
161
|
+
```
|
162
|
+
will push your local database to the staging environment only
|
163
|
+
|
154
164
|
## Need more tools?
|
155
165
|
Visit [Wordpress Tools](http://wptools.it).
|
156
166
|
|
@@ -159,11 +169,21 @@ Visit [Wordpress Tools](http://wptools.it).
|
|
159
169
|
* The dump script is the [`MYSQL-dump` PHP package](https://github.com/dg/MySQL-dump) by David Grudl;
|
160
170
|
* The import script used is the [BigDump](http://www.ozerov.de/bigdump/) library;
|
161
171
|
|
172
|
+
## Contribute
|
173
|
+
|
174
|
+
In order to promote a simpler contribution workflow we have decided to fork the `master` branch and PR to the master
|
175
|
+
`branch`.
|
176
|
+
We will accordingly tag and release or pre-release versions to the rubygems.org repository.
|
177
|
+
Do not consider the `dev` branch for your forks and PR.
|
178
|
+
We will never more use version-named branches as in the past.
|
179
|
+
|
180
|
+
Feel free to open an issue about contribution if more you need more info
|
181
|
+
|
162
182
|
## License
|
163
183
|
|
164
184
|
(The MIT License)
|
165
185
|
|
166
|
-
Copyright © 2013 weLaika
|
186
|
+
Copyright © 2013-2015 weLaika
|
167
187
|
|
168
188
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
169
189
|
this software and associated documentation files (the ‘Software’), to deal in
|
data/lib/wordmove/cli.rb
CHANGED
@@ -17,7 +17,7 @@ module Wordmove
|
|
17
17
|
uploads: { aliases: "-u", type: :boolean },
|
18
18
|
themes: { aliases: "-t", type: :boolean },
|
19
19
|
plugins: { aliases: "-p", type: :boolean },
|
20
|
-
mu_plugins:
|
20
|
+
mu_plugins: { aliases: "-m", type: :boolean },
|
21
21
|
languages: { aliases: "-l", type: :boolean },
|
22
22
|
db: { aliases: "-d", type: :boolean },
|
23
23
|
|
@@ -32,12 +32,20 @@ module Wordmove
|
|
32
32
|
|
33
33
|
no_tasks do
|
34
34
|
def handle_options(options)
|
35
|
-
|
36
|
-
if options[task] || options[
|
37
|
-
yield task
|
38
|
-
end
|
35
|
+
wordpress_options.each do |task|
|
36
|
+
yield task if options[task] || options["all"]
|
39
37
|
end
|
40
38
|
end
|
39
|
+
|
40
|
+
def wordpress_options
|
41
|
+
%w(wordpress uploads themes plugins mu_plugins languages db)
|
42
|
+
end
|
43
|
+
|
44
|
+
def ensure_wordpress_options_presence!(options)
|
45
|
+
return if (options.keys & (wordpress_options + ["all"])).present?
|
46
|
+
puts "No options given. See wordmove --help"
|
47
|
+
exit 1
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
desc "pull", "Pulls WP data from remote host to the local machine"
|
@@ -45,6 +53,7 @@ module Wordmove
|
|
45
53
|
method_option option, args
|
46
54
|
end
|
47
55
|
def pull
|
56
|
+
ensure_wordpress_options_presence!(options)
|
48
57
|
deployer = Wordmove::Deployer::Base.deployer_for(options)
|
49
58
|
handle_options(options) do |task|
|
50
59
|
deployer.send("pull_#{task}")
|
@@ -56,6 +65,7 @@ module Wordmove
|
|
56
65
|
method_option option, args
|
57
66
|
end
|
58
67
|
def push
|
68
|
+
ensure_wordpress_options_presence!(options)
|
59
69
|
deployer = Wordmove::Deployer::Base.deployer_for(options)
|
60
70
|
handle_options(options) do |task|
|
61
71
|
deployer.send("push_#{task}")
|
@@ -44,7 +44,12 @@ module Wordmove
|
|
44
44
|
|
45
45
|
found = entries.first
|
46
46
|
logger.task("Using Movefile: #{found}")
|
47
|
-
|
47
|
+
begin
|
48
|
+
YAML::load(File.open(found))
|
49
|
+
rescue Psych::SyntaxError
|
50
|
+
puts "Your Movefile is not a valid YAML file. Please, check your Movefile with a YAML linter such as http://lmgtfy.com/?q=yaml+linter"
|
51
|
+
exit 1
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
def current_dir
|
@@ -175,7 +180,7 @@ module Wordmove
|
|
175
180
|
end
|
176
181
|
|
177
182
|
def mysql_dump_command(options, save_to_path)
|
178
|
-
command = [
|
183
|
+
command = ["mysqldump"]
|
179
184
|
command << "--host=#{Shellwords.escape(options[:host])}" if options[:host].present?
|
180
185
|
command << "--port=#{Shellwords.escape(options[:port])}" if options[:port].present?
|
181
186
|
command << "--user=#{Shellwords.escape(options[:user])}" if options[:user].present?
|
@@ -188,7 +193,7 @@ module Wordmove
|
|
188
193
|
end
|
189
194
|
|
190
195
|
def mysql_import_command(dump_path, options)
|
191
|
-
command = [
|
196
|
+
command = ["mysql"]
|
192
197
|
command << "--host=#{Shellwords.escape(options[:host])}" if options[:host].present?
|
193
198
|
command << "--port=#{Shellwords.escape(options[:port])}" if options[:port].present?
|
194
199
|
command << "--user=#{Shellwords.escape(options[:user])}" if options[:user].present?
|
@@ -200,6 +205,21 @@ module Wordmove
|
|
200
205
|
command.join(" ")
|
201
206
|
end
|
202
207
|
|
208
|
+
def compress_command(path)
|
209
|
+
command = ["gzip"]
|
210
|
+
command << "--best"
|
211
|
+
command << Shellwords.escape(path)
|
212
|
+
puts command.join(" ")
|
213
|
+
command.join(" ")
|
214
|
+
end
|
215
|
+
|
216
|
+
def uncompress_command(path)
|
217
|
+
command = ["gunzip"]
|
218
|
+
command << Shellwords.escape(path)
|
219
|
+
puts command.join(" ")
|
220
|
+
command.join(" ")
|
221
|
+
end
|
222
|
+
|
203
223
|
def rm_command(path)
|
204
224
|
"rm #{Shellwords.escape(path)}"
|
205
225
|
end
|
@@ -11,23 +11,30 @@ module Wordmove
|
|
11
11
|
super
|
12
12
|
|
13
13
|
local_dump_path = local_wp_content_dir.path("dump.sql")
|
14
|
-
|
15
|
-
|
14
|
+
local_gzipped_dump_path = local_dump_path + '.gz'
|
15
|
+
local_gizipped_backup_path = local_wp_content_dir.path("#{environment}-backup-#{Time.now.to_i}.sql.gz")
|
16
|
+
|
17
|
+
download_remote_db(local_gizipped_backup_path)
|
16
18
|
|
17
19
|
save_local_db(local_dump_path)
|
18
20
|
adapt_sql(local_dump_path, local_options, remote_options)
|
19
|
-
|
20
|
-
|
21
|
+
run compress_command(local_dump_path)
|
22
|
+
import_remote_dump(local_gzipped_dump_path)
|
23
|
+
run rm_command(local_gzipped_dump_path)
|
21
24
|
end
|
22
25
|
|
23
26
|
def pull_db
|
24
27
|
super
|
25
28
|
|
26
29
|
local_dump_path = local_wp_content_dir.path("dump.sql")
|
30
|
+
local_gzipped_dump_path = local_dump_path + '.gz'
|
27
31
|
local_backup_path = local_wp_content_dir.path("local-backup-#{Time.now.to_i}.sql")
|
32
|
+
|
28
33
|
save_local_db(local_backup_path)
|
34
|
+
run compress_command(local_backup_path)
|
29
35
|
|
30
|
-
download_remote_db(
|
36
|
+
download_remote_db(local_gzipped_dump_path)
|
37
|
+
run uncompress_command(local_gzipped_dump_path)
|
31
38
|
adapt_sql(local_dump_path, remote_options, local_options)
|
32
39
|
run mysql_import_command(local_dump_path, local_options[:database])
|
33
40
|
run rm_command(local_dump_path)
|
@@ -52,22 +59,26 @@ module Wordmove
|
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
55
|
-
def download_remote_db(
|
62
|
+
def download_remote_db(local_gizipped_dump_path)
|
56
63
|
remote_dump_path = remote_wp_content_dir.path("dump.sql")
|
57
64
|
# dump remote db into file
|
58
65
|
remote_run mysql_dump_command(remote_options[:database], remote_dump_path)
|
66
|
+
remote_run compress_command(remote_dump_path)
|
67
|
+
remote_dump_path += '.gz'
|
59
68
|
# download remote dump
|
60
|
-
remote_get(remote_dump_path,
|
69
|
+
remote_get(remote_dump_path, local_gizipped_dump_path)
|
61
70
|
remote_delete(remote_dump_path)
|
62
71
|
end
|
63
72
|
|
64
|
-
def import_remote_dump(
|
73
|
+
def import_remote_dump(local_gizipped_dump_path)
|
65
74
|
remote_dump_path = remote_wp_content_dir.path("dump.sql")
|
66
|
-
|
75
|
+
remote_gizipped_dump_path = remote_dump_path + '.gz'
|
76
|
+
|
77
|
+
remote_put(local_gizipped_dump_path, remote_gizipped_dump_path)
|
78
|
+
remote_run uncompress_command(remote_gizipped_dump_path)
|
67
79
|
remote_run mysql_import_command(remote_dump_path, remote_options[:database])
|
68
80
|
remote_delete(remote_dump_path)
|
69
81
|
end
|
70
|
-
|
71
82
|
end
|
72
83
|
end
|
73
84
|
end
|
data/lib/wordmove/version.rb
CHANGED
@@ -4,7 +4,7 @@ class WordpressDirectory < Struct.new(:type, :options)
|
|
4
4
|
WP_CONTENT = :wp_content
|
5
5
|
WP_CONFIG = :wp_config
|
6
6
|
PLUGINS = :plugins
|
7
|
-
MU_PLUGINS
|
7
|
+
MU_PLUGINS = :mu_plugins
|
8
8
|
THEMES = :themes
|
9
9
|
UPLOADS = :uploads
|
10
10
|
LANGUAGES = :languages
|
@@ -14,7 +14,7 @@ class WordpressDirectory < Struct.new(:type, :options)
|
|
14
14
|
PATH::WP_CONTENT => 'wp-content',
|
15
15
|
PATH::WP_CONFIG => 'wp-config.php',
|
16
16
|
PATH::PLUGINS => 'wp-content/plugins',
|
17
|
-
PATH::MU_PLUGINS
|
17
|
+
PATH::MU_PLUGINS => 'wp-content/mu-plugins',
|
18
18
|
PATH::THEMES => 'wp-content/themes',
|
19
19
|
PATH::UPLOADS => 'wp-content/uploads',
|
20
20
|
PATH::LANGUAGES => 'wp-content/languages'
|
data/wordmove.gemspec
CHANGED
@@ -32,4 +32,11 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency "simplecov", "~> 0.9"
|
33
33
|
spec.add_development_dependency "pry-byebug", "~> 3.1"
|
34
34
|
spec.add_development_dependency "priscilla", "~> 1.0"
|
35
|
+
|
36
|
+
spec.post_install_message = <<-RAINBOW
|
37
|
+
Starting from 1.4.0 Wordmove will compress SQL dumps both in remote and locale environments.
|
38
|
+
If something will broke, please check if gzip and gunzip executables are present locally and
|
39
|
+
remotely. We are considering obviuos they are installed in any web environment.
|
40
|
+
Open an issue on github at your needs.
|
41
|
+
RAINBOW
|
35
42
|
end
|
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: 1.4.0.
|
4
|
+
version: 1.4.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
@@ -166,6 +166,7 @@ extra_rdoc_files: []
|
|
166
166
|
files:
|
167
167
|
- ".gitignore"
|
168
168
|
- ".rspec"
|
169
|
+
- ".rubocop.yml"
|
169
170
|
- ".ruby-gemset"
|
170
171
|
- ".ruby-version"
|
171
172
|
- ".travis.yml"
|
@@ -201,7 +202,11 @@ homepage: https://github.com/welaika/wordmove
|
|
201
202
|
licenses:
|
202
203
|
- MIT
|
203
204
|
metadata: {}
|
204
|
-
post_install_message:
|
205
|
+
post_install_message: |2
|
206
|
+
Starting from 1.4.0 Wordmove will compress SQL dumps both in remote and locale environments.
|
207
|
+
If something will broke, please check if gzip and gunzip executables are present locally and
|
208
|
+
remotely. We are considering obviuos they are installed in any web environment.
|
209
|
+
Open an issue on github at your needs.
|
205
210
|
rdoc_options: []
|
206
211
|
require_paths:
|
207
212
|
- lib
|
@@ -217,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
222
|
version: 1.3.1
|
218
223
|
requirements: []
|
219
224
|
rubyforge_project:
|
220
|
-
rubygems_version: 2.4.
|
225
|
+
rubygems_version: 2.4.8
|
221
226
|
signing_key:
|
222
227
|
specification_version: 4
|
223
228
|
summary: Wordmove, Capistrano for Wordpress
|