wordmove 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74eb302bd31e07710d405885e8a6bdcc5a038334
4
- data.tar.gz: db2cd9c305231c49d29d7f907f4e98020a3f3f5a
3
+ metadata.gz: 7b44325c0d09d56d3a59080721d52ef65d301116
4
+ data.tar.gz: 5fbb645e7df0d2ec0b66773c0c52c5523ec25131
5
5
  SHA512:
6
- metadata.gz: 36c47235b3f558e184e1650d02f79c6dee5d5da9f177fea5fb9a21f3594bfcba12d6ec9685132586505ba12d6c55d4c9ae6a9442374e6bc861fce04653a815e6
7
- data.tar.gz: b6df4544d36d308d53c3b38fa129206b1d774be301154ea1440f6aac9739bb4d5d7dc50dc5cd26b1b61cf6a0bf5d12dc45be2aa8aac48b665c50dceb237b4e86
6
+ metadata.gz: 8112d61e266fb7b83227463dcd70e6160a006bbfa19cbf1405502783a7a0ddcb4ee8b4d8a28df9ee2d88cd9f93c7bdc962926e2da1296444fb7dff83b770f464
7
+ data.tar.gz: 0f07783014805087b720a9b11b48fc7fda2a79e3b6ab0f8eca31ad75ac3d82f7b6d07c9434f393ab94b4b8924c16bfc38e324e3e550625afa09f24981a4bcec6
@@ -12,6 +12,7 @@ Think of it like Capistrano for Wordpress, complete with push/pull capabilities.
12
12
 
13
13
  [![Build Status](https://travis-ci.org/welaika/wordmove.png?branch=master)](https://travis-ci.org/welaika/wordmove)
14
14
  [![Slack channel](https://img.shields.io/badge/Slack-WP--Hub-blue.svg)](https://wphub-auto-invitation.herokuapp.com/)
15
+ [![Gem Version](https://badge.fury.io/rb/wordmove.svg)](https://rubygems.org/gems/wordmove)
15
16
 
16
17
  ## Installation
17
18
 
@@ -64,54 +65,54 @@ You can configure Wordmove creating a `movefile.yml`. That's just a YAML file wi
64
65
 
65
66
  ```yaml
66
67
  global:
67
- sql_adapter: "default"
68
+ sql_adapter: default
68
69
 
69
70
  local:
70
- vhost: "http://vhost.local"
71
- wordpress_path: "/home/john/sites/your_site" # use an absolute path here
71
+ vhost: http://vhost.local
72
+ wordpress_path: /home/john/sites/your_site # use an absolute path here
72
73
 
73
74
  database:
74
- name: "database_name"
75
- user: "user"
76
- password: "password"
77
- host: "127.0.0.1"
75
+ name: database_name
76
+ user: user
77
+ password: password
78
+ host: localhost
78
79
 
79
80
  # paths: # you can customize wordpress internal paths
80
- # wp_content: "wp-content"
81
- # uploads: "wp-content/uploads"
82
- # plugins: "wp-content/plugins"
83
- # themes: "wp-content/themes"
84
- # languages: "wp-content/languages"
81
+ # wp_content: wp-content
82
+ # uploads: wp-content/uploads
83
+ # plugins: wp-content/plugins
84
+ # themes: wp-content/themes
85
+ # languages: wp-content/languages
85
86
 
86
87
  production:
87
- vhost: "http://example.com"
88
- wordpress_path: "/var/www/your_site" # use an absolute path here
88
+ vhost: http://example.com
89
+ wordpress_path: /var/www/your_site # use an absolute path here
89
90
 
90
91
  database:
91
- name: "database_name"
92
- user: "user"
93
- password: "password"
94
- host: "host"
95
- # port: "3308" # Use just in case you have exotic server config
96
- # mysqldump_options: "--max_allowed_packet=50MB" # Only available if using SSH
92
+ name: database_name
93
+ user: user
94
+ password: password
95
+ host: host
96
+ # port: 3308 # Use just in case you have exotic server config
97
+ # mysqldump_options: --max_allowed_packet=50MB # Only available if using SSH
97
98
 
98
99
  exclude:
99
- - ".git/"
100
- - ".gitignore"
101
- - ".sass-cache/"
102
- - "bin/"
103
- - "tmp/*"
104
- - "Gemfile*"
105
- - "Movefile"
106
- - "movefile"
107
- - "movefile.yml"
108
- - "movefile.yaml"
109
- - "wp-config.php"
110
- - "wp-content/*.sql"
100
+ - .git/
101
+ - .gitignore
102
+ - .sass-cache/
103
+ - bin/
104
+ - tmp/*
105
+ - Gemfile*
106
+ - Movefile
107
+ - movefile
108
+ - movefile.yml
109
+ - movefile.yaml
110
+ - wp-config.php
111
+ - wp-content/*.sql
111
112
 
112
113
  ssh:
113
- host: "host"
114
- user: "user"
114
+ host: host
115
+ user: user
115
116
  ```
116
117
 
117
118
  **We warmly recommend to read the wiki article [Multiple environments explained
@@ -5,6 +5,7 @@ mapping:
5
5
  wordpress_path:
6
6
  database:
7
7
  type: map
8
+ required: true
8
9
  mapping:
9
10
  name:
10
11
  required: true
@@ -15,8 +16,5 @@ mapping:
15
16
  host:
16
17
  required: true
17
18
  mysqldump_options:
18
- required: false
19
19
  port:
20
- required: false
21
20
  charset:
22
- required: false
@@ -2,14 +2,13 @@ type: map
2
2
  mapping:
3
3
  vhost:
4
4
  type: str
5
- pattern: /^http:\/\//
5
+ pattern: /^https?:\/\//
6
6
  required: true
7
7
  wordpress_path:
8
8
  type: str
9
9
  required: true
10
10
  wordpress_absolute_path:
11
11
  type: str
12
- required: false
13
12
  database:
14
13
  type: map
15
14
  required: true
@@ -28,21 +27,16 @@ mapping:
28
27
  required: true
29
28
  mysqldump_options:
30
29
  type: str
31
- required: false
32
30
  port:
33
- type: str
34
- required: false
31
+ type: int
35
32
  charset:
36
33
  type: str
37
- required: false
38
34
  exclude:
39
35
  type: seq
40
- required: false
41
36
  sequence:
42
37
  - type: str
43
38
  paths:
44
39
  type: map
45
- required: false
46
40
  mapping:
47
41
  wp_content:
48
42
  wp_config:
@@ -53,20 +47,17 @@ mapping:
53
47
  languages:
54
48
  ssh:
55
49
  type: map
56
- required: false
57
50
  mapping:
58
51
  host:
59
52
  required: true
60
53
  user:
61
54
  required: false # If host is configured in ~/.ssh/config
62
55
  password:
63
- required: false
64
56
  port:
65
57
  type: int
66
58
  rsync_options:
67
59
  gateway:
68
60
  type: map
69
- required: false
70
61
  mapping:
71
62
  host:
72
63
  required: true
@@ -75,7 +66,6 @@ mapping:
75
66
  password:
76
67
  ftp:
77
68
  type: map
78
- required: false
79
69
  mapping:
80
70
  user:
81
71
  required: true
@@ -6,11 +6,21 @@ module Wordmove
6
6
 
7
7
  def initialize(name = nil, dir = '.')
8
8
  @movefile = Wordmove::Movefile.new
9
- @contents = movefile.fetch(name, dir)
10
- @root_keys = contents.keys
9
+
10
+ begin
11
+ @contents = movefile.fetch(name, dir)
12
+ @root_keys = contents.keys
13
+ rescue Psych::SyntaxError
14
+ movefile.logger.error "Your movefile is not parsable due to a syntax error"\
15
+ "so we can't continue to validate it."
16
+ movefile.logger.debug "You could try to use https://yamlvalidator.com/ to"\
17
+ "get a clue about the problem."
18
+ end
11
19
  end
12
20
 
13
21
  def validate!
22
+ return false unless root_keys
23
+
14
24
  MANDATORY_SECTIONS.each do |key|
15
25
  movefile.logger.task "Validating movefile section: #{key}"
16
26
  validate_mandatory_section(key)
@@ -4,13 +4,19 @@ module Wordmove
4
4
  attr_reader :config, :logger
5
5
 
6
6
  def initialize(movefile_name = nil, movefile_dir = '.')
7
- @config = Wordmove::Movefile.new.fetch(movefile_name, movefile_dir)["local"]["database"]
8
7
  @logger = Logger.new(STDOUT).tap { |l| l.level = Logger::INFO }
8
+ begin
9
+ @config = Wordmove::Movefile.new.fetch(movefile_name, movefile_dir)["local"]["database"]
10
+ rescue Psych::SyntaxError
11
+ return
12
+ end
9
13
  end
10
14
 
11
15
  def check!
12
16
  logger.task "Checking local database commands and connection"
13
17
 
18
+ return logger.error "Can't connect to mysql using your movefile.yml" if config.nil?
19
+
14
20
  mysql_client_doctor
15
21
  mysqldump_doctor
16
22
  mysql_server_doctor
@@ -10,12 +10,22 @@ module Wordmove
10
10
  def check!
11
11
  logger.task "Checking local wp-cli installation"
12
12
 
13
- if system('wp cli check-update --quiet')
13
+ if in_path? && up_to_date?
14
14
  logger.success "wp-cli is correctly installed and up to date"
15
15
  else
16
16
  logger.error "wp-cli is not installed (or not in your $PATH) or not up to date"
17
17
  end
18
18
  end
19
+
20
+ private
21
+
22
+ def in_path?
23
+ system('which wp', out: File::NULL)
24
+ end
25
+
26
+ def up_to_date?
27
+ `wp cli check-update --format=json`.empty?
28
+ end
19
29
  end
20
30
  end
21
31
  end
@@ -1,68 +1,68 @@
1
1
  global:
2
- sql_adapter: "default"
2
+ sql_adapter: default
3
3
 
4
4
  local:
5
- vhost: "http://vhost.local"
6
- wordpress_path: "<%= wordpress_path %>" # use an absolute path here
5
+ vhost: http://vhost.local
6
+ wordpress_path: <%= wordpress_path %> # use an absolute path here
7
7
 
8
8
  database:
9
- name: "<%= database.name %>"
10
- user: "<%= database.user %>"
11
- password: "<%= database.password %>"
12
- host: "<%= database.host %>"
9
+ name: <%= database.name %>
10
+ user: <%= database.user %>
11
+ password: "<%= database.password %>" # could be blank, so always use quotes around
12
+ host: <%= database.host %>
13
13
 
14
14
  production:
15
- vhost: "http://example.com"
16
- wordpress_path: "/var/www/your_site" # use an absolute path here
15
+ vhost: http://example.com
16
+ wordpress_path: /var/www/your_site # use an absolute path here
17
17
 
18
18
  database:
19
- name: "database_name"
20
- user: "user"
21
- password: "password"
22
- host: "host"
23
- # port: "3308" # Use just in case you have exotic server config
24
- # mysqldump_options: "--max_allowed_packet=1G" # Only available if using SSH
19
+ name: database_name
20
+ user: user
21
+ password: password
22
+ host: host
23
+ # port: 3308 # Use just in case you have exotic server config
24
+ # mysqldump_options: --max_allowed_packet=1G # Only available if using SSH
25
25
 
26
26
  exclude:
27
- - ".git/"
28
- - ".gitignore"
29
- - ".sass-cache/"
30
- - "node_modules/"
31
- - "bin/"
32
- - "tmp/*"
33
- - "Gemfile*"
34
- - "Movefile"
35
- - "movefile"
36
- - "movefile.yml"
37
- - "movefile.yaml"
38
- - "wp-config.php"
39
- - "wp-content/*.sql.gz"
27
+ - .git/
28
+ - .gitignore
29
+ - .sass-cache/
30
+ - node_modules/
31
+ - bin/
32
+ - tmp/*
33
+ - Gemfile*
34
+ - Movefile
35
+ - movefile
36
+ - movefile.yml
37
+ - movefile.yaml
38
+ - wp-config.php
39
+ - wp-content/*.sql.gz
40
40
 
41
41
  # paths: # you can customize wordpress internal paths
42
- # wp_content: "wp-content"
43
- # uploads: "wp-content/uploads"
44
- # plugins: "wp-content/plugins"
45
- # mu_plugins: "wp-content/mu-plugins"
46
- # themes: "wp-content/themes"
47
- # languages: "wp-content/languages"
42
+ # wp_content: wp-content
43
+ # uploads: wp-content/uploads
44
+ # plugins: wp-content/plugins
45
+ # mu_plugins: wp-content/mu-plugins
46
+ # themes: wp-content/themes
47
+ # languages: wp-content/languages
48
48
 
49
49
  # ssh:
50
- # host: "host"
51
- # user: "user"
52
- # password: "password" # password is optional, will use public keys if available.
50
+ # host: host
51
+ # user: user
52
+ # password: password # password is optional, will use public keys if available.
53
53
  # port: 22 # Port is optional
54
- # rsync_options: "--verbose" # Additional rsync options, optional
54
+ # rsync_options: --verbose # Additional rsync options, optional
55
55
  # gateway: # Gateway is optional
56
- # host: "host"
57
- # user: "user"
58
- # password: "password" # password is optional, will use public keys if available.
56
+ # host: host
57
+ # user: user
58
+ # password: password # password is optional, will use public keys if available.
59
59
 
60
60
  # ftp:
61
- # user: "user"
62
- # password: "password"
63
- # host: "host"
61
+ # user: user
62
+ # password: password
63
+ # host: host
64
64
  # passive: true
65
- # scheme: "ftps" # default "ftp"
65
+ # scheme: ftps # default ftp
66
66
 
67
67
  # staging: # multiple environments can be specified
68
68
  # [...]
@@ -4,10 +4,10 @@ module Wordmove
4
4
 
5
5
  def task(title)
6
6
  prefix = "▬" * 2
7
- title = " #{title} "
7
+ title = " #{title} "
8
8
  padding = "▬" * padding_length(title)
9
9
 
10
- puts "\n" + prefix + title.green + padding
10
+ puts "\n" + prefix + title.light_white + padding
11
11
  end
12
12
 
13
13
  def task_step(local_step, title)
@@ -19,15 +19,15 @@ module Wordmove
19
19
  end
20
20
 
21
21
  def error(message)
22
- puts " error".red + " | ".black + message.to_s
22
+ puts " error".red + " | ".black + message.to_s
23
23
  end
24
24
 
25
25
  def success(message)
26
- puts " success".green + " | ".black + message.to_s
26
+ puts " success".green + " | ".black + message.to_s
27
27
  end
28
28
 
29
29
  def debug(message)
30
- puts " debug".magenta + " | ".black + message.to_s
30
+ puts " debug".magenta + " | ".black + message.to_s
31
31
  end
32
32
 
33
33
  private
@@ -1,3 +1,3 @@
1
1
  module Wordmove
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.3.1".freeze
3
3
  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: 2.3.0
4
+ version: 2.3.1
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: 2017-12-09 00:00:00.000000000 Z
15
+ date: 2017-12-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport