Skip to content
Snippets Groups Projects
Commit 403ccaf8 authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2: Committed by Dorian Merz
Browse files

refs #16618 [master-v5] specify additional modules via composer configuration

parent c42542a5
No related merge requests found
{
"autoload": {
"classmap": ["devops/composer/modules.php"]
},
"require": {
"finc/rules-evaluator": "0.0.3",
"sabre/vobject": "3.5.3",
"symfony/filesystem": "^3.4"
},
"scripts": {
"post-install-cmd": "@copy-themes-force",
"post-update-cmd": "@copy-themes-force",
"post-install-cmd": ["@copy-themes-force", "@dump-modules"],
"post-update-cmd": ["@copy-themes-force", "@dump-modules"],
"phpcs-finc": "vendor/bin/phpcs --standard=tests/finc/phpcs.xml",
"copy-themes-force": "php devops/composer/themes.php --force"
"copy-themes-force": "php devops/composer/themes.php --force",
"dump-modules": "ComposerEventHandlers\\Modules::dump"
},
"extra": {
"vufind": {
"modules": [
"finc"
]
}
}
}
\ No newline at end of file
<?php
use ComposerEventHandlers\Modules;
// Set up modules:
$modules = [
'Zend\Form', 'Zend\Router', 'ZfcRbac',
......@@ -22,6 +24,8 @@ if ($localModules = getenv('VUFIND_LOCAL_MODULES')) {
}
}
array_push($modules, ...Modules::get());
// Set up cache directory (be sure to keep separate cache for CLI vs. web and
// to account for potentially variant environment settings):
$baseDir = ($local = getenv('VUFIND_LOCAL_DIR')) ? $local : 'data';
......
<?php
/**
* Copyright (C) 2019 Leipzig University Library
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Sebastian Kehr <kehr@ub.uni-leipzig.de>
* @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3
*/
namespace ComposerEventHandlers;
use Composer\Script\Event;
class Modules
{
private const PATH = __DIR__ . '/../../data/cache/modules.php';
public static function dump(Event $event)
{
/** @noinspection PhpUndefinedMethodInspection */
$extra = $event->getComposer()->getPackage()->getExtra();
$modules = var_export($extra['vufind']['modules'] ?? [], true);
file_put_contents(self::PATH, "<?php\nreturn $modules;\n");
}
public static function get(): array
{
/** @noinspection PhpIncludeInspection */
return require self::PATH;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment