Merge pull request #240 from Max-Might/master

Improve symlink check in deploy:release task
This commit is contained in:
Anton Medvedev 2015-05-11 23:53:46 +07:00
commit ece5b44702
2 changed files with 16 additions and 1 deletions

View File

@ -83,7 +83,7 @@ task('deploy:release', function () {
run("mkdir $releasePath");
run("cd {{deploy_path}} && if [ -e release ]; then rm release; fi");
run("cd {{deploy_path}} && if [ -h release ]; then rm release; fi");
run("ln -s $releasePath {{deploy_path}}/release");
})->desc('Prepare release');

View File

@ -29,6 +29,21 @@ class CommonTest extends RecipeTester
$this->assertFileExists(self::$deployPath . '/release');
}
public function testReleaseSymlink()
{
$directory = self::$deployPath . '/directory';
$releaselink = self::$deployPath . '/release';
$releasedir = readlink($releaselink);
mkdir($directory);
unlink($releaselink);
symlink($directory, $releaselink);
rmdir($directory);
$this->exec('deploy:release');
$this->assertFileExists($releaselink);
}
public function testUpdateCode()
{
set('repository', 'https://github.com/deployphp/test.git');