Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Anahkiasen committed Jul 10, 2013
2 parents 002a1e9 + 84afd72 commit 7973121
Show file tree
Hide file tree
Showing 36 changed files with 89 additions and 93 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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**
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/Rocketeer/Bash.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
});

Expand Down Expand Up @@ -346,5 +351,4 @@ protected function processCommands($commands)

return $commands;
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/BaseDeployCommand.php
Expand Up @@ -51,5 +51,4 @@ protected function getOptions()
array('stage', 'S', InputOption::VALUE_REQUIRED, 'The stage to execute the Task in')
);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/BaseTaskCommand.php
Expand Up @@ -46,5 +46,4 @@ public function fire()
{
return $this->fireTasksQueue($this->task);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/DeployCommand.php
Expand Up @@ -25,5 +25,4 @@ public function fire()
{
$this->line('<info>Rocketeer</info> version <comment>'.Rocketeer::VERSION.'</comment>');
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/DeployDeployCommand.php
Expand Up @@ -49,5 +49,4 @@ protected function getOptions()
array('seed', 's', InputOption::VALUE_NONE, 'Seed the database after migrating the database'),
));
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/DeployRollbackCommand.php
Expand Up @@ -44,5 +44,4 @@ protected function getArguments()
array('release', InputArgument::OPTIONAL, 'The release to rollback to'),
);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/DeployTestCommand.php
Expand Up @@ -31,5 +31,4 @@ public function fire()
$this->input->setOption('verbose', true);
return $this->fireTasksQueue('Rocketeer\Tasks\Test');
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Commands/DeployUpdateCommand.php
Expand Up @@ -45,5 +45,4 @@ protected function getOptions()
array('seed', 's', InputOption::VALUE_NONE, 'Seed the database after migrating the database'),
));
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Facades/Rocketeer.php
Expand Up @@ -18,5 +18,4 @@ protected static function getFacadeAccessor()
{
return 'rocketeer.tasks';
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/ReleasesManager.php
Expand Up @@ -136,5 +136,4 @@ public function updateCurrentRelease($release)
{
$this->app['rocketeer.server']->setValue('current_release', $release);
}

}
8 changes: 4 additions & 4 deletions src/Rocketeer/Rocketeer.php
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -229,5 +230,4 @@ public function getHomeFolder()

return $rootDirectory.$this->getApplicationName();
}

}
24 changes: 12 additions & 12 deletions src/Rocketeer/RocketeerServiceProvider.php
Expand Up @@ -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);
});

Expand All @@ -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);
});

Expand Down Expand Up @@ -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
Expand All @@ -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);
});
}
Expand All @@ -181,5 +182,4 @@ public function bindCommands(Container $app)

return $app;
}

}
3 changes: 1 addition & 2 deletions src/Rocketeer/Scm/Git.php
Expand Up @@ -88,5 +88,4 @@ public function update()
{
return 'git pull';
}

}
}
3 changes: 1 addition & 2 deletions src/Rocketeer/Scm/Scm.php
Expand Up @@ -43,5 +43,4 @@ public function reset();
* @return string
*/
public function update();

}
}
5 changes: 2 additions & 3 deletions src/Rocketeer/Server.php
Expand Up @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -157,5 +157,4 @@ public function deleteRepository()
{
return $this->app['files']->delete($this->repository);
}

}
7 changes: 4 additions & 3 deletions src/Rocketeer/Tasks/Abstracts/Task.php
Expand Up @@ -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),
));
Expand Down Expand Up @@ -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...');
Expand All @@ -280,5 +282,4 @@ public function runTests($arguments = null)

return $this->checkStatus('Tests failed', $output, 'Tests passed successfully');
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Check.php
Expand Up @@ -159,5 +159,4 @@ public function checkPhpExtension($extension)

return in_array($extension, $this->extensions);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Cleanup.php
Expand Up @@ -41,5 +41,4 @@ public function execute()

return $this->command->line($message);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Closure.php
Expand Up @@ -48,5 +48,4 @@ public function execute()

return $closure($this);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/CurrentRelease.php
Expand Up @@ -37,5 +37,4 @@ public function execute()

return $this->command->line($message);
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Deploy.php
Expand Up @@ -122,5 +122,4 @@ protected function setApplicationPermissions()
$this->setPermissions('app/storage');
$this->setPermissions('public');
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Rollback.php
Expand Up @@ -35,5 +35,4 @@ protected function getRollbackRelease()
{
return array_get($this->command->argument(), 'release', $this->releasesManager->getPreviousRelease());
}

}
5 changes: 3 additions & 2 deletions src/Rocketeer/Tasks/Setup.php
Expand Up @@ -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) {
Expand All @@ -80,5 +82,4 @@ protected function createStages()
$this->createFolder('shared', true);
}
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Teardown.php
Expand Up @@ -38,5 +38,4 @@ public function execute()

$this->command->info('The application was successfully removed from the remote servers');
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Test.php
Expand Up @@ -20,5 +20,4 @@ public function execute()
$this->command->info('Testing the application');
$this->runTests();
}

}
1 change: 0 additions & 1 deletion src/Rocketeer/Tasks/Update.php
Expand Up @@ -42,5 +42,4 @@ public function execute()

$this->command->info('Successfully updated application');
}

}

0 comments on commit 7973121

Please sign in to comment.