Skip to content

Commit

Permalink
Merge pull request #205 from andres-montanez/develop
Browse files Browse the repository at this point in the history
Release 1.0.5
  • Loading branch information
eps90 committed Mar 8, 2015
2 parents 7e3cc53 + a45802a commit e0429f0
Show file tree
Hide file tree
Showing 9 changed files with 557 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src_dir: Mage
coverage_clover: build/logs/coverage.xml
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ php:
- 5.6

install:
- composer install --dev --prefer-source
- composer self-update
- composer install --prefer-source

script:
- mkdir -p build/logs
- bin/phpunit --coverage-clover build/logs/coverage.xml

after_script:
- bin/coveralls -v
3 changes: 3 additions & 0 deletions Mage/Command/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,17 @@ public static function get($commandName, Config $config)
// try a custom command
$className = 'Command\\' . $commandName;

// TODO use a custom exception
if (!class_exists($className)) {
throw new Exception('Command "' . $commandName . '" not found.');
}
}

/** @var AbstractCommand $instance */
// TODO dependencies like $config should be injected into constructor
$instance = new $className;
if (! $instance instanceOf AbstractCommand) {
// TODO use a custom exception
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
}

Expand Down
9 changes: 5 additions & 4 deletions Mage/Task/BuiltIn/Deployment/ReleaseTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ public function run()
}
}

if ($resultFetch && $userGroup != '') {
$command = 'chown -h ' . $userGroup . ' ' . $symlink
. ' && '
. 'chown -R ' . $userGroup . ' ' . $currentCopy
if ($resultFetch && $userGroup != '') {
$command = 'chown -R ' . $userGroup . ' ' . $currentCopy
. ' && '
. 'chown ' . $userGroup . ' ' . $releasesDirectory;
if (file_exists($symlink)) {
$command.= ' && ' . 'chown -h ' . $userGroup . ' ' . $symlink;
}
$result = $this->runCommandRemote($command);
if (!$result) {
return $result;
Expand Down
11 changes: 11 additions & 0 deletions Mage/Task/BuiltIn/Deployment/Strategy/GitRebaseTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ public function getName()
*/
public function run()
{
$this->checkOverrideRelease();

if ($this->getConfig()->release('enabled', false) == true) {
$releasesDirectory = $this->getConfig()->release('directory', 'releases');

$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
. '/' . $releasesDirectory
. '/' . $this->getConfig()->getReleaseId();
$this->runCommandRemote('mkdir -p ' . $deployToDirectory);
}

$branch = $this->getParameter('branch', 'master');
$remote = $this->getParameter('remote', 'origin');

Expand Down
10 changes: 6 additions & 4 deletions Mage/Task/BuiltIn/Deployment/Strategy/RsyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public function run()
// rsync: { copy: yes }
$rsync_copy = $this->getConfig()->deployment('rsync');
// If copy_tool_rsync, use rsync rather than cp for finer control of what is copied
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync'])) {
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && is_dir("$releasesDirectory/$currentRelease")) {
if (isset($rsync_copy['copy_tool_rsync'])) {
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
} elseif ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
} else {
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
}
} else {
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
}
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "4.3.5"
"phpunit/phpunit": "4.3.5",
"satooshi/php-coveralls": ">=0.6.1"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit e0429f0

Please sign in to comment.