Skip to content

Commit

Permalink
[BUGFIX] Use correct paths in Composer and Rsync Task (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonschaufi committed May 31, 2020
1 parent 71ac7d2 commit 58e16fd
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 7 deletions.
47 changes: 42 additions & 5 deletions src/Domain/Model/Deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,23 @@ public function simulate()
*
* @return string
*/
public function getApplicationReleasePath(Application $application)
public function getApplicationReleaseBasePath(Application $application)
{
return Files::concatenatePaths([
$application->getReleasesPath(),
$this->getReleaseIdentifier(),
$this->getReleaseIdentifier()
]);
}

/**
* @param Application $application
*
* @return string
*/
public function getApplicationReleasePath(Application $application)
{
return Files::concatenatePaths([
$this->getApplicationReleaseBasePath($application),
$this->relativeProjectRootPath
]);
}
Expand Down Expand Up @@ -529,7 +541,11 @@ public function setTemporaryPath($temporaryPath)
*/
public function getDeploymentConfigurationPath()
{
return $this->getDeploymentBasePath() . '/' . $this->getName() . '/Configuration';
return Files::concatenatePaths([
$this->getDeploymentBasePath(),
$this->getName(),
'Configuration'
]);
}

/**
Expand All @@ -541,7 +557,26 @@ public function getDeploymentConfigurationPath()
*/
public function getWorkspacePath(Application $application)
{
return $this->workspacesBasePath . '/' . $this->getName() . '/' . $application->getName();
return Files::concatenatePaths([
$this->workspacesBasePath,
$this->getName(),
$application->getName()
]);
}

/**
* Get a local workspace directory for the application
*
* @param Application $application
*
* @return string
*/
public function getWorkspaceWithProjectRootPath(Application $application)
{
return Files::concatenatePaths([
$this->getWorkspacePath($application),
$this->relativeProjectRootPath
]);
}

/**
Expand Down Expand Up @@ -594,7 +629,9 @@ public function getDeploymentLockIdentifier()
private function setDeploymentLockIdentifier($deploymentLockIdentifier = null)
{
if (! is_string($deploymentLockIdentifier) || $deploymentLockIdentifier === '') {
$deploymentLockIdentifier = getenv('SURF_DEPLOYMENT_LOCK_IDENTIFIER') !== false ? (string)getenv('SURF_DEPLOYMENT_LOCK_IDENTIFIER') : $this->releaseIdentifier;
$deploymentLockIdentifier = getenv('SURF_DEPLOYMENT_LOCK_IDENTIFIER') !== false
? (string)getenv('SURF_DEPLOYMENT_LOCK_IDENTIFIER')
: $this->releaseIdentifier;
}
$this->deploymentLockIdentifier = $deploymentLockIdentifier;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Composer/AbstractComposerTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function execute(Node $node, Application $application, Deployment $deploy
$options = $this->configureOptions($options);

if ($options['useApplicationWorkspace']) {
$composerRootPath = $deployment->getWorkspacePath($application);
$composerRootPath = $deployment->getWorkspaceWithProjectRootPath($application);
} else {
$composerRootPath = $deployment->getApplicationReleasePath($application);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Task/Transfer/RsyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function execute(Node $node, Application $application, Deployment $deploy
$options = $this->configureOptions($options);

$localPackagePath = $deployment->getWorkspacePath($application);
$releasePath = $deployment->getApplicationReleasePath($application);
$releasePath = $deployment->getApplicationReleaseBasePath($application);

if ($options['webDirectory'] !== null) {
$this->replacePaths['{webDirectory}'] = $options['webDirectory'];
Expand Down

0 comments on commit 58e16fd

Please sign in to comment.