Skip to content

Commit 3a2f2bf

Browse files
committed
1.3.1 + Messages + Hints
1 parent 833a31d commit 3a2f2bf

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
### 1.3.1: 03/11/2020
6+
7+
* Added welcome and connection success messages
8+
* Added hints to checks
9+
510
### 1.3.0: 01/11/2020
611

712
* Added connection checks

wp-cli-sync.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: WP-CLI Sync
44
Description: A WP-CLI command for syncing a live site to a development environment
5-
Version: 1.3.0
5+
Version: 1.3.1
66
Author: Jon Beaumont-Pike
77
Author URI: https://jonbp.co.uk/
88
License: MIT License
@@ -60,6 +60,9 @@ function lb_cr() {
6060
$ssh_username = $_ENV['LIVE_SSH_USERNAME'];
6161
$rem_proj_loc = $_ENV['REMOTE_PROJECT_LOCATION'];
6262

63+
// Welcome
64+
task_message('Running .env file and connection checks...', 'WP-CLI Sync', 97);
65+
6366
/**
6467
* BEGIN VAR / CONNECTION CHECKS
6568
*/
@@ -68,7 +71,7 @@ function lb_cr() {
6871
if (empty($ssh_hostname) || empty($ssh_username) || empty($rem_proj_loc)) {
6972

7073
// Exit Messages
71-
task_message('some/all dev sync vars are not set in .env file', 'Error', 31);
74+
task_message('some/all dev sync vars are not set in .env file', 'Error', 31, false);
7275

7376
// Line Break + Color Reset + Exit
7477
lb_cr();
@@ -80,7 +83,8 @@ function lb_cr() {
8083
if(($rem_proj_loc[0] != '/') && ($rem_proj_loc[0] != '~')) {
8184

8285
// Exit Messages
83-
task_message('Incorrect formatting of the REMOTE_PROJECT_LOCATION variable', 'Error', 31);
86+
task_message('Incorrect formatting of the REMOTE_PROJECT_LOCATION variable', 'Error', 31, false);
87+
task_message('Ensure that the path begins with either / or ~/', 'Hint', 33);
8488

8589
// Line Break + Color Reset + Exit
8690
lb_cr();
@@ -91,7 +95,8 @@ function lb_cr() {
9195
if($rem_proj_loc[1] != '/') {
9296

9397
// Exit Messages
94-
task_message('Incorrect formatting of the REMOTE_PROJECT_LOCATION variable', 'Error', 31);
98+
task_message('Incorrect formatting of the REMOTE_PROJECT_LOCATION variable', 'Error', 31, false);
99+
task_message('Ensure that the path begins with either / or ~/', 'Hint', 33);
95100

96101
// Line Break + Color Reset + Exit
97102
lb_cr();
@@ -108,7 +113,8 @@ function lb_cr() {
108113
if ($live_server_status == '255') {
109114

110115
// Exit Messages
111-
task_message('Cannot connect to live server over SSH', 'Error', 31);
116+
task_message('Cannot connect to live server over SSH', 'Error', 31, false);
117+
task_message('Check that your LIVE_SSH_HOSTNAME and LIVE_SSH_USERNAME variables are correct', 'Hint', 33);
112118

113119
// Line Break + Color Reset + Exit
114120
lb_cr();
@@ -123,15 +129,18 @@ function lb_cr() {
123129
if ($live_server_check == 'false') {
124130

125131
// Exit Messages
126-
task_message('Connected but cannot find remote WP-CLI', 'Error', 31);
127-
task_message('Either WP-CLI Sync is not installed on the live server or the path to your project is incorrect', 'Notice');
132+
task_message('Connected but cannot find remote WP-CLI', 'Error', 31, false);
133+
task_message('Either WP-CLI Sync is not installed on the live server or the REMOTE_PROJECT_LOCATION variable is incorrect', 'Hint', 33);
128134

129135
// Line Break + Color Reset + Exit
130136
lb_cr();
131137
exit();
132138

133139
}
134140

141+
// Checks Success
142+
task_message('Running sync...', 'Connected', 32, false);
143+
135144
// Plugin Vars
136145
$dev_activated_plugins = $_ENV['DEV_ACTIVATED_PLUGINS'];
137146
$dev_deactivated_plugins = $_ENV['DEV_DEACTIVATED_PLUGINS'];

0 commit comments

Comments
 (0)