-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from Islandora-Devops/feature/track-original-v…
…ersion Track original version, on `create-project`
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Islandora; | ||
|
||
use Composer\Json\JsonFile; | ||
use Composer\Script\Event; | ||
use Composer\Util\Platform; | ||
|
||
/** | ||
* Starter Site Composer helper. | ||
*/ | ||
class StarterSite { | ||
|
||
/** | ||
* Root package installation event callback. | ||
* | ||
* Expected to be triggered on the `post-root-package-install` event, to track | ||
* the version of the project from which a project was derived. | ||
* | ||
* @see https://getcomposer.org/doc/articles/scripts.md#event-names | ||
*/ | ||
public static function rootPackageInstall(Event $event) { | ||
$composer = $event->getComposer(); | ||
$package = $composer->getPackage(); | ||
$version_file = new JsonFile('.starter_site_version'); | ||
$version_file->write([ | ||
'package' => "$package", | ||
'full-pretty-version' => $package->getFullPrettyVersion(), | ||
'pretty-string' => $package->getPrettyString(), | ||
'pretty-version' => $package->getPrettyVersion(), | ||
'unique-name' => $package->getUniqueName(), | ||
'version' => $package->getVersion(), | ||
'release-date' => $package->getReleaseDate(), | ||
]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters