wordmove 1.4.0.pre5 → 1.4.0.pre6

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
  SHA1:
3
- metadata.gz: 3539e79c18d048d429bbf8c74fe16062fea7b247
4
- data.tar.gz: 1a342c75af3274424eda5e5d46691e1d8f0408bb
3
+ metadata.gz: 730256123fd94ace7ccba5f95a7ee5ac62a60c08
4
+ data.tar.gz: 90300e3098bf4b1380aa7238e091b19d96fb1c4f
5
5
  SHA512:
6
- metadata.gz: 205ec2101b5bbab623950ceee0644160ace684841c7f2c8bb79921b253e37f2063590444b165405fcbcf46744e23d36432f7dac441be9ec45da317bbeb9fdda0
7
- data.tar.gz: 1132b2af445f8a3d0f932621e7d1b113f6cfd725a05513689036126454f8fb358013573d691789b178554cdd4a6aba3f90cb5be20ba8c9796d920e0ff74284e5
6
+ metadata.gz: ad9786cdad431bf7883bb27ce0fcee518e92b50c4a9efa98726f6fae05b82c6a32d4af9d41127da4ab835c7f1183c9f9dcf6b2213e8a9a00a33687aee93fdba9
7
+ data.tar.gz: c86fdaadca3ffd76e0d9b09e1951be1119d0a275d8bbff2800ba46d564016b40cd681672463fb9fcd09a52bc0a9e9012b60e6e4cdd2049179887f236d158209d
data/CHANGELOG.md CHANGED
@@ -1,11 +1,18 @@
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
+ - Update `dump.php` library to support database VIEWS
6
+
7
+
1
8
  # 1.3.1
2
- - fix typo in dump.php.erb
9
+ - Fix typo in dump.php.erb
3
10
 
4
11
  # 1.3.0
5
- - fix UTF-8 encoding issue when `wordmove init` with a wrong .sample file
6
- - fix problem with ftp password and special chars
7
- - fix duplicated wordpress tree in languages folder (ftp only)
8
- - update db import / export php libraries
9
- - add `--version` option
10
- - required ruby version ~> 2.0
11
- - updated test suite with rspec 3.x
12
+ - Fix UTF-8 encoding issue when `wordmove init` with a wrong .sample file
13
+ - Fix problem with ftp password and special chars
14
+ - Fix duplicated wordpress tree in languages folder (ftp only)
15
+ - Update db import / export php libraries
16
+ - Add `--version` option
17
+ - Required ruby version ~> 2.0
18
+ - Updated test suite with rspec 3.x
data/README.mdown CHANGED
@@ -67,6 +67,7 @@ production:
67
67
  password: "password"
68
68
  host: "host"
69
69
  # port: "3308" # Use just in case you have exotic server config
70
+ # mysqldump_options: "--max_allowed_packet=50MB" # Only available if using SSH
70
71
 
71
72
  exclude:
72
73
  - ".git/"
@@ -168,4 +169,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
168
169
  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
169
170
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
170
171
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
171
-
@@ -78,14 +78,20 @@ class MySQLDump
78
78
  throw new Exception('Argument must be stream resource.');
79
79
  }
80
80
 
81
- $tables = array();
81
+ $tables = $views = array();
82
82
 
83
- $res = $this->connection->query('SHOW TABLES');
83
+ $res = $this->connection->query('SHOW FULL TABLES');
84
84
  while ($row = $res->fetch_row()) {
85
- $tables[] = $row[0];
85
+ if ($row[1] === 'VIEW') {
86
+ $views[] = $row[0];
87
+ } else {
88
+ $tables[] = $row[0];
89
+ }
86
90
  }
87
91
  $res->close();
88
92
 
93
+ $tables = array_merge($tables, $views); // views must be last
94
+
89
95
  $this->connection->query('LOCK TABLES `' . implode('` READ, `', $tables) . '` READ');
90
96
 
91
97
  $db = $this->connection->query('SELECT DATABASE()')->fetch_row();
data/lib/wordmove/cli.rb CHANGED
@@ -17,6 +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: { aliases: "-m", type: :boolean },
20
21
  languages: { aliases: "-l", type: :boolean },
21
22
  db: { aliases: "-d", type: :boolean },
22
23
 
@@ -31,10 +32,20 @@ module Wordmove
31
32
 
32
33
  no_tasks do
33
34
  def handle_options(options)
34
- %w(wordpress uploads themes plugins languages db).map(&:to_sym).each do |task|
35
- yield task if options[task] || options[:all]
35
+ wordpress_options.each do |task|
36
+ yield task if options[task] || options["all"]
36
37
  end
37
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
38
49
  end
39
50
 
40
51
  desc "pull", "Pulls WP data from remote host to the local machine"
@@ -42,6 +53,7 @@ module Wordmove
42
53
  method_option option, args
43
54
  end
44
55
  def pull
56
+ ensure_wordpress_options_presence!(options)
45
57
  deployer = Wordmove::Deployer::Base.deployer_for(options)
46
58
  handle_options(options) do |task|
47
59
  deployer.send("pull_#{task}")
@@ -53,6 +65,7 @@ module Wordmove
53
65
  method_option option, args
54
66
  end
55
67
  def push
68
+ ensure_wordpress_options_presence!(options)
56
69
  deployer = Wordmove::Deployer::Base.deployer_for(options)
57
70
  handle_options(options) do |task|
58
71
  deployer.send("push_#{task}")
@@ -77,7 +77,7 @@ module Wordmove
77
77
 
78
78
  def remote_put_directory(directory); end
79
79
 
80
- %w(uploads themes plugins languages).each do |task|
80
+ %w(uploads themes plugins mu_plugins languages).each do |task|
81
81
  define_method "push_#{task}" do
82
82
  logger.task "Pushing #{task.titleize}"
83
83
  local_path = send("local_#{task}_dir").path
@@ -149,6 +149,7 @@ module Wordmove
149
149
  [
150
150
  WordpressDirectory::PATH::WP_CONTENT,
151
151
  WordpressDirectory::PATH::PLUGINS,
152
+ WordpressDirectory::PATH::MU_PLUGINS,
152
153
  WordpressDirectory::PATH::THEMES,
153
154
  WordpressDirectory::PATH::UPLOADS,
154
155
  WordpressDirectory::PATH::LANGUAGES
@@ -179,8 +180,11 @@ module Wordmove
179
180
  if options[:charset].present?
180
181
  command << "--default-character-set=#{Shellwords.escape(options[:charset])}"
181
182
  end
182
- command << Shellwords.escape(options[:name])
183
183
  command << "--result-file=#{Shellwords.escape(save_to_path)}"
184
+ if options[:mysqldump_options].present?
185
+ command << Shellwords.split(options[:mysqldump_options])
186
+ end
187
+ command << Shellwords.escape(options[:name])
184
188
  puts command.join(" ")
185
189
  command.join(" ")
186
190
  end
@@ -202,6 +206,21 @@ module Wordmove
202
206
  command.join(" ")
203
207
  end
204
208
 
209
+ def compress_command(path)
210
+ command = ["gzip"]
211
+ command << "--best"
212
+ command << Shellwords.escape(path)
213
+ puts command.join(" ")
214
+ command.join(" ")
215
+ end
216
+
217
+ def uncompress_command(path)
218
+ command = ["gunzip"]
219
+ command << Shellwords.escape(path)
220
+ puts command.join(" ")
221
+ command.join(" ")
222
+ end
223
+
205
224
  def rm_command(path)
206
225
  "rm #{Shellwords.escape(path)}"
207
226
  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
- local_backup_path = local_wp_content_dir.path("#{environment}-backup-#{Time.now.to_i}.sql")
15
- download_remote_db(local_backup_path)
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
- import_remote_dump(local_dump_path)
20
- run rm_command(local_dump_path)
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(local_dump_path)
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)
@@ -53,18 +60,23 @@ module Wordmove
53
60
  end
54
61
  end
55
62
 
56
- def download_remote_db(local_dump_path)
63
+ def download_remote_db(local_gizipped_dump_path)
57
64
  remote_dump_path = remote_wp_content_dir.path("dump.sql")
58
65
  # dump remote db into file
59
66
  remote_run mysql_dump_command(remote_options[:database], remote_dump_path)
67
+ remote_run compress_command(remote_dump_path)
68
+ remote_dump_path += '.gz'
60
69
  # download remote dump
61
- remote_get(remote_dump_path, local_dump_path)
70
+ remote_get(remote_dump_path, local_gizipped_dump_path)
62
71
  remote_delete(remote_dump_path)
63
72
  end
64
73
 
65
- def import_remote_dump(local_dump_path)
74
+ def import_remote_dump(local_gizipped_dump_path)
66
75
  remote_dump_path = remote_wp_content_dir.path("dump.sql")
67
- remote_put(local_dump_path, remote_dump_path)
76
+ remote_gizipped_dump_path = remote_dump_path + '.gz'
77
+
78
+ remote_put(local_gizipped_dump_path, remote_gizipped_dump_path)
79
+ remote_run uncompress_command(remote_gizipped_dump_path)
68
80
  remote_run mysql_import_command(remote_dump_path, remote_options[:database])
69
81
  remote_delete(remote_dump_path)
70
82
  end
@@ -18,6 +18,7 @@ production:
18
18
  password: "password"
19
19
  host: "host"
20
20
  # port: "3308" # Use just in case you have exotic server config
21
+ # mysqldump_options: "--max_allowed_packet=1G" # Only available if using SSH
21
22
 
22
23
  exclude:
23
24
  - ".git/"
@@ -35,6 +36,7 @@ production:
35
36
  # wp_content: "wp-content"
36
37
  # uploads: "wp-content/uploads"
37
38
  # plugins: "wp-content/plugins"
39
+ # mu_plugins: "wp-content/mu-plugins"
38
40
  # themes: "wp-content/themes"
39
41
  # languages: "wp-content/languages"
40
42
 
@@ -58,4 +60,3 @@ production:
58
60
 
59
61
  # staging: # multiple environments can be specified
60
62
  # [...]
61
-
@@ -1,3 +1,3 @@
1
1
  module Wordmove
2
- VERSION = "1.4.0.pre5".freeze
2
+ VERSION = "1.4.0.pre6".freeze
3
3
  end
@@ -3,6 +3,7 @@ WordpressDirectory = Struct.new(:type, :options) do
3
3
  WP_CONTENT = :wp_content
4
4
  WP_CONFIG = :wp_config
5
5
  PLUGINS = :plugins
6
+ MU_PLUGINS = :mu_plugins
6
7
  THEMES = :themes
7
8
  UPLOADS = :uploads
8
9
  LANGUAGES = :languages
@@ -12,6 +13,7 @@ WordpressDirectory = Struct.new(:type, :options) do
12
13
  PATH::WP_CONTENT => 'wp-content',
13
14
  PATH::WP_CONFIG => 'wp-config.php',
14
15
  PATH::PLUGINS => 'wp-content/plugins',
16
+ PATH::MU_PLUGINS => 'wp-content/mu-plugins',
15
17
  PATH::THEMES => 'wp-content/themes',
16
18
  PATH::UPLOADS => 'wp-content/uploads',
17
19
  PATH::LANGUAGES => 'wp-content/languages'
data/wordmove.gemspec CHANGED
@@ -41,4 +41,12 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "pry-byebug", "~> 3.1"
42
42
  spec.add_development_dependency "priscilla", "~> 1.0"
43
43
  spec.add_development_dependency "rubocop", "~> 0.37.0"
44
+ spec.add_development_dependency "gem-release"
45
+
46
+ spec.post_install_message = <<-RAINBOW
47
+ Starting from 1.4.0 Wordmove will compress SQL dumps both in remote and locale environments.
48
+ If something will broke, please check if gzip and gunzip executables are present locally and
49
+ remotely. We are considering obviuos they are installed in any web environment.
50
+ Open an issue on github at your needs.
51
+ RAINBOW
44
52
  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.pre5
4
+ version: 1.4.0.pre6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2016-02-05 00:00:00.000000000 Z
14
+ date: 2016-02-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: colorize
@@ -167,6 +167,20 @@ dependencies:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
169
  version: 0.37.0
170
+ - !ruby/object:Gem::Dependency
171
+ name: gem-release
172
+ requirement: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
170
184
  description: Wordmove deploys your WordPress websites at the speed of light.
171
185
  email:
172
186
  - stefano.verna@welaika.com
@@ -216,7 +230,11 @@ homepage: https://github.com/welaika/wordmove
216
230
  licenses:
217
231
  - MIT
218
232
  metadata: {}
219
- post_install_message:
233
+ post_install_message: |2
234
+ Starting from 1.4.0 Wordmove will compress SQL dumps both in remote and locale environments.
235
+ If something will broke, please check if gzip and gunzip executables are present locally and
236
+ remotely. We are considering obviuos they are installed in any web environment.
237
+ Open an issue on github at your needs.
220
238
  rdoc_options: []
221
239
  require_paths:
222
240
  - lib
@@ -232,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
250
  version: 1.3.1
233
251
  requirements: []
234
252
  rubyforge_project:
235
- rubygems_version: 2.5.1
253
+ rubygems_version: 2.4.5.1
236
254
  signing_key:
237
255
  specification_version: 4
238
256
  summary: Wordmove, Capistrano for Wordpress