Skip to content

Commit 8922944

Browse files
authored
Merge pull request #82 from SparkPost/deploy
Update deploy script to check version in constant
2 parents d6d1cd9 + 80f6934 commit 8922944

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

.svnignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ bin
88
phpunit.xml.dist
99
.travis.yml
1010
coverage
11+
.coveralls.yml

admin.widget.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function test_email_sending($recipient, $debug = false)
8787
$this->render_message('Test email sent successfully', 'updated');
8888
}
8989
} else {
90-
$this->render_message('Test email could not be sent. Please check your plugin settings and refer to <a href="https://support.sparkpost.com/customer/en/portal/topics/770787-getting-started/articles" target="_blank">Getting Started</a> in the <a href="https://support.sparkpost.com/" target="_blank">SparkPost Support Center</a>.');
90+
$this->render_message('Test email could not be sent. Please check your plugin settings and refer to <a href="https://support.sparkpost.com/customer/portal/articles/2670627-sparkpost-new-user-guide" target="_blank">Getting Started</a> in the <a href="https://support.sparkpost.com/" target="_blank">SparkPost Support Center</a>.');
9191
}
9292
}
9393

deploy.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ SVNUSER="sparkpost" # your svn username
1818

1919
# Let's begin...
2020
echo ".........................................."
21-
echo
21+
echo
2222
echo "Preparing to deploy wordpress plugin"
23-
echo
23+
echo
2424
echo ".........................................."
25-
echo
25+
echo
2626

2727
# Check if subversion is installed before getting all worked up
2828
if ! which svn >/dev/null; then
@@ -35,15 +35,20 @@ NEWVERSION1=`grep "^Stable tag:" $GITPATH/readme.txt | awk -F' ' '{print $NF}'`
3535
echo "readme.txt version: $NEWVERSION1"
3636
NEWVERSION2=`grep "^Version:" $GITPATH/$MAINFILE | awk -F' ' '{print $NF}'`
3737
echo "$MAINFILE version: $NEWVERSION2"
38+
NEWVERSION3=`grep "^define('WPSP_PLUGIN_VERSION', '2.5.0');" $GITPATH/wordpress-sparkpost.php | awk -F"'" '{print $4}'`
39+
echo "$MAINFILE version constant : $NEWVERSION3"
3840

39-
if [ "$NEWVERSION1" != "$NEWVERSION2" ]; then echo "Version in readme.txt & $MAINFILE don't match. Exiting...."; exit 1; fi
41+
if [[ "$NEWVERSION1" != "$NEWVERSION2" || "$NEWVERSION2" != "$NEWVERSION3" ]]; then
42+
echo "Version in readme.txt, $MAINFILE (in comment or constant) don't match. Exiting....";
43+
exit 1
44+
fi
4045

4146
echo "Versions match in readme.txt and $MAINFILE. Let's proceed..."
4247

4348
if git show-ref --tags --quiet --verify -- "refs/tags/$NEWVERSION1"
44-
then
45-
echo "Version $NEWVERSION1 already exists as git tag. Exiting....";
46-
exit 1;
49+
then
50+
echo "Version $NEWVERSION1 already exists as git tag. Exiting....";
51+
exit 1;
4752
else
4853
echo "Git version does not exist. Let's proceed..."
4954
fi
@@ -60,7 +65,7 @@ echo "Pushing latest commit to origin, with tags"
6065
git push origin master
6166
git push origin master --tags
6267

63-
echo
68+
6469
echo "Creating local copy of SVN repo ..."
6570
if [ -d $SVNPATH ]; then rm -rf $SVNPATH; fi
6671
svn co $SVNURL $SVNPATH

mailer.smtp.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function configure_phpmailer($phpmailer) {
2222
return;
2323
}
2424

25-
$tracking_enabled = (bool) $settings['enable_tracking'];
25+
$tracking_enabled = $settings['enable_tracking'];
2626
$x_msys_api = array(
2727
'options' => array (
2828
'open_tracking' => (bool) apply_filters('wpsp_open_tracking', $tracking_enabled),
@@ -39,7 +39,7 @@ public function configure_phpmailer($phpmailer) {
3939
$phpmailer->Username = 'SMTP_Injection';
4040
$phpmailer->Password = apply_filters('wpsp_api_key', $settings['password']);
4141

42-
$json_x_msys_api = apply_filters('wpsp_smtp_msys_api', json_encode($x_msys_api));
43-
$phpmailer->addCustomHeader('X-MSYS-API', $json_x_msys_api);
42+
$json_x_msys_api = apply_filters('wpsp_smtp_msys_api', $x_msys_api);
43+
$phpmailer->addCustomHeader('X-MSYS-API', json_encode($json_x_msys_api));
4444
}
4545
}

0 commit comments

Comments
 (0)