From 1b543a5dd240e4897a6d74dc465af95d96aed155 Mon Sep 17 00:00:00 2001 From: Andy Hebrank Date: Thu, 22 Dec 2016 13:17:44 -0500 Subject: [PATCH] add an install script hook to composer extras --- src/PatternLab/InstallerUtil.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/PatternLab/InstallerUtil.php b/src/PatternLab/InstallerUtil.php index 66a3fab5..5aea2fd6 100644 --- a/src/PatternLab/InstallerUtil.php +++ b/src/PatternLab/InstallerUtil.php @@ -289,6 +289,13 @@ public static function parseComposerExtraList($composerExtra, $name, $pathDist) } + if (isset($composerExtra["installScripts"])) { + foreach ($composerExtra["installScripts"] as $script) { + // scripts are relative to the dist directory + self::runInstallScript($pathDist, $script); + } + } + } /** @@ -768,4 +775,11 @@ protected static function scanForPatternEngineRule($pathPackage,$remove = false) } + protected static function runInstallScript($path, $script) { + $script_filename = $path . DIRECTORY_SEPARATOR . $script; + if (file_exists($script_filename)) { + include($script_filename); + } + } + }