Browse Source

Update doc

shalvah 5 years ago
parent
commit
17c3f5a928

+ 5 - 5
docs/migrating.md

@@ -39,15 +39,15 @@ _After you've done all of the above_, delete your `resources/docs/` and `public/
 - The `laravel.autoload` key is now `laravel.add_routes`, and is `true` by default.
 - The `laravel.docs_url` key is now `/docs` by default (no longer `/doc`). This means if you're using `laravel` docs type, your docs will be at <your-app>/docs and <your-app>/docs.json.
 - The Markdown output is now a set of files, located in `resources/docs`. The route files are located in `resources/docs/groups` and are split by groups (1 group per file).
-- The `rebuild` command has been removed. By default, when you run `php artisan scribe:generate`, Scribe will not overwrite any Markdown files you've modified. If you want Scribe to do so, run with `--force`. 
+- The `rebuild` command has been removed. Instead, if you want Scribe to skip the extraction phase and go straight to converting the existing Markdown to HTML, run `php artisan scribe:generate --no-extraction`.
 
 ### Low impact
 - `logo` is now `false` by default, so no logo spot will be shown. Also, if you specify a logo, it will no longer be copied to the docs folder. Rather, the path to be logo will be used as-is as the `src` for the `<img>` tag in the generated doc. This means that you must use a path that's publicly accessible. 
 For example, if your logo is in `public/img`:
-- set `'logo' => '../img/logo.png'` for `static` type (output folder is `public/docs`)
-- set `'logo' => 'img/logo.png'` for `laravel` type
-
-You can also use a URL.
+  - set `'logo' => '../img/logo.png'` for `static` type (output folder is `public/docs`)
+  - set `'logo' => 'img/logo.png'` for `laravel` type
+  
+  You can also use a URL instead.
 
 ## Advanced users
 It's a new package with a different name, so a few things have changed. This section is especially important if you've written any custom strategies or extended any of the provided classes.

+ 1 - 1
docs/plugins.md

@@ -116,7 +116,7 @@ class AddPaginationParameters extends Strategy
 }
 ```
 
-Alternatively, if you're creating a strategy that you'd like people to download and install via Composer, you can generate one from [this GitHub template](https://github.com/shalvah/scribe-plugin-template). 
+Alternatively, if you're creating a strategy that you'd like people to download and install via Composer, you can generate one from [this GitHub template](https://github.com/knuckleswtf/scribe-plugin-template). 
 
 ## Writing strategies
 Let's take a look at the contents of our Strategy class.

+ 1 - 1
src/Writing/PostmanCollectionWriter.php

@@ -43,7 +43,7 @@ class PostmanCollectionWriter
         $this->auth = config('scribe.postman.auth');
     }
 
-    public function getCollection()
+    public function makePostmanCollection()
     {
         $collection = [
             'variables' => [],

+ 1 - 1
src/Writing/Writer.php

@@ -179,7 +179,7 @@ class Writer
             ['routeGroups' => $routes, 'baseUrl' => $this->baseUrl]
         );
 
-        return $writer->getCollection();
+        return $writer->makePostmanCollection();
     }
 
     protected function performFinalTasksForLaravelType(): void

+ 15 - 15
tests/Unit/PostmanCollectionWriterTest.php

@@ -14,7 +14,7 @@ class PostmanCollectionWriterTest extends TestCase
         \Config::set('scribe.title', 'Test API');
 
         $writer = new PostmanCollectionWriter(new Collection(), '');
-        $collection = $writer->getCollection();
+        $collection = $writer->makePostmanCollection();
 
         $this->assertSame('Test API', json_decode($collection)->info->name);
     }
@@ -24,7 +24,7 @@ class PostmanCollectionWriterTest extends TestCase
         \Config::set('app.name', 'Fake App');
 
         $writer = new PostmanCollectionWriter(new Collection(), '');
-        $collection = $writer->getCollection();
+        $collection = $writer->makePostmanCollection();
 
         $this->assertSame('Fake App API', json_decode($collection)->info->name);
     }
@@ -36,7 +36,7 @@ class PostmanCollectionWriterTest extends TestCase
         ]);
 
         $writer = new PostmanCollectionWriter(new Collection(), '');
-        $collection = $writer->getCollection();
+        $collection = $writer->makePostmanCollection();
 
         $this->assertSame('A fake description', json_decode($collection)->info->description);
     }
@@ -44,7 +44,7 @@ class PostmanCollectionWriterTest extends TestCase
     public function testAuthIsNotIncludedWhenNull()
     {
         $writer = new PostmanCollectionWriter(new Collection(), '');
-        $collection = $writer->getCollection();
+        $collection = $writer->makePostmanCollection();
 
         $this->assertArrayNotHasKey('auth', json_decode($collection, true));
     }
@@ -60,7 +60,7 @@ class PostmanCollectionWriterTest extends TestCase
         ]);
 
         $writer = new PostmanCollectionWriter(new Collection(), '');
-        $collection = $writer->getCollection();
+        $collection = $writer->makePostmanCollection();
 
         $this->assertSame($auth, json_decode($collection, true)['auth']);
     }
@@ -75,7 +75,7 @@ class PostmanCollectionWriterTest extends TestCase
         $collection = $this->createMockRouteGroup([$route], 'Group');
 
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $this->assertSame('Group', data_get($collection, 'item.0.name'), 'Group name exists');
 
@@ -96,7 +96,7 @@ class PostmanCollectionWriterTest extends TestCase
     {
         $collection = $this->createMockRouteGroup([$this->createMockRouteData('fake')]);
         $writer = new PostmanCollectionWriter($collection, 'https://fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $this->assertSame('https', data_get($collection, 'item.0.item.0.request.url.protocol'));
     }
@@ -109,7 +109,7 @@ class PostmanCollectionWriterTest extends TestCase
 
         $collection = $this->createMockRouteGroup([$route], 'Group');
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $this->assertContains([
             'key' => 'X-Fake',
@@ -121,7 +121,7 @@ class PostmanCollectionWriterTest extends TestCase
     {
         $collection = $this->createMockRouteGroup([$this->createMockRouteData('fake/{param}')]);
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $item = data_get($collection, 'item.0.item.0');
         $this->assertSame('fake/{param}', $item['name'], 'Name defaults to path');
@@ -140,7 +140,7 @@ class PostmanCollectionWriterTest extends TestCase
 
         $collection = $this->createMockRouteGroup([$fakeRoute]);
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $variableData = data_get($collection, 'item.0.item.0.request.url.variable');
 
@@ -173,7 +173,7 @@ class PostmanCollectionWriterTest extends TestCase
 
         $collection = $this->createMockRouteGroup([$fakeRoute]);
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $variableData = data_get($collection, 'item.0.item.0.request.url.query');
 
@@ -204,7 +204,7 @@ class PostmanCollectionWriterTest extends TestCase
 
         $collection = $this->createMockRouteGroup([$fakeRoute]);
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $variableData = data_get($collection, 'item.0.item.0.request.url.query');
 
@@ -230,7 +230,7 @@ class PostmanCollectionWriterTest extends TestCase
 
         $collection = $this->createMockRouteGroup([$fakeRoute]);
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $variableData = data_get($collection, 'item.0.item.0.request.url.query');
 
@@ -262,7 +262,7 @@ class PostmanCollectionWriterTest extends TestCase
         $route['headers'] = $expectedRemovedHeaders;
         $collection = $this->createMockRouteGroup([$route], 'Group');
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         foreach ($expectedRemovedHeaders as $key => $value) {
             $this->assertNotContains(compact('key', 'value'), data_get($collection, 'item.0.item.0.request.header'));
@@ -296,7 +296,7 @@ class PostmanCollectionWriterTest extends TestCase
         $route['headers'] = ['X-Authorization' => 'Test'];
         $collection = $this->createMockRouteGroup([$route], 'Group');
         $writer = new PostmanCollectionWriter($collection, 'fake.localhost');
-        $collection = json_decode($writer->getCollection(), true);
+        $collection = json_decode($writer->makePostmanCollection(), true);
 
         $this->assertContains([
             'key' => 'X-Authorization',