From 5a1268aed640a1b453f99447c3b2e3ac838fad63 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Thu, 30 Dec 2021 00:53:08 +0100 Subject: [PATCH] Installer tweaks --- .spark/build/package.sh | 15 ++++++++++----- .../Commands/Stack/StatusCommand.php | 2 +- runtime/functions.php | 12 ++++++++++-- src/install | 15 +++++++++------ src/logo.php | 15 +++++++++++++++ 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 src/logo.php diff --git a/.spark/build/package.sh b/.spark/build/package.sh index 2b98805..b17d576 100755 --- a/.spark/build/package.sh +++ b/.spark/build/package.sh @@ -7,13 +7,18 @@ fi if [ -z "$VERSION" ]; then VERSION="$(git describe --tags)" - PATH="$PWD/tools:$PATH" + if [ -z "$VERSION" ]; then + echo "Could not parse version from git. Export VERSION if you are building manually." + exit 1 + fi +fi +echo "* Version: $VERSION" +if [ ! -z "$FLAVOR" ]; then + VERSION="${VERSION}-${FLAVOR}" + echo "* Flavor: $FLAVOR" fi -if [ -z "$VERSION" ]; then - echo "Could not parse version from git. Export VERSION if you are building manually." - exit 1 -fi +PATH="$PWD/tools:$PATH" if [ -z $DESTINATION ]; then DESTINATION="release/$VERSION" diff --git a/plugins/com.noccy.docker/Commands/Stack/StatusCommand.php b/plugins/com.noccy.docker/Commands/Stack/StatusCommand.php index 161e77e..6b44bac 100644 --- a/plugins/com.noccy.docker/Commands/Stack/StatusCommand.php +++ b/plugins/com.noccy.docker/Commands/Stack/StatusCommand.php @@ -22,7 +22,7 @@ class StatusCommand extends Command $stacks = $stackManager->getRegisteredStacks(); foreach ($stacks as $stack) { - $output->writeln("\u{2bbb} {$stack->getName()}"); + $output->writeln("{$stack->getName()}"); $table = $stack->getContainersTable($output); $table->setStyle('compact'); $table->setColumnWidths([ 30, 20, 20, 0 ]); diff --git a/runtime/functions.php b/runtime/functions.php index bd72f7a..1f25b74 100644 --- a/runtime/functions.php +++ b/runtime/functions.php @@ -7,12 +7,14 @@ use Spark\Pipe\Filters\PhpFilter; use Spark\Resource\ResourceType; use Spark\SparkApplication; -$HELPERS = []; - function object(...$data) { return (object)$data; } +// ------- Helpers ------- + +$HELPERS = []; + function register_helper(string $name, callable $helper) { global $HELPERS; $HELPERS[$name] = $helper; @@ -28,6 +30,8 @@ function helper(string $name, ...$args) { return $helper(...$args); } +// ------ Plugins ------ + function register_plugin(string $name, SparkPlug $plugin) { $refl = new ReflectionClass($plugin); $psr4 = object( @@ -50,6 +54,8 @@ function get_plugin(string $name) { return SparkApplication::$instance->getPluginManager()->getPlugin($name); } +// ------ Commands ------ + function register_command(Command $command) { SparkApplication::$instance->add($command); } @@ -58,6 +64,8 @@ function get_environment(): Environment { return SparkApplication::$instance->getEnvironment(); } +// ------ Resources ------ + function register_resource_type(string $name, string $type) { SparkApplication::$instance->getResourceManager()->registerResourceType($name, $type); } diff --git a/src/install b/src/install index 42afccd..5b1e01b 100644 --- a/src/install +++ b/src/install @@ -31,13 +31,16 @@ function askString(string $prompt, ?string $default=null) { } -echo " ___ _ \n"; -echo "/ __|_ __ __ _ _ _| |__\n"; -echo "\\__ \\ '_ \\/ _` | '_| / /\n"; -echo "|___/ .__/\\__,_|_| |_\\_\\\n"; -echo " |_| \n"; +$logo = require_once __DIR__."/logo.php"; +echo $logo; -printf("\n%s\n \u{26a1} \e[1mSpark\e[0m Installer\n%s\n\n", str_repeat("\u{2500}",40), str_repeat("\u{2500}", 40)); +//echo " ___ _ \n"; +//echo "/ __|_ __ __ _ _ _| |__\n"; +//echo "\\__ \\ '_ \\/ _` | '_| / /\n"; +//echo "|___/ .__/\\__,_|_| |_\\_\\\n"; +//echo " |_| \n"; + +printf("\n%s\n \u{26a1} \e[1mSpark\e[0m Installer\n%s\n\n", str_repeat("\u{2500}",80), str_repeat("\u{2500}", 80)); $destination = askString("Installation directory", getenv("HOME")."/opt/spark"); $binaries = askString("Path for executables", getenv("HOME")."/bin"); diff --git a/src/logo.php b/src/logo.php new file mode 100644 index 0000000..ac52eee --- /dev/null +++ b/src/logo.php @@ -0,0 +1,15 @@ +