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 11, 2013
2 parents eda61ad + 0eb1eec commit 4be13e3
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 24 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,7 +4,13 @@

- Ability to select which severs a Task executes on, on a per-task basis

### 0.6.2 (stable)
### 0.6.3 (stable)

- Application name is now always sluggified as a security
- Fix a bug where the Check task would fail on pretend mode
- Fix a bug where invalid directory separators would get cached and used

### 0.6.2

- Make the Check task check for the remote presence of the configured SCM
- Fix Rocketeer not being able to use a `composer.phar` on the server
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -22,7 +22,8 @@
"illuminate/container": "~4",
"illuminate/filesystem": "~4",
"mockery/mockery": "dev-master",
"nesbot/carbon": "dev-master"
"nesbot/carbon": "dev-master",
"patchwork/utf8": "dev-master"
},
"autoload": {
"psr-0": {
Expand Down
56 changes: 51 additions & 5 deletions composer.lock

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

2 changes: 2 additions & 0 deletions src/Rocketeer/Bash.php
Expand Up @@ -98,6 +98,8 @@ public function run($commands, $silent = false, $array = false)
// Log the commands for pretend
if ($this->getOption('pretend') and !$silent) {
$this->command->line(implode(PHP_EOL, $commands));
$commands = (sizeof($commands) == 1) ? $commands[0] : $commands;

return $commands;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Rocketeer/Rocketeer.php
Expand Up @@ -30,7 +30,7 @@ class Rocketeer
*
* @var string
*/
const VERSION = '0.6.2';
const VERSION = '0.6.3';

/**
* Build a new ReleasesManager
Expand Down Expand Up @@ -101,7 +101,7 @@ public function getStages()
*/
public function getApplicationName()
{
return $this->getOption('remote.application_name');
return Str::slug($this->getOption('remote.application_name'));
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/Rocketeer/Server.php
Expand Up @@ -52,6 +52,16 @@ public function getSeparator()

return $this->getValue('directory_separator', function ($server) use ($bash) {
$separator = $bash->runRemoteCommands('php -r "echo DIRECTORY_SEPARATOR;"');

// Throw an Exception if we receive invalid output
if (strlen($separator) > 1) {
throw new Exception(
'An error occured while fetching the directory separators used on the server.'.PHP_EOL.
'Output received was : '.$separator
);
}

// Cache separator
$server->setValue('directory_separator', $separator);

return $separator;
Expand Down
2 changes: 1 addition & 1 deletion src/Rocketeer/Traits/Scm.php
Expand Up @@ -38,4 +38,4 @@ public function getCommand($command)
{
return $this->binary. ' ' .$command;
}
}
}
8 changes: 7 additions & 1 deletion tests/TasksTest.php
Expand Up @@ -25,6 +25,12 @@ public function testCanRunMigrations()
//////////////////////////////// TASKS /////////////////////////////
////////////////////////////////////////////////////////////////////

public function testCanPretendToCheck()
{
$task = $this->pretendTask('Check');
$task->execute();
}

public function testCanCleanupServer()
{
$cleanup = $this->task('Cleanup');
Expand Down Expand Up @@ -154,6 +160,6 @@ public function testCanPretendToRunTasks()
$this->task->command = $command;

$output = $this->task->run('ls');
$this->assertEquals(array('ls'), $output);
$this->assertEquals('ls', $output);
}
}
12 changes: 8 additions & 4 deletions tests/_start.php
Expand Up @@ -127,10 +127,14 @@ protected function recreateVirtualServer()
*
* @return Task
*/
protected function pretendTask()
protected function pretendTask($task = 'Deploy')
{
$task = $this->task('Deploy');
$task->command = clone $this->getCommand()->shouldReceive('option')->with('pretend')->andReturn(true)->mock();
$command = clone $this->getCommand();
$command->shouldReceive('option')->with('pretend')->andReturn(true);
$command->shouldReceive('option')->with('verbose')->andReturn(false);

$task = $this->task($task);
$task->command = $command;

return $task;
}
Expand Down Expand Up @@ -205,7 +209,7 @@ protected function getConfig()

// Rocketeer
$config->shouldReceive('get')->with('rocketeer::remote.apache')->andReturn(array('user' => 'www-data', 'group' => 'www-data'));
$config->shouldReceive('get')->with('rocketeer::remote.application_name')->andReturn('foobar');
$config->shouldReceive('get')->with('rocketeer::remote.application_name')->andReturn('FoOBaR');
$config->shouldReceive('get')->with('rocketeer::remote.root_directory')->andReturn(__DIR__.'/server/');
$config->shouldReceive('get')->with('rocketeer::remote.keep_releases')->andReturn(1);
$config->shouldReceive('get')->with('rocketeer::remote.shared')->andReturn(array('tests/meta'));
Expand Down
18 changes: 9 additions & 9 deletions tests/meta/coverage.txt
@@ -1,21 +1,21 @@


Code Coverage Report
2013-07-11 01:13:30

Summary:
Classes: 50.00% (9/18)
Methods: 84.26% (91/108)
Lines: 84.74% (422/498)
Code Coverage Report:
2013-07-11 13:12:53
Summary:
Classes: 44.44% (8/18)
Methods: 83.33% (90/108)
Lines: 84.13% (424/504)

\Rocketeer::Bash
Methods: 100.00% (15/15) Lines: 92.00% ( 69/ 75)
Methods: 100.00% (15/15) Lines: 92.11% ( 70/ 76)
\Rocketeer::ReleasesManager
Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 19/ 19)
\Rocketeer::Rocketeer
Methods: 100.00% (13/13) Lines: 95.24% ( 40/ 42)
\Rocketeer::Server
Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 34/ 34)
Methods: 100.00% ( 9/ 9) Lines: 89.74% ( 35/ 39)
\Rocketeer::TasksQueue
Methods: 100.00% (15/15) Lines: 90.91% ( 90/ 99)
\Rocketeer\Scm::Git
Expand Down

0 comments on commit 4be13e3

Please sign in to comment.