From 407d47d1de17e6a77e524a3028f9653c8f5e2f9a Mon Sep 17 00:00:00 2001 From: Chris Morrell Date: Fri, 12 Apr 2024 17:03:42 -0400 Subject: [PATCH] Add a little boilerplate --- .idea/ansipants.iml | 26 +++++++- .idea/blade.xml | 5 ++ .idea/inspectionProfiles/Project_Default.xml | 1 + .idea/php.xml | 39 ++++++++++++ composer.json | 6 +- config/ansipants.php | 12 ---- src/AnsiString.php | 24 +++++++ src/Support/AnsiPantsServiceProvider.php | 19 ++++++ src/Support/AnsiParser.php | 19 ++++++ src/Support/AnsipantsServiceProvider.php | 67 -------------------- src/Support/Facades/Ansi.php | 13 ++++ tests/TestCase.php | 6 +- 12 files changed, 150 insertions(+), 87 deletions(-) delete mode 100644 config/ansipants.php create mode 100644 src/AnsiString.php create mode 100755 src/Support/AnsiPantsServiceProvider.php create mode 100755 src/Support/AnsiParser.php delete mode 100755 src/Support/AnsipantsServiceProvider.php create mode 100644 src/Support/Facades/Ansi.php diff --git a/.idea/ansipants.iml b/.idea/ansipants.iml index 8b0b331..ecae65f 100644 --- a/.idea/ansipants.iml +++ b/.idea/ansipants.iml @@ -2,8 +2,8 @@ - - + + @@ -119,6 +119,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/blade.xml b/.idea/blade.xml index da06b88..93870c7 100644 --- a/.idea/blade.xml +++ b/.idea/blade.xml @@ -53,6 +53,7 @@ + @@ -88,14 +89,18 @@ + + + + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 1b5b246..cdb25c7 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -68,6 +68,7 @@ + + + + + + @@ -127,14 +134,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json index 4fbbf6b..6ae9947 100755 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "autoload": { "psr-4": { - "Glhd\\Ansipants\\": "src/" + "Glhd\\AnsiPants\\": "src/" } }, "autoload-dev": { @@ -32,7 +32,7 @@ "tests/TestCase.php" ], "psr-4": { - "Glhd\\Ansipants\\Tests\\": "tests/" + "Glhd\\AnsiPants\\Tests\\": "tests/" } }, "scripts": { @@ -42,7 +42,7 @@ "extra": { "laravel": { "providers": [ - "Glhd\\Ansipants\\Support\\AnsipantsServiceProvider" + "AnsiPantsServiceProvider" ] } }, diff --git a/config/ansipants.php b/config/ansipants.php deleted file mode 100644 index 607b81e..0000000 --- a/config/ansipants.php +++ /dev/null @@ -1,12 +0,0 @@ -chars, $this->flags] = $parser->parse(); + } + + public function __toString(): string + { + // TODO: Implement __toString() method. + } +} diff --git a/src/Support/AnsiPantsServiceProvider.php b/src/Support/AnsiPantsServiceProvider.php new file mode 100755 index 0000000..4b42b39 --- /dev/null +++ b/src/Support/AnsiPantsServiceProvider.php @@ -0,0 +1,19 @@ +bootConfig(); - // $this->bootViews(); - // $this->bootBladeComponents(); - } - - public function register() - { - $this->mergeConfigFrom($this->packageConfigFile(), 'ansipants'); - } - - protected function bootViews() : self - { - $this->loadViewsFrom($this->packageViewsDirectory(), 'ansipants'); - - $this->publishes([ - $this->packageViewsDirectory() => $this->app->resourcePath('views/vendor/ansipants'), - ], 'ansipants-views'); - - return $this; - } - - protected function bootBladeComponents() : self - { - if (version_compare($this->app->version(), '8.0.0', '>=')) { - Blade::componentNamespace('Glhd\\Ansipants\\Components', 'ansipants'); - } - - return $this; - } - - protected function bootConfig() : self - { - $this->publishes([ - $this->packageConfigFile() => $this->app->configPath('ansipants.php'), - ], 'ansipants-config'); - - return $this; - } - - protected function packageConfigFile(): string - { - return dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'ansipants.php'; - } - - protected function packageTranslationsDirectory(): string - { - return dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'translations'; - } - - protected function packageViewsDirectory(): string - { - return dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'views'; - } -} diff --git a/src/Support/Facades/Ansi.php b/src/Support/Facades/Ansi.php new file mode 100644 index 0000000..3208010 --- /dev/null +++ b/src/Support/Facades/Ansi.php @@ -0,0 +1,13 @@ +