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 7973121 + 3c50a9f commit eda61ad
Show file tree
Hide file tree
Showing 29 changed files with 322 additions and 87 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,7 +4,12 @@

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

### 0.6.1 (stable)
### 0.6.2 (stable)

- 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

### 0.6.1

- Fix a bug where the configured user would not have the rights to set permissions

Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -18,6 +18,7 @@
"illuminate/support": "~4"
},
"require-dev": {
"illuminate/console": "~4",
"illuminate/container": "~4",
"illuminate/filesystem": "~4",
"mockery/mockery": "dev-master",
Expand Down
107 changes: 102 additions & 5 deletions composer.lock

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

2 changes: 1 addition & 1 deletion phpunit.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
bootstrap="tests/_start.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down
2 changes: 1 addition & 1 deletion src/Rocketeer/Bash.php
Expand Up @@ -98,7 +98,7 @@ 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));
return true;
return $commands;
}

// Get output
Expand Down
19 changes: 18 additions & 1 deletion src/Rocketeer/Commands/BaseTaskCommand.php
Expand Up @@ -2,7 +2,7 @@
namespace Rocketeer\Commands;

use Rocketeer\Rocketeer;
use Rocketeer\Tasks\Abstracts\Task;
use Rocketeer\Traits\Task;

/**
* A basic command that only runs one Task
Expand All @@ -17,6 +17,13 @@ class BaseTaskCommand extends BaseDeployCommand
*/
protected $name = 'deploy.custom';

/**
* The Task to execute on fire
*
* @var Task
*/
protected $task;

/**
* Build a new custom command
*
Expand Down Expand Up @@ -46,4 +53,14 @@ public function fire()
{
return $this->fireTasksQueue($this->task);
}

/**
* Get the Task the command will execute
*
* @return Task
*/
public function getTask()
{
return $this->task;
}
}
1 change: 0 additions & 1 deletion src/Rocketeer/Facades/Rocketeer.php
Expand Up @@ -8,7 +8,6 @@
*/
class Rocketeer extends Facade
{

/**
* Get the registered name of the component.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rocketeer/Rocketeer.php
Expand Up @@ -30,7 +30,7 @@ class Rocketeer
*
* @var string
*/
const VERSION = '0.6.0';
const VERSION = '0.6.2';

/**
* Build a new ReleasesManager
Expand Down
36 changes: 18 additions & 18 deletions src/Rocketeer/Scm/Git.php
Expand Up @@ -2,42 +2,42 @@
namespace Rocketeer\Scm;

use Illuminate\Container\Container;
use Rocketeer\Traits\Scm;

/**
* The Git SCM
*/
class Git implements Scm
class Git extends Scm implements ScmInterface
{

/**
* The IoC Container
* The core binary
*
* @var Container
* @var string
*/
protected $app;
public $binary = 'git';

////////////////////////////////////////////////////////////////////
///////////////////////////// INFORMATIONS /////////////////////////
////////////////////////////////////////////////////////////////////

/**
* Build a new Git instance
* Check if the SCM is available
*
* @param Container $app
* @return string
*/
public function __construct($app)
public function check()
{
$this->app = $app;
return $this->getCommand('--version');
}

////////////////////////////////////////////////////////////////////
///////////////////////////// INFORMATIONS /////////////////////////
////////////////////////////////////////////////////////////////////

/**
* Get the current state
*
* @return string
*/
public function currentState()
{
return 'git rev-parse HEAD';
return $this->getCommand('rev-parse HEAD');
}

/**
Expand All @@ -47,7 +47,7 @@ public function currentState()
*/
public function currentBranch()
{
return 'git rev-parse --abbrev-ref HEAD';
return $this->getCommand('rev-parse --abbrev-ref HEAD');
}

////////////////////////////////////////////////////////////////////
Expand All @@ -66,7 +66,7 @@ public function checkout($destination)
$branch = $this->app['rocketeer.rocketeer']->getRepositoryBranch();
$repository = $this->app['rocketeer.rocketeer']->getRepository();

return sprintf('git clone -b %s %s %s', $branch, $repository, $destination);
return sprintf($this->getCommand('clone -b %s %s %s'), $branch, $repository, $destination);
}

/**
Expand All @@ -76,7 +76,7 @@ public function checkout($destination)
*/
public function reset()
{
return 'git reset --hard';
return $this->getCommand('reset --hard');
}

/**
Expand All @@ -86,6 +86,6 @@ public function reset()
*/
public function update()
{
return 'git pull';
return $this->getCommand('pull');
}
}
Expand Up @@ -4,8 +4,14 @@
/**
* The interface for all SCMs
*/
interface Scm
interface ScmInterface
{
/**
* Check if the SCM is available
*
* @return string
*/
public function check();

/**
* Get the current state
Expand Down
20 changes: 19 additions & 1 deletion src/Rocketeer/Tasks/Check.php
@@ -1,7 +1,7 @@
<?php
namespace Rocketeer\Tasks;

use Rocketeer\Tasks\Abstracts\Task;
use Rocketeer\Traits\Task;

/**
* Check if the server is ready to receive the application
Expand Down Expand Up @@ -33,6 +33,11 @@ public function execute()
$errors = array();
$extension = 'The %s extension does not seem to be loaded on the server';

// Check SCM
if (!$this->checkScm()) {
$errors[] = $this->command->error($this->scm->binary . ' could not be found on the server');
}

// Check PHP
if (!$this->checkPhpVersion()) {
$errors[] = $this->command->error('The version of PHP on the server does not match Laravel\'s requirements');
Expand Down Expand Up @@ -76,6 +81,19 @@ public function execute()
/////////////////////////////// HELPERS ////////////////////////////
////////////////////////////////////////////////////////////////////

/**
* Check the presence of an SCM on the server
*
* @return boolean
*/
public function checkScm()
{
$this->command->comment('Checking presence of '.$this->scm->binary);
$this->run($this->scm->check());

return $this->remote->status() == 0;
}

/**
* Check if Composer is on the server
*
Expand Down
2 changes: 1 addition & 1 deletion src/Rocketeer/Tasks/Cleanup.php
@@ -1,7 +1,7 @@
<?php
namespace Rocketeer\Tasks;

use Rocketeer\Tasks\Abstracts\Task;
use Rocketeer\Traits\Task;
use Illuminate\Support\Str;

/**
Expand Down

0 comments on commit eda61ad

Please sign in to comment.