Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #127 from niels-nijens/fix-deploy-release-task
Browse files Browse the repository at this point in the history
Fix current release detection in DeployReleaseTask
  • Loading branch information
niels-nijens committed Apr 13, 2016
2 parents 396e9c2 + 566d37a commit 5f83db1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Task/DeployReleaseTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function onPrepareDeployReleaseConstructReleaseInstances(PrepareDeployRel
if ($connection->isLink($releasePath)) {
$releaseRealPath = $connection->readLink($releasePath);
if (strpos($releaseRealPath, $workspace->getReleasesDirectory()) === 0) {
$currentRelease = new Release(substr($releaseRealPath, strlen($workspace->getReleasesDirectory()) + 1));
$workspace->addRelease($release);
$currentRelease = new Release(substr($releaseRealPath, strlen($workspace->getReleasesDirectory())));
$workspace->addRelease($currentRelease);

$context = array('currentReleaseVersion' => $currentRelease->getVersion());
$eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::INFO, 'Detected release version "{currentReleaseVersion}" currently deployed.', $eventName, $this, $context));
Expand Down
6 changes: 3 additions & 3 deletions tests/Task/DeployReleaseTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testOnPrepareDeployReleaseConstructReleaseInstancesWithCurrentRe
$connectionAdapterMock->expects($this->once())->method('isConnected')->willReturn(true);
$connectionAdapterMock->expects($this->once())
->method('isDirectory')
->with($this->equalTo('/path/to/workspace/releases/0.1.0'))
->with($this->equalTo('/path/to/workspace/releases//0.1.0'))
->willReturn(true);
$connectionAdapterMock->expects($this->once())
->method('isLink')
Expand All @@ -114,15 +114,15 @@ public function testOnPrepareDeployReleaseConstructReleaseInstancesWithCurrentRe
->disableOriginalConstructor()
->getMock();
$workspaceMock->expects($this->once())->method('getHost')->willReturn($hostMock);
$workspaceMock->expects($this->exactly(3))->method('getReleasesDirectory')->willReturn('/path/to/workspace/releases');
$workspaceMock->expects($this->exactly(3))->method('getReleasesDirectory')->willReturn('/path/to/workspace/releases/');
$workspaceMock->expects($this->exactly(2))
->method('addRelease')
->with($this->callback(function ($release) use ($workspaceMock) {
if ($release instanceof Release) {
$release->setWorkspace($workspaceMock);
}

return ($release instanceof Release);
return ($release instanceof Release && $release->getVersion() === '0.1.0');
}));

$eventMock = $this->getMockBuilder('Accompli\EventDispatcher\Event\PrepareDeployReleaseEvent')
Expand Down

0 comments on commit 5f83db1

Please sign in to comment.