Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit adb2163

Browse files
committed
Code style cleanup.
1 parent 8a290bd commit adb2163

File tree

3 files changed

+78
-16
lines changed

3 files changed

+78
-16
lines changed

deployotron.actions.inc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ namespace Deployotron {
5959
drush_print('Commands');
6060
drush_print('--------');
6161
foreach (static::$actionMapping as $name => $actions) {
62-
drush_print(wordwrap(dt("@name runs the actions: @actions", array('@name' => $name, '@actions' => implode(', ', $actions)))));
62+
drush_print(wordwrap(dt('@name runs the actions: @actions', array(
63+
'@name' => $name,
64+
'@actions' => implode(', ', $actions),
65+
))));
6366
drush_print();
6467

6568
$all_actions = array_merge($all_actions, $actions);
@@ -131,6 +134,9 @@ namespace Deployotron {
131134
*/
132135
static protected $headShas = array();
133136

137+
/**
138+
* Get help description.
139+
*/
134140
public static function getHelp() {
135141
if (isset(static::$help)) {
136142
return static::$help;
@@ -418,7 +424,8 @@ namespace Deployotron {
418424
*
419425
* This is based on options from configuration or command.
420426
*
421-
* @return string The SHA to deploy.
427+
* @return string
428+
* The SHA to deploy.
422429
*/
423430
protected function pickSha($options = array()) {
424431
$options += array(

deployotron.drush.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ function drush_deployotron_run_validate($name, $site_alias = NULL) {
132132
function drush_deployotron_run($name, $site_alias) {
133133
global $_deployotron_actions, $_deployotron_rollbacks;
134134
$_deployotron_rollbacks = array();
135-
$site = drush_sitealias_get_record($site_alias);
136135

137136
$message = "About to:\n\n";
138137
$i = 1;

tests/deployotronTest.php

Lines changed: 69 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,26 @@ public function testErrors() {
172172
$this->drush('cc', array('drush'), array(), NULL, $this->webroot());
173173

174174
// No alias error message.
175-
$this->drush('deploy 2>&1', array(), array('y' => TRUE, 'branch' => '', 'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0'), NULL, $this->webroot(), self::EXIT_ERROR);
175+
$this->drush('deploy 2>&1', array(), array(
176+
'y' => TRUE,
177+
'branch' => '',
178+
'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0',
179+
), NULL, $this->webroot(), self::EXIT_ERROR);
176180
$this->assertRegExp('/No alias given/', $this->getOutput());
177181

178182
// Bad alias error.
179-
$this->drush('deploy 2>&1', array('@badalias'), array('y' => TRUE, 'branch' => '', 'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0'), NULL, $this->webroot(), self::EXIT_ERROR);
183+
$this->drush('deploy 2>&1', array('@badalias'), array(
184+
'y' => TRUE, 'branch' => '',
185+
'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0',
186+
), NULL, $this->webroot(), self::EXIT_ERROR);
180187
$this->assertRegExp('/Invalid alias/', $this->getOutput());
181188

182189
// Also check that aborting works.
183-
$this->drush('deploy 2>&1', array('@deployotron'), array('n' => TRUE, 'branch' => '', 'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0'), NULL, $this->webroot());
190+
$this->drush('deploy 2>&1', array('@deployotron'), array(
191+
'n' => TRUE,
192+
'branch' => '',
193+
'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0',
194+
), NULL, $this->webroot());
184195
$this->assertRegExp('/Aborting/', $this->getOutput());
185196
$this->assertNotRegExp('/Done/', $this->getOutput());
186197
}
@@ -203,15 +214,30 @@ public function testBasic() {
203214
$this->assertFileExists($this->deploySite() . '/VERSION.txt');
204215

205216
// Check that a invalid tag/branch prints the proper error message.
206-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'tag' => 'slipstream', 'sha' => ''), NULL, $this->webroot(), self::EXIT_ERROR);
217+
$this->drush('deploy 2>&1', array('@deployotron'), array(
218+
'y' => TRUE,
219+
'branch' => '',
220+
'tag' => 'slipstream',
221+
'sha' => '',
222+
), NULL, $this->webroot(), self::EXIT_ERROR);
207223
$this->assertRegExp('/Error finding SHA for tag/', $this->getOutput());
208224

209225
// Check that a invalid SHA prints the proper error message.
210-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'tag' => '', 'sha' => 'deadc0de'), NULL, $this->webroot(), self::EXIT_ERROR);
226+
$this->drush('deploy 2>&1', array('@deployotron'), array(
227+
'y' => TRUE,
228+
'branch' => '',
229+
'tag' => '',
230+
'sha' => 'deadc0de',
231+
), NULL, $this->webroot(), self::EXIT_ERROR);
211232
$this->assertRegExp('/Unknown SHA/', $this->getOutput());
212233

213234
// Check that missing branch/tag/sha prints the proper error message.
214-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'tag' => '', 'sha' => ''), NULL, $this->webroot(), self::EXIT_ERROR);
235+
$this->drush('deploy 2>&1', array('@deployotron'), array(
236+
'y' => TRUE,
237+
'branch' => '',
238+
'tag' => '',
239+
'sha' => '',
240+
), NULL, $this->webroot(), self::EXIT_ERROR);
215241
$this->assertRegExp('/You must provide at least one of --branch, --tag or --sha/', $this->getOutput());
216242

217243
// Check that a dirty checkout makes deployment fail..
@@ -227,7 +253,11 @@ public function testBasic() {
227253
// Fix the the checkout and check that we can now deploy, and throw in
228254
// no-confirm for coverage.
229255
exec('cd ' . $this->deploySite() . ' && git reset --hard');
230-
$this->drush('deploy 2>&1', array('@deployotron'), array('no-confirm' => TRUE, 'branch' => '', 'sha' => 'b9471948c3f83a665dd4f106aba3de8962d69b42'), NULL, $this->webroot());
256+
$this->drush('deploy 2>&1', array('@deployotron'), array(
257+
'no-confirm' => TRUE,
258+
'branch' => '',
259+
'sha' => 'b9471948c3f83a665dd4f106aba3de8962d69b42',
260+
), NULL, $this->webroot());
231261
$this->assertRegExp('/HEAD now at b9471948c3f83a665dd4f106aba3de8962d69b42/', $this->getOutput());
232262

233263
// VERSION.txt should still exist.
@@ -328,7 +358,11 @@ public function testOmg() {
328358
$this->drush('cc', array('drush'), array(), NULL, $this->webroot());
329359

330360
// Start with a simple deployment.
331-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0'), NULL, $this->webroot());
361+
$this->drush('deploy 2>&1', array('@deployotron'), array(
362+
'y' => TRUE,
363+
'branch' => '',
364+
'sha' => '04256b5992d8b4a4fae25c7cb7888583749fabc0',
365+
), NULL, $this->webroot());
332366
$this->assertRegExp('/HEAD now at 04256b5992d8b4a4fae25c7cb7888583749fabc0/', $this->getOutput());
333367

334368
// Set a variable.
@@ -338,7 +372,11 @@ public function testOmg() {
338372
$this->assertRegExp("/magic_variable: .bumblebee./", $this->getOutput());
339373

340374
// Deploy another version.
341-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'sha' => 'b9471948c3f83a665dd4f106aba3de8962d69b42'), NULL, $this->webroot());
375+
$this->drush('deploy 2>&1', array('@deployotron'), array(
376+
'y' => TRUE,
377+
'branch' => '',
378+
'sha' => 'b9471948c3f83a665dd4f106aba3de8962d69b42',
379+
), NULL, $this->webroot());
342380
$this->assertRegExp('/HEAD now at b9471948c3f83a665dd4f106aba3de8962d69b42/', $this->getOutput());
343381

344382
// And a third time.
@@ -437,7 +475,11 @@ public function testNoDeploy() {
437475
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE), NULL, $this->webroot());
438476
$this->assertRegExp('/HEAD now at fbcaa29d45716edcbedc3c325bfbab828f1ce838/', $this->getOutput());
439477

440-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'no-deploy' => TRUE, 'flowdock-token' => $this->flowdockToken), NULL, $this->webroot());
478+
$this->drush('deploy 2>&1', array('@deployotron'), array(
479+
'y' => TRUE,
480+
'no-deploy' => TRUE,
481+
'flowdock-token' => $this->flowdockToken,
482+
), NULL, $this->webroot());
441483
// Check VERSION.txt message.
442484
$this->assertRegExp('/No version deployed, not creating\/updating VERSION.txt/', $this->getOutput());
443485

@@ -466,7 +508,12 @@ public function testDumpFilePurging() {
466508
// any.
467509
foreach (range(1, 2) as $num) {
468510
foreach ($shas as $sha) {
469-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'sha' => $sha, 'num-dumps' => 0), NULL, $this->webroot());
511+
$this->drush('deploy 2>&1', array('@deployotron'), array(
512+
'y' => TRUE,
513+
'branch' => '',
514+
'sha' => $sha,
515+
'num-dumps' => 0,
516+
), NULL, $this->webroot());
470517
$this->assertRegExp('/HEAD now at ' . $sha . '/', $this->getOutput());
471518
$this->assertRegExp('/Not purging any dumps/', $this->getOutput());
472519
$expected_num_dumps++;
@@ -481,7 +528,11 @@ public function testDumpFilePurging() {
481528
$expected_dumps = array_slice($dumps, 0, 4);
482529

483530
// Don't specify num-dumps, which should default to 5.
484-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'sha' => $sha), NULL, $this->webroot());
531+
$this->drush('deploy 2>&1', array('@deployotron'), array(
532+
'y' => TRUE,
533+
'branch' => '',
534+
'sha' => $sha,
535+
), NULL, $this->webroot());
485536
$this->assertRegExp('/HEAD now at ' . $sha . '/', $this->getOutput());
486537
$this->assertRegExp('/Purge the following dump files/', $this->getOutput());
487538
$this->assertCount(5, $this->fileList($this->dumpPath()));
@@ -495,7 +546,12 @@ public function testDumpFilePurging() {
495546
$expected_dumps = array_slice($dumps, 0, 2);
496547

497548
// And again with a specified num-dumps.
498-
$this->drush('deploy 2>&1', array('@deployotron'), array('y' => TRUE, 'branch' => '', 'sha' => $sha, 'num-dumps' => 3), NULL, $this->webroot());
549+
$this->drush('deploy 2>&1', array('@deployotron'), array(
550+
'y' => TRUE,
551+
'branch' => '',
552+
'sha' => $sha,
553+
'num-dumps' => 3,
554+
), NULL, $this->webroot());
499555
$this->assertRegExp('/HEAD now at ' . $sha . '/', $this->getOutput());
500556
$this->assertRegExp('/Purge the following dump files/', $this->getOutput());
501557
$this->assertCount(3, $this->fileList($this->dumpPath()));

0 commit comments

Comments
 (0)