Skip to content

Commit

Permalink
Fix an issue where 'site-' prefix was unnecessarily added to module d…
Browse files Browse the repository at this point in the history
…irectories
  • Loading branch information
Teppo Koivula committed Jun 10, 2019
1 parent 2862afa commit 0b4b40a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.4] - 2019-06-10

### Fixed
- Fix an issue where 'site-' prefix was unnecessarily added to module directories.

## [0.0.3] - 2019-06-07

### Added
Expand Down
5 changes: 0 additions & 5 deletions src/ComposerInstaller/BaseInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ protected function getName(PackageInterface $package) {
$name = $extra['installer-name'];
}

// make sure that the directory name has a site- prefix; if not, add
if (strpos($name, 'site-') !== 0) {
$name = 'site-' . $name;
}

return $name;
}

Expand Down
21 changes: 21 additions & 0 deletions src/ComposerInstaller/SiteProfileInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ public function getInstallPath(PackageInterface $package)
return $this->getFullPath($package, static::BASE_PATH);
}

/**
* Get the directory name from package name
*
* Default directory name can be overridden by specifying extra argument
* "installer-name" in the composer.json of the package in question.
*
* @param PackageInterface $package
* @return string Module or site profile name.
*/
protected function getName(PackageInterface $package) {
// fetch initial directory name
$name = parent::getName($package);

// make sure that the directory name has a site- prefix; if not, add
if (strpos($name, 'site-') !== 0) {
$name = 'site-' . $name;
}

return $name;
}

/**
* Get nested site directory path, or null if none found
*
Expand Down

0 comments on commit 0b4b40a

Please sign in to comment.