Sven Ullmann
2 years ago
8 changed files with 119 additions and 14 deletions
-
38src/commands/configure-plugin
-
14src/commands/create-project
-
12src/commands/list-projects
-
2src/commands/remove-project
-
5src/includes/config.php
-
31src/includes/configure-json-file
-
25src/includes/configure-json-file.php
-
6src/includes/main_functions
@ -0,0 +1,38 @@ |
|||
#!/bin/bash |
|||
|
|||
### DO NOT EDIT THIS FILE |
|||
|
|||
function usage { |
|||
echo |
|||
echoMainTitle "Configures a plugin" |
|||
echo |
|||
echoSubTitle "Usage:" |
|||
echo |
|||
echo "configure-plugin [shortname] [plugin]" |
|||
echo |
|||
echo "--help Prints this message" |
|||
echo " " |
|||
} |
|||
|
|||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)/includes/bash_header" |
|||
|
|||
shortname=$(getArgument "$1" "shortname required" true) |
|||
plugin=$(getArgument "$2" "plugin required" true) |
|||
customer=$(getConfig false "project_manager.projects.$shortname.customer") |
|||
project=$(getConfig false "project_manager.projects.$shortname.project") |
|||
project_dir="$project_manager_dir/data/$customer/$project" |
|||
config_path="$project_dir/etc/$plugin/config.json" |
|||
|
|||
if [ ! -f "$config_path" ] |
|||
then |
|||
echo |
|||
echoError "Could not load configuration file: $config_path" |
|||
echo |
|||
exit |
|||
fi |
|||
|
|||
echo |
|||
echoMainTitle "Configure Plugin: $plugin" |
|||
echo |
|||
|
|||
configureJsonFile "$config_path" |
@ -0,0 +1,31 @@ |
|||
#!/bin/bash |
|||
|
|||
### DO NOT EDIT THIS FILE |
|||
|
|||
function usage { |
|||
echo |
|||
echoMainTitle "Sumedia Project Manager Configure Configuration File" |
|||
echo |
|||
echoSubTitle "Usage:" |
|||
echo |
|||
echo "configure-json-file filePath" |
|||
echo |
|||
echo "--help Prints this message" |
|||
echo " " |
|||
exit |
|||
} |
|||
|
|||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/bash_header" |
|||
|
|||
filePath="$(getArgument "$1" "Parameter filePath not given" true)" |
|||
if [ ! -f "$filePath" ] |
|||
then |
|||
echo |
|||
echoError "Could not find configuration file: $filePath" |
|||
echo |
|||
exit; |
|||
fi |
|||
|
|||
PHP=`which php` |
|||
script="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/configure-json-file.php" |
|||
$PHP "$script" "$@" |
@ -0,0 +1,25 @@ |
|||
<?php |
|||
|
|||
### DO NOT EDIT THIS FILE
|
|||
|
|||
global $project_manager_dir, $shortname, $configPath, $configuration, $value; |
|||
$configuration = []; |
|||
$jsonFile = $_SERVER['argv'][1]; |
|||
$configuration = json_decode(file_get_contents($jsonFile), true); |
|||
|
|||
function readNext($config, &$current) { |
|||
foreach ($config as $key => $value) { |
|||
if (is_array($value) && !isset($value[0])) { |
|||
readNext($value, $current[$key]); |
|||
} else { |
|||
$prompt = "$key [default:$value]"; |
|||
$current[$key] = readline($prompt); |
|||
} |
|||
} |
|||
} |
|||
|
|||
foreach ($configuration as $key => $config) { |
|||
readNext($config, $configuration[$key]); |
|||
} |
|||
|
|||
file_put_contents($jsonFile, json_encode($configuration, JSON_PRETTY_PRINT && JSON_ERROR_NONE && JSON_UNESCAPED_SLASHES)); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue