From 891a346a8ee6f97150551ed048cdb81f0605e8bc Mon Sep 17 00:00:00 2001 From: prplwtf Date: Tue, 30 Jan 2024 13:17:25 +0100 Subject: [PATCH] feat `core` `build-files` `views`: No longer use nul characters for placeholders in build files. --- blueprint.sh | 30 ++++++------ .../private/build/extensions/admin.blade.php | 10 ++-- .../private/build/extensions/button.blade.php | 2 +- .../private/build/extensions/controller.php | 46 +++++++++---------- .../private/build/extensions/route.php | 2 +- resources/views/admin/extensions.blade.php | 2 +- 6 files changed, 45 insertions(+), 47 deletions(-) diff --git a/blueprint.sh b/blueprint.sh index d45d92f..7a24578 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -827,7 +827,6 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y" if [[ -f ".blueprint/tmp/$n/$dashboard_components/Components.yml" ]]; then cp ".blueprint/tmp/$n/$dashboard_components/Components.yml" ".blueprint/extensions/$identifier/private/.store/Components.yml" #backup Components.yml fi - # End creating data directory. @@ -875,34 +874,33 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y" if [[ $identifier == *"~"* ]]; then PRINT WARNING "'identifier' contains '~' and may result in an error.";fi # Replace $name variables. - sed -i "s~␀title␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" - sed -i "s~␀name␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" - sed -i "s~␀name␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" + sed -i "s~[name]~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[name]~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" # Replace $description variables. - sed -i "s~␀description␀~$description~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[description]~$description~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" # Replace $version variables. - sed -i "s~␀version␀~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" - sed -i "s~␀version␀~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" + sed -i "s~[version]~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[version]~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" # Replace $ICON variables. - sed -i "s~␀icon␀~$ICON~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[icon]~$ICON~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" # Replace $website variables. if [[ $website != "" ]]; then - sed -i "s~␀website␀~$website~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" - sed -i "s~~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" - sed -i "s~␀weblinkicon␀~$websiteiconclass~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[website]~$website~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" + sed -i "s~[webicon]~$websiteiconclass~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" fi # Replace $identifier variables. if [[ $controller_type == "default" ]]; then - sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/controller.php.bak" + sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/controller.php.bak" fi - sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/route.php.bak" - sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" + sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/route.php.bak" + sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak" # Place extension admin view content into template. echo -e "$CONTENT\n@endsection" >> ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak" @@ -948,7 +946,7 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y" OLDBUTTON_RESULT=$(<.blueprint/extensions/"$identifier"/private/.store/build/button.blade.php) sed -i "s~$OLDBUTTON_RESULT~~g" "resources/views/admin/extensions.blade.php" fi - sed -i "s~~$ADMINBUTTON_RESULT\n~g" "resources/views/admin/extensions.blade.php" + sed -i "s~~$ADMINBUTTON_RESULT\n~g" "resources/views/admin/extensions.blade.php" # Place dashboard wrapper if [[ $dashboard_wrapper != "" ]]; then diff --git a/blueprint/extensions/blueprint/private/build/extensions/admin.blade.php b/blueprint/extensions/blueprint/private/build/extensions/admin.blade.php index 2cb08f3..623560e 100644 --- a/blueprint/extensions/blueprint/private/build/extensions/admin.blade.php +++ b/blueprint/extensions/blueprint/private/build/extensions/admin.blade.php @@ -1,15 +1,15 @@ @extends('layouts.admin') @section('title') - ␀title␀ + [name] @endsection @section('content-header') - logo - -

␀name␀␀version␀

+ logo + +

[name][version]

@endsection @section('content') -

␀description␀

+

[description]

diff --git a/blueprint/extensions/blueprint/private/build/extensions/button.blade.php b/blueprint/extensions/blueprint/private/build/extensions/button.blade.php index dc2be94..2c000f2 100644 --- a/blueprint/extensions/blueprint/private/build/extensions/button.blade.php +++ b/blueprint/extensions/blueprint/private/build/extensions/button.blade.php @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/blueprint/extensions/blueprint/private/build/extensions/controller.php b/blueprint/extensions/blueprint/private/build/extensions/controller.php index bd116ba..2b32eac 100644 --- a/blueprint/extensions/blueprint/private/build/extensions/controller.php +++ b/blueprint/extensions/blueprint/private/build/extensions/controller.php @@ -1,6 +1,6 @@ view->make('admin.extensions.␀id␀.index', [ - 'blueprint' => $this->blueprint, - 'version' => $this->version, - 'root' => $rootPath - ]); - } + /** + * [id]ExtensionController constructor. + */ + public function __construct( + private BlueprintExtensionLibrary $blueprint, + private SoftwareVersionService $version, + private ViewFactory $view + ){} + + /** + * Return the extension index view. + */ + public function index(): View + { + $rootPath = "/admin/extensions/[id]"; + return $this->view->make('admin.extensions.[id].index', [ + 'blueprint' => $this->blueprint, + 'version' => $this->version, + 'root' => $rootPath + ]); + } } diff --git a/blueprint/extensions/blueprint/private/build/extensions/route.php b/blueprint/extensions/blueprint/private/build/extensions/route.php index 45532ce..061a3f4 100644 --- a/blueprint/extensions/blueprint/private/build/extensions/route.php +++ b/blueprint/extensions/blueprint/private/build/extensions/route.php @@ -1 +1 @@ -Route::group(['prefix' => 'extensions/␀id␀'], function () {Route::get('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'index'])->name('admin.extensions.␀id␀.index');Route::patch('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'update']);Route::post('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'post']);}); \ No newline at end of file +Route::group(['prefix' => 'extensions/[id]'], function () {Route::get('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'index'])->name('admin.extensions.[id].index');Route::patch('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'update']);Route::post('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'post']);}); \ No newline at end of file diff --git a/resources/views/admin/extensions.blade.php b/resources/views/admin/extensions.blade.php index af1e5c7..8987f42 100644 --- a/resources/views/admin/extensions.blade.php +++ b/resources/views/admin/extensions.blade.php @@ -25,7 +25,7 @@ - + @else