Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add an install script hook to composer extras
  • Loading branch information
ahebrank committed Dec 22, 2016
commit 1b543a5dd240e4897a6d74dc465af95d96aed155
14 changes: 14 additions & 0 deletions src/PatternLab/InstallerUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

}

/**
Expand Down Expand Up @@ -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);
}
}

}