From 12d4158b2b647456c52208b181aa07605305719f Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Tue, 9 Jul 2013 16:40:05 +0200 Subject: [PATCH 1/3] PSR2 fixes --- composer.lock | 16 ++++----- src/Rocketeer/Bash.php | 10 ++++-- src/Rocketeer/Commands/BaseDeployCommand.php | 1 - src/Rocketeer/Commands/BaseTaskCommand.php | 1 - src/Rocketeer/Commands/DeployCommand.php | 1 - .../Commands/DeployDeployCommand.php | 1 - .../Commands/DeployRollbackCommand.php | 1 - src/Rocketeer/Commands/DeployTestCommand.php | 1 - .../Commands/DeployUpdateCommand.php | 1 - src/Rocketeer/Facades/Rocketeer.php | 1 - src/Rocketeer/ReleasesManager.php | 1 - src/Rocketeer/Rocketeer.php | 8 ++--- src/Rocketeer/RocketeerServiceProvider.php | 24 +++++++------- src/Rocketeer/Scm/Git.php | 3 +- src/Rocketeer/Scm/Scm.php | 3 +- src/Rocketeer/Server.php | 5 ++- src/Rocketeer/Tasks/Abstracts/Task.php | 5 +-- src/Rocketeer/Tasks/Check.php | 1 - src/Rocketeer/Tasks/Cleanup.php | 1 - src/Rocketeer/Tasks/Closure.php | 1 - src/Rocketeer/Tasks/CurrentRelease.php | 1 - src/Rocketeer/Tasks/Deploy.php | 1 - src/Rocketeer/Tasks/Rollback.php | 1 - src/Rocketeer/Tasks/Setup.php | 5 +-- src/Rocketeer/Tasks/Teardown.php | 1 - src/Rocketeer/Tasks/Test.php | 1 - src/Rocketeer/Tasks/Update.php | 1 - src/Rocketeer/TasksQueue.php | 13 ++++---- tests/BashTest.php | 3 +- tests/ReleasesManagerTest.php | 1 - tests/RocketeerTest.php | 1 - tests/ServerTest.php | 1 - tests/TasksQueueTest.php | 16 ++++++--- tests/TasksTest.php | 9 +++-- tests/_start.php | 33 +++++++++++-------- 35 files changed, 83 insertions(+), 91 deletions(-) diff --git a/composer.lock b/composer.lock index 8430f43d4..e0cf068e5 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "d91f73c6db5eae7ca92978512acd702ca2235dd8" + "reference": "1613f0fecd258a5fab083d0570ff360fcfd4ca0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/d91f73c6db5eae7ca92978512acd702ca2235dd8", - "reference": "d91f73c6db5eae7ca92978512acd702ca2235dd8", + "url": "https://api.github.com/repos/illuminate/support/zipball/1613f0fecd258a5fab083d0570ff360fcfd4ca0c", + "reference": "1613f0fecd258a5fab083d0570ff360fcfd4ca0c", "shasum": "" }, "require": { @@ -52,7 +52,7 @@ "email": "taylorotwell@gmail.com" } ], - "time": "2013-07-05 02:48:37" + "time": "2013-07-09 02:35:44" } ], "packages-dev": [ @@ -107,12 +107,12 @@ "source": { "type": "git", "url": "https://github.com/illuminate/filesystem.git", - "reference": "6f6448af26ee0f14ed265cab36f8fd1cacb46811" + "reference": "fe9915c329ef869efccbc88334cf3ff89f2ecb03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/6f6448af26ee0f14ed265cab36f8fd1cacb46811", - "reference": "6f6448af26ee0f14ed265cab36f8fd1cacb46811", + "url": "https://api.github.com/repos/illuminate/filesystem/zipball/fe9915c329ef869efccbc88334cf3ff89f2ecb03", + "reference": "fe9915c329ef869efccbc88334cf3ff89f2ecb03", "shasum": "" }, "require": { @@ -144,7 +144,7 @@ "email": "taylorotwell@gmail.com" } ], - "time": "2013-06-13 04:24:12" + "time": "2013-07-02 17:46:50" }, { "name": "mockery/mockery", diff --git a/src/Rocketeer/Bash.php b/src/Rocketeer/Bash.php index 2c96000bd..fc5561e2f 100644 --- a/src/Rocketeer/Bash.php +++ b/src/Rocketeer/Bash.php @@ -123,7 +123,12 @@ public function run($commands, $silent = false, $array = false) */ public function runInFolder($folder = null, $tasks = array()) { - if (!is_array($tasks)) $tasks = array($tasks); + // Convert to array + if (!is_array($tasks)) { + $tasks = array($tasks); + } + + // Prepend folder array_unshift($tasks, 'cd '.$this->rocketeer->getFolder($folder)); return $this->run($tasks); @@ -287,7 +292,7 @@ public function runRemoteCommands($commands, $array = false) $output = null; // Run commands - $this->remote->run($commands, function($results) use (&$output) { + $this->remote->run($commands, function ($results) use (&$output) { $output .= $results; }); @@ -346,5 +351,4 @@ protected function processCommands($commands) return $commands; } - } diff --git a/src/Rocketeer/Commands/BaseDeployCommand.php b/src/Rocketeer/Commands/BaseDeployCommand.php index 3ef639faf..2974eed3f 100644 --- a/src/Rocketeer/Commands/BaseDeployCommand.php +++ b/src/Rocketeer/Commands/BaseDeployCommand.php @@ -51,5 +51,4 @@ protected function getOptions() array('stage', 'S', InputOption::VALUE_REQUIRED, 'The stage to execute the Task in') ); } - } diff --git a/src/Rocketeer/Commands/BaseTaskCommand.php b/src/Rocketeer/Commands/BaseTaskCommand.php index 8129d2e8d..d2f96447e 100644 --- a/src/Rocketeer/Commands/BaseTaskCommand.php +++ b/src/Rocketeer/Commands/BaseTaskCommand.php @@ -46,5 +46,4 @@ public function fire() { return $this->fireTasksQueue($this->task); } - } diff --git a/src/Rocketeer/Commands/DeployCommand.php b/src/Rocketeer/Commands/DeployCommand.php index 72cc33338..cf19c4650 100644 --- a/src/Rocketeer/Commands/DeployCommand.php +++ b/src/Rocketeer/Commands/DeployCommand.php @@ -25,5 +25,4 @@ public function fire() { $this->line('Rocketeer version '.Rocketeer::VERSION.''); } - } diff --git a/src/Rocketeer/Commands/DeployDeployCommand.php b/src/Rocketeer/Commands/DeployDeployCommand.php index f1cf106ad..501d407bf 100644 --- a/src/Rocketeer/Commands/DeployDeployCommand.php +++ b/src/Rocketeer/Commands/DeployDeployCommand.php @@ -49,5 +49,4 @@ protected function getOptions() array('seed', 's', InputOption::VALUE_NONE, 'Seed the database after migrating the database'), )); } - } diff --git a/src/Rocketeer/Commands/DeployRollbackCommand.php b/src/Rocketeer/Commands/DeployRollbackCommand.php index adedacb23..1619df830 100644 --- a/src/Rocketeer/Commands/DeployRollbackCommand.php +++ b/src/Rocketeer/Commands/DeployRollbackCommand.php @@ -44,5 +44,4 @@ protected function getArguments() array('release', InputArgument::OPTIONAL, 'The release to rollback to'), ); } - } diff --git a/src/Rocketeer/Commands/DeployTestCommand.php b/src/Rocketeer/Commands/DeployTestCommand.php index b0fed99f7..b021f7379 100644 --- a/src/Rocketeer/Commands/DeployTestCommand.php +++ b/src/Rocketeer/Commands/DeployTestCommand.php @@ -31,5 +31,4 @@ public function fire() $this->input->setOption('verbose', true); return $this->fireTasksQueue('Rocketeer\Tasks\Test'); } - } diff --git a/src/Rocketeer/Commands/DeployUpdateCommand.php b/src/Rocketeer/Commands/DeployUpdateCommand.php index a03b8eb02..080dcf4ea 100644 --- a/src/Rocketeer/Commands/DeployUpdateCommand.php +++ b/src/Rocketeer/Commands/DeployUpdateCommand.php @@ -45,5 +45,4 @@ protected function getOptions() array('seed', 's', InputOption::VALUE_NONE, 'Seed the database after migrating the database'), )); } - } diff --git a/src/Rocketeer/Facades/Rocketeer.php b/src/Rocketeer/Facades/Rocketeer.php index 872b65e95..d32a9c82f 100644 --- a/src/Rocketeer/Facades/Rocketeer.php +++ b/src/Rocketeer/Facades/Rocketeer.php @@ -18,5 +18,4 @@ protected static function getFacadeAccessor() { return 'rocketeer.tasks'; } - } diff --git a/src/Rocketeer/ReleasesManager.php b/src/Rocketeer/ReleasesManager.php index fa123f512..7a9d86cef 100644 --- a/src/Rocketeer/ReleasesManager.php +++ b/src/Rocketeer/ReleasesManager.php @@ -136,5 +136,4 @@ public function updateCurrentRelease($release) { $this->app['rocketeer.server']->setValue('current_release', $release); } - } diff --git a/src/Rocketeer/Rocketeer.php b/src/Rocketeer/Rocketeer.php index 56dd3079d..cdea5c04b 100644 --- a/src/Rocketeer/Rocketeer.php +++ b/src/Rocketeer/Rocketeer.php @@ -170,8 +170,7 @@ public function getRepository($username = null, $password = null) if ($username or $password) { // Build credentials chain - $credentials = $username; - if ($password) $credentials .= ':'.$password; + $credentials = $password ? $username.':'.$password : $username; $credentials .= '@'; // Add them in chain @@ -211,7 +210,9 @@ public function getRepositoryBranch() public function getFolder($folder = null) { $base = $this->getHomeFolder().'/'; - if ($folder and $this->stage) $base .= $this->stage.'/'; + if ($folder and $this->stage) { + $base .= $this->stage.'/'; + } $folder = str_replace($base, null, $folder); return $base.$folder; @@ -229,5 +230,4 @@ public function getHomeFolder() return $rootDirectory.$this->getApplicationName(); } - } diff --git a/src/Rocketeer/RocketeerServiceProvider.php b/src/Rocketeer/RocketeerServiceProvider.php index c77925a07..d1431f3ee 100644 --- a/src/Rocketeer/RocketeerServiceProvider.php +++ b/src/Rocketeer/RocketeerServiceProvider.php @@ -76,23 +76,23 @@ public function provides() */ public function bindClasses(Container $app) { - $app->singleton('rocketeer.rocketeer', function($app) { + $app->singleton('rocketeer.rocketeer', function ($app) { return new Rocketeer($app); }); - $app->bind('rocketeer.releases', function($app) { + $app->bind('rocketeer.releases', function ($app) { return new ReleasesManager($app); }); - $app->bind('rocketeer.server', function($app) { + $app->bind('rocketeer.server', function ($app) { return new Server($app); }); - $app->bind('rocketeer.bash', function($app) { + $app->bind('rocketeer.bash', function ($app) { return new Bash($app); }); - $app->singleton('rocketeer.tasks', function($app) { + $app->singleton('rocketeer.tasks', function ($app) { return new TasksQueue($app); }); @@ -112,7 +112,7 @@ public function bindScm(Container $app) $scm = $this->app['rocketeer.rocketeer']->getOption('scm.scm'); $scm = 'Rocketeer\Scm\\'.ucfirst($scm); - $app->bind('rocketeer.scm', function($app) use ($scm) { + $app->bind('rocketeer.scm', function ($app) use ($scm) { return new $scm($app); }); @@ -156,7 +156,9 @@ public function bindCommands(Container $app) // Build command slug if ($fakeCommand) { $taskInstance = $this->app['rocketeer.tasks']->buildTask($task); - if (is_numeric($slug)) $slug = $taskInstance->getSlug(); + if (is_numeric($slug)) { + $slug = $taskInstance->getSlug(); + } } // Add command to array @@ -165,14 +167,13 @@ public function bindCommands(Container $app) // Look for an existing command if (!$fakeCommand) { - $this->app->bind($command, function($app) use ($commandClass) { + $this->app->bind($command, function ($app) use ($commandClass) { return new $commandClass; }); - } // Else create a fake one - else { - $this->app->bind($command, function($app) use ($taskInstance, $slug) { + } else { + $this->app->bind($command, function ($app) use ($taskInstance, $slug) { return new Commands\BaseTaskCommand($taskInstance, $slug); }); } @@ -181,5 +182,4 @@ public function bindCommands(Container $app) return $app; } - } diff --git a/src/Rocketeer/Scm/Git.php b/src/Rocketeer/Scm/Git.php index 11c5116ff..37d0f08ae 100644 --- a/src/Rocketeer/Scm/Git.php +++ b/src/Rocketeer/Scm/Git.php @@ -88,5 +88,4 @@ public function update() { return 'git pull'; } - -} \ No newline at end of file +} diff --git a/src/Rocketeer/Scm/Scm.php b/src/Rocketeer/Scm/Scm.php index c95341ced..46983233f 100644 --- a/src/Rocketeer/Scm/Scm.php +++ b/src/Rocketeer/Scm/Scm.php @@ -43,5 +43,4 @@ public function reset(); * @return string */ public function update(); - -} \ No newline at end of file +} diff --git a/src/Rocketeer/Server.php b/src/Rocketeer/Server.php index 20c17ef9a..78e890aff 100644 --- a/src/Rocketeer/Server.php +++ b/src/Rocketeer/Server.php @@ -50,7 +50,7 @@ public function getSeparator() { $bash = $this->app['rocketeer.bash']; - return $this->getValue('directory_separator', function($server) use ($bash) { + return $this->getValue('directory_separator', function ($server) use ($bash) { $separator = $bash->runRemoteCommands('php -r "echo DIRECTORY_SEPARATOR;"'); $server->setValue('directory_separator', $separator); @@ -67,7 +67,7 @@ public function getLineEndings() { $bash = $this->app['rocketeer.bash']; - return $this->getValue('line_endings', function($server) use ($bash) { + return $this->getValue('line_endings', function ($server) use ($bash) { $endings = $bash->runRemoteCommands('php -r "echo PHP_EOL;"'); $server->setValue('line_endings', $endings); @@ -157,5 +157,4 @@ public function deleteRepository() { return $this->app['files']->delete($this->repository); } - } diff --git a/src/Rocketeer/Tasks/Abstracts/Task.php b/src/Rocketeer/Tasks/Abstracts/Task.php index bf132b18c..e7f0b6fc7 100644 --- a/src/Rocketeer/Tasks/Abstracts/Task.php +++ b/src/Rocketeer/Tasks/Abstracts/Task.php @@ -270,7 +270,9 @@ public function runTests($arguments = null) { // Look for PHPUnit $phpunit = $this->which('phpunit', $this->releasesManager->getCurrentReleasePath().'/vendor/bin/phpunit'); - if (!$phpunit) return true; + if (!$phpunit) { + return true; + } // Run PHPUnit $this->command->info('Running tests...'); @@ -280,5 +282,4 @@ public function runTests($arguments = null) return $this->checkStatus('Tests failed', $output, 'Tests passed successfully'); } - } diff --git a/src/Rocketeer/Tasks/Check.php b/src/Rocketeer/Tasks/Check.php index 98b71cf78..dae449bfc 100644 --- a/src/Rocketeer/Tasks/Check.php +++ b/src/Rocketeer/Tasks/Check.php @@ -159,5 +159,4 @@ public function checkPhpExtension($extension) return in_array($extension, $this->extensions); } - } diff --git a/src/Rocketeer/Tasks/Cleanup.php b/src/Rocketeer/Tasks/Cleanup.php index fda5b1b98..b2dac79b1 100644 --- a/src/Rocketeer/Tasks/Cleanup.php +++ b/src/Rocketeer/Tasks/Cleanup.php @@ -41,5 +41,4 @@ public function execute() return $this->command->line($message); } - } diff --git a/src/Rocketeer/Tasks/Closure.php b/src/Rocketeer/Tasks/Closure.php index e0800f695..2f68ca32c 100644 --- a/src/Rocketeer/Tasks/Closure.php +++ b/src/Rocketeer/Tasks/Closure.php @@ -48,5 +48,4 @@ public function execute() return $closure($this); } - } diff --git a/src/Rocketeer/Tasks/CurrentRelease.php b/src/Rocketeer/Tasks/CurrentRelease.php index 614a8ba0d..be5371690 100644 --- a/src/Rocketeer/Tasks/CurrentRelease.php +++ b/src/Rocketeer/Tasks/CurrentRelease.php @@ -37,5 +37,4 @@ public function execute() return $this->command->line($message); } - } diff --git a/src/Rocketeer/Tasks/Deploy.php b/src/Rocketeer/Tasks/Deploy.php index 6696fcfb0..f5031e503 100644 --- a/src/Rocketeer/Tasks/Deploy.php +++ b/src/Rocketeer/Tasks/Deploy.php @@ -122,5 +122,4 @@ protected function setApplicationPermissions() $this->setPermissions('app/storage'); $this->setPermissions('public'); } - } diff --git a/src/Rocketeer/Tasks/Rollback.php b/src/Rocketeer/Tasks/Rollback.php index 2fdc26a1f..651e43580 100644 --- a/src/Rocketeer/Tasks/Rollback.php +++ b/src/Rocketeer/Tasks/Rollback.php @@ -35,5 +35,4 @@ protected function getRollbackRelease() { return array_get($this->command->argument(), 'release', $this->releasesManager->getPreviousRelease()); } - } diff --git a/src/Rocketeer/Tasks/Setup.php b/src/Rocketeer/Tasks/Setup.php index a159a55a4..4dc435690 100644 --- a/src/Rocketeer/Tasks/Setup.php +++ b/src/Rocketeer/Tasks/Setup.php @@ -70,7 +70,9 @@ protected function createStages() { // Get stages $stages = $this->rocketeer->getStages(); - if (empty($stages)) $stages = array(null); + if (empty($stages)) { + $stages = array(null); + } // Create folders foreach ($stages as $stage) { @@ -80,5 +82,4 @@ protected function createStages() $this->createFolder('shared', true); } } - } diff --git a/src/Rocketeer/Tasks/Teardown.php b/src/Rocketeer/Tasks/Teardown.php index 14c44c476..1868a90c4 100644 --- a/src/Rocketeer/Tasks/Teardown.php +++ b/src/Rocketeer/Tasks/Teardown.php @@ -38,5 +38,4 @@ public function execute() $this->command->info('The application was successfully removed from the remote servers'); } - } diff --git a/src/Rocketeer/Tasks/Test.php b/src/Rocketeer/Tasks/Test.php index ea0b6724b..13bd56b70 100644 --- a/src/Rocketeer/Tasks/Test.php +++ b/src/Rocketeer/Tasks/Test.php @@ -20,5 +20,4 @@ public function execute() $this->command->info('Testing the application'); $this->runTests(); } - } diff --git a/src/Rocketeer/Tasks/Update.php b/src/Rocketeer/Tasks/Update.php index bd37a58a6..272acd1db 100644 --- a/src/Rocketeer/Tasks/Update.php +++ b/src/Rocketeer/Tasks/Update.php @@ -42,5 +42,4 @@ public function execute() $this->command->info('Successfully updated application'); } - } diff --git a/src/Rocketeer/TasksQueue.php b/src/Rocketeer/TasksQueue.php index 25dbf84ba..cb2729717 100644 --- a/src/Rocketeer/TasksQueue.php +++ b/src/Rocketeer/TasksQueue.php @@ -178,7 +178,9 @@ protected function runQueue($tasks, $stage = null) $this->app['rocketeer.rocketeer']->setStage($currentStage); $state = $task->execute(); - if ($state === false) return false; + if ($state === false) { + return false; + } } return true; @@ -236,13 +238,12 @@ public function buildTaskFromClosure($task) // If the User provided a string to execute if (is_string($task)) { $stringTask = $task; - $closure = function($task) use ($stringTask) { + $closure = function ($task) use ($stringTask) { return $task->runForCurrentRelease($stringTask); }; - } // If the User provided a Closure - elseif ($task instanceof Closure) { + } elseif ($task instanceof Closure) { $closure = $task; } @@ -324,10 +325,9 @@ protected function getSurroundingTasks(Task $task, $position) $key = get_class($task); if (array_key_exists($key, $this->tasks[$position])) { $tasks = array_get($this->tasks, $position.'.'.$key); - } // Then for the class slug - else { + } else { $tasks = array_get($this->tasks, $position.'.'.$task->getSlug()); } @@ -356,5 +356,4 @@ protected function getStage() return $stage; } - } diff --git a/tests/BashTest.php b/tests/BashTest.php index 35cdfb362..a342a03eb 100644 --- a/tests/BashTest.php +++ b/tests/BashTest.php @@ -41,5 +41,4 @@ public function testCanCheckStatusOfACommand() $status = $this->task->checkStatus(null); $this->assertNull($status); } - -} \ No newline at end of file +} diff --git a/tests/ReleasesManagerTest.php b/tests/ReleasesManagerTest.php index f2d118bff..e2ac8f4b7 100644 --- a/tests/ReleasesManagerTest.php +++ b/tests/ReleasesManagerTest.php @@ -51,5 +51,4 @@ public function testCanUpdateCurrentRelease() $this->assertEquals(30000000000000, $this->app['rocketeer.server']->getValue('current_release')); } - } diff --git a/tests/RocketeerTest.php b/tests/RocketeerTest.php index a29946cd9..bb02bea34 100644 --- a/tests/RocketeerTest.php +++ b/tests/RocketeerTest.php @@ -78,5 +78,4 @@ public function testCanGetAnyFolder() { $this->assertEquals($this->server.'/current', $this->app['rocketeer.rocketeer']->getFolder('current')); } - } diff --git a/tests/ServerTest.php b/tests/ServerTest.php index 838aab485..93ed863de 100644 --- a/tests/ServerTest.php +++ b/tests/ServerTest.php @@ -32,5 +32,4 @@ public function testCanFallbackIfFileDoesntExist() $this->assertEquals(null, $this->app['rocketeer.server']->getValue('foo')); } - } diff --git a/tests/TasksQueueTest.php b/tests/TasksQueueTest.php index c8516bfe7..3b24f287a 100644 --- a/tests/TasksQueueTest.php +++ b/tests/TasksQueueTest.php @@ -79,7 +79,7 @@ public function testCanBuildTaskFromString() $closure = $string->getClosure(); $this->assertInstanceOf('Closure', $closure); - $closureReflection = new ReflectionFunction($closure); + $closureReflection = new ReflectionFunction ($closure); $this->assertEquals(array('stringTask' => 'echo "I love ducks"'), $closureReflection->getStaticVariables()); $this->assertEquals('I love ducks', $string->execute()); @@ -87,7 +87,7 @@ public function testCanBuildTaskFromString() public function testCanBuildTaskFromClosure() { - $originalClosure = function($task) { + $originalClosure = function ($task) { return $task->getCommand()->info('echo "I love ducks"'); }; @@ -98,7 +98,14 @@ public function testCanBuildTaskFromClosure() public function testCanBuildQueue() { - $queue = array('foobar', function($task) { return 'lol'; }, 'Rocketeer\Tasks\Deploy'); + $queue = array( + 'foobar', + function ($task) { + return 'lol'; + }, + 'Rocketeer\Tasks\Deploy' + ); + $queue = $this->tasksQueue()->buildQueue($queue); $this->assertInstanceOf('Rocketeer\Tasks\Closure', $queue[0]); @@ -114,10 +121,9 @@ public function testCanRunQueue() { $this->expectOutputString('JOEY DOESNT SHARE FOOD'); $this->tasksQueue()->run(array( - function($task) { + function ($task) { print 'JOEY DOESNT SHARE FOOD'; } ), $this->getCommand()); } - } diff --git a/tests/TasksTest.php b/tests/TasksTest.php index e4508cfaf..874d6255d 100644 --- a/tests/TasksTest.php +++ b/tests/TasksTest.php @@ -38,7 +38,7 @@ public function testCanGetCurrentRelease() public function testCanTeardownServer() { - $output = $this->task('Teardown')->execute(); + $this->task('Teardown')->execute(); $this->assertFileNotExists($this->deploymentsFile); $this->assertFileNotExists($this->server); @@ -46,7 +46,7 @@ public function testCanTeardownServer() public function testCanRollbackRelease() { - $output = $this->task('Rollback')->execute(); + $this->task('Rollback')->execute(); $this->assertEquals(10000000000000, $this->app['rocketeer.releases']->getCurrentRelease()); } @@ -54,7 +54,7 @@ public function testCanRollbackRelease() public function testCanSetupServer() { $this->app['files']->deleteDirectory($this->server); - $output = $this->task('Setup')->execute(); + $this->task('Setup')->execute(); $this->assertFileExists($this->server); $this->assertFileExists($this->server.'/current'); @@ -69,7 +69,7 @@ public function testCanDeployToServer() 'password' => '', )); - $output = $this->task('Deploy')->execute(); + $this->task('Deploy')->execute(); $release = $this->app['rocketeer.releases']->getCurrentRelease(); $releasePath = $this->server.'/releases/'.$release; @@ -145,5 +145,4 @@ public function testCanPretendToRunTasks() $output = $this->task->run('ls'); $this->assertTrue($output); } - } diff --git a/tests/_start.php b/tests/_start.php index 98f24a753..af115b6f5 100644 --- a/tests/_start.php +++ b/tests/_start.php @@ -57,15 +57,15 @@ public function setUp() $this->app['path.base'] = '/src'; $this->app['path.storage'] = '/src/storage'; - $this->app->singleton('config', function() use ($config) { + $this->app->singleton('config', function () use ($config) { return $config; }); - $this->app->singleton('remote', function() use ($remote) { + $this->app->singleton('remote', function () use ($remote) { return $remote; }); - $this->app->singleton('files', function() { + $this->app->singleton('files', function () { return new Filesystem; }); @@ -75,11 +75,11 @@ public function setUp() $this->app = $serviceProvider->bindClasses($this->app); $this->app = $serviceProvider->bindScm($this->app); - $this->app->bind('rocketeer.server', function($app) { + $this->app->bind('rocketeer.server', function ($app) { return new Rocketeer\Server($app, __DIR__); }); - $this->app->singleton('rocketeer.tasks', function($app) use ($command) { + $this->app->singleton('rocketeer.tasks', function ($app) use ($command) { return new Rocketeer\TasksQueue($app, $command); }); @@ -151,15 +151,21 @@ protected function tasksQueue() */ protected function getCommand($option = true) { + $message = function ($message) { + return $message; + }; + $command = Mockery::mock('Illuminate\Console\Command'); - $command->shouldReceive('comment')->andReturnUsing(function($message) { return $message; }); - $command->shouldReceive('error')->andReturnUsing(function($message) { return $message; }); - $command->shouldReceive('line')->andReturnUsing(function($message) { return $message; }); - $command->shouldReceive('info')->andReturnUsing(function($message) { return $message; }); + $command->shouldReceive('comment')->andReturnUsing($message); + $command->shouldReceive('error')->andReturnUsing($message); + $command->shouldReceive('line')->andReturnUsing($message); + $command->shouldReceive('info')->andReturnUsing($message); $command->shouldReceive('argument'); $command->shouldReceive('ask'); $command->shouldReceive('secret'); - if ($option) $command->shouldReceive('option'); + if ($option) { + $command->shouldReceive('option'); + } return $command; } @@ -213,8 +219,10 @@ protected function getConfig() */ protected function getRemote() { - $run = function($task, $callback) { - if (is_array($task)) $task = implode(' && ', $task); + $run = function ($task, $callback) { + if (is_array($task)) { + $task = implode(' && ', $task); + } $output = shell_exec($task); $callback($output); @@ -228,5 +236,4 @@ protected function getRemote() return $remote; } - } From e59c5a16907adb77e1448c46922a89f53cf296e2 Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Tue, 9 Jul 2013 16:44:52 +0200 Subject: [PATCH 2/3] Close #14 - chown only works with root user --- src/Rocketeer/Tasks/Abstracts/Task.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rocketeer/Tasks/Abstracts/Task.php b/src/Rocketeer/Tasks/Abstracts/Task.php index e7f0b6fc7..adf0caf5b 100644 --- a/src/Rocketeer/Tasks/Abstracts/Task.php +++ b/src/Rocketeer/Tasks/Abstracts/Task.php @@ -204,7 +204,7 @@ public function setPermissions($folder) $apache = $this->rocketeer->getOption('remote.apache'); $output = $this->run(array( - 'chmod -R +x ' .$folder, + 'chmod -R 775 ' .$folder, 'chmod -R g+s ' .$folder, sprintf('chown -R %s:%s %s', $apache['user'], $apache['group'], $folder), )); From 84afd72447f2e7d9f16b93ea0c947d975518b213 Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Wed, 10 Jul 2013 16:13:21 +0200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cac0169..de233e7f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ - Ability to select which severs a Task executes on, on a per-task basis -### 0.6.0 (stable) +### 0.6.1 (stable) + +- Fix a bug where the configured user would not have the rights to set permissions + +### 0.6.0 - **Add multistage strategy** - **Add compatibility to Laravel 4.0**