Jelajahi Sumber

Move Globals::SCRIBE_VERSION to Scribe::VERSION

shalvah 2 tahun lalu
induk
melakukan
d694714e02

+ 3 - 2
src/Commands/GenerateDocumentation.php

@@ -15,6 +15,7 @@ use Knuckles\Scribe\Tools\ConsoleOutputUtils as c;
 use Knuckles\Scribe\Tools\DocumentationConfig;
 use Knuckles\Scribe\Tools\ErrorHandlingUtils as e;
 use Knuckles\Scribe\Tools\Globals;
+use Knuckles\Scribe\Scribe;
 use Knuckles\Scribe\Writing\Writer;
 use Shalvah\Upgrader\Upgrader;
 
@@ -207,13 +208,13 @@ class GenerateDocumentation extends Command
 
                 if (!$this->input->isInteractive()) {
                     $this->info("Run `php artisan scribe:upgrade` from an interactive terminal to update your config file automatically.");
-                    $this->info(sprintf("Or see the full changelog at: https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md,", Globals::SCRIBE_VERSION));
+                    $this->info(sprintf("Or see the full changelog at: https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md,", Scribe::VERSION));
                     return;
                 }
 
                 if ($this->confirm("Let's help you update your config file. Accept changes?")) {
                     $upgrader->upgrade();
-                    $this->info(sprintf("✔ Updated. See the full changelog: https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md", Globals::SCRIBE_VERSION));
+                    $this->info(sprintf("✔ Updated. See the full changelog: https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md", Scribe::VERSION));
                 }
             }
         } catch (\Throwable $e) {

+ 2 - 2
src/Commands/Upgrade.php

@@ -3,7 +3,7 @@
 namespace Knuckles\Scribe\Commands;
 
 use Illuminate\Console\Command;
-use Knuckles\Scribe\Tools\Globals;
+use Knuckles\Scribe\Scribe;
 use Shalvah\Upgrader\Upgrader;
 
 class Upgrade extends Command
@@ -58,7 +58,7 @@ class Upgrade extends Command
 
         if (!$isMajorUpgrade) {
             $this->info("✔ Done.");
-            $this->info(sprintf("See the full changelog at https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md", Globals::SCRIBE_VERSION));
+            $this->info(sprintf("See the full changelog at https://github.com/knuckleswtf/scribe/blob/%s/CHANGELOG.md", Scribe::VERSION));
             return;
         }
 

+ 3 - 1
src/Scribe.php

@@ -8,6 +8,8 @@ use Symfony\Component\HttpFoundation\Request;
 
 class Scribe
 {
+    public const VERSION = '4.x-dev';
+
     /**
      * Specify a callback that will be executed just before a response call is made
      * (after configuring the environment and starting a transaction).
@@ -56,4 +58,4 @@ class Scribe
     {
         Globals::$__instantiateFormRequestUsing = $callable;
     }
-}
+}

+ 0 - 2
src/Tools/Globals.php

@@ -4,8 +4,6 @@ namespace Knuckles\Scribe\Tools;
 
 class Globals
 {
-    public const SCRIBE_VERSION = '4.x-dev';
-
     public static bool $shouldBeVerbose = false;
 
     /*

+ 2 - 1
src/Tools/WritingUtils.php

@@ -2,6 +2,7 @@
 
 namespace Knuckles\Scribe\Tools;
 
+use Knuckles\Scribe\Scribe;
 use Symfony\Component\VarExporter\VarExporter;
 
 class WritingUtils
@@ -204,6 +205,6 @@ class WritingUtils
     public static function getVersionedAsset(string $assetPath): string
     {
         $index = strrpos($assetPath, ".");
-        return substr_replace($assetPath, '-'.Globals::SCRIBE_VERSION, $index, 0);
+        return substr_replace($assetPath, '-'.Scribe::VERSION, $index, 0);
     }
 }