Browse Source

Final cleanups

shalvah 2 years ago
parent
commit
92c128171c
2 changed files with 14 additions and 15 deletions
  1. 2 5
      routes/laravel.php
  2. 12 10
      src/Commands/Upgrade.php

+ 2 - 5
routes/laravel.php

@@ -3,7 +3,6 @@
 use Illuminate\Http\JsonResponse;
 use Illuminate\Support\Facades\Route;
 use Illuminate\Support\Facades\Storage;
-use Symfony\Component\HttpFoundation\BinaryFileResponse;
 
 $prefix = config('scribe.laravel.docs_url', '/docs');
 $middleware = config('scribe.laravel.middleware', []);
@@ -13,12 +12,10 @@ Route::middleware($middleware)
         Route::view($prefix, 'scribe.index')->name('scribe');
 
         Route::get("$prefix.postman", function () {
-            return new JsonResponse(
-                Storage::disk('local')->get('scribe/collection.json'), json: true
-            );
+            return new JsonResponse(Storage::disk('local')->get('scribe/collection.json'), json: true);
         })->name('scribe.postman');
 
         Route::get("$prefix.openapi", function () {
-            return new BinaryFileResponse(Storage::disk('local')->path('scribe/openapi.yaml'));
+            return response()->file(Storage::disk('local')->path('scribe/openapi.yaml'));
         })->name('scribe.openapi');
     });

+ 12 - 10
src/Commands/Upgrade.php

@@ -62,22 +62,24 @@ class Upgrade extends Command
             return;
         }
 
-        $this->upgradeToV4();
+        $this->finishV4Upgrade();
     }
 
-    protected function upgradeToV4(): void
+    protected function finishV4Upgrade(): void
     {
-        if ($this->confirm("Do you have any custom strategies?")) {
-            $this->line('1. Add a new property <info>public ?ExtractedEndpointData $endpointData;</info>.');
-            $this->line('2. Replace the <info>array $routeRules</info> parameter in __invoke() with <info>array $routeRules = []</info> .');
-        }
-        $this->newLine();
+        if (!($this->option('dry-run'))) {
+            if ($this->confirm("Do you have any custom strategies?")) {
+                $this->line('1. Add a new property <info>public ?ExtractedEndpointData $endpointData;</info>.');
+                $this->line('2. Replace the <info>array $routeRules</info> parameter in __invoke() with <info>array $routeRules = []</info> .');
+            }
+            $this->newLine();
 
-        if ($this->confirm("Did you customize the Blade templates used by Scribe?")) {
-            $this->warn('A few minor changes were made to the templates. See the release announcement for details.');
+            if ($this->confirm("Did you customize the Blade templates used by Scribe?")) {
+                $this->warn('A few minor changes were made to the templates. See the release announcement for details.');
+            }
+            $this->newLine();
         }
 
-        $this->newLine();
         $this->info("✔ Done.");
         $this->line("See the release announcement at <href=https://scribe.knuckles.wtf/blog/laravel-v4>http://scribe.knuckles.wtf/blog/laravel-v4</> for the full upgrade guide!");
     }