Updates to the update command

- Renamed to 'rebuild'
- Uses config option rather than command-line flag
This commit is contained in:
shalvah
2018-10-13 09:46:02 +01:00
parent 1e31759105
commit d86fa76c24
2 changed files with 7 additions and 9 deletions

View File

@@ -274,10 +274,10 @@ APP_URL=http://yourapp.app
If you want to modify the content of your generated documentation, go ahead and edit the generated `index.md` file.
The default location of this file is: `public/docs/source/index.md`.
After editing the markdown file, use the `apidoc:update` command to rebuild your documentation as a static HTML file.
After editing the markdown file, use the `apidoc:rebuild` command to rebuild your documentation as a static HTML file.
```sh
$ php artisan apidoc:update
$ php artisan apidoc:rebuild
```
As an optional parameter, you can use `--location` to tell the update command where your documentation can be found.

View File

@@ -12,16 +12,14 @@ class UpdateDocumentation extends Command
*
* @var string
*/
protected $signature = 'apidoc:update
{--location=public/docs : The documentation location}
';
protected $signature = 'apidoc:rebuild';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update and rebuild your API documentation from your markdown file.';
protected $description = 'Rebuild your API documentation from your markdown file.';
/**
* Create a new command instance.
@@ -40,16 +38,16 @@ class UpdateDocumentation extends Command
*/
public function handle()
{
$outputPath = $this->option('location');
$outputPath = config('apidoc.output');
$documentarian = new Documentarian();
if (! is_dir($outputPath)) {
$this->error('There is no generated documentation available at '.$outputPath.'.');
$this->error('There is no existing documentation available at '.$outputPath.'.');
return false;
}
$this->info('Updating API HTML code');
$this->info('Rebuilding API HTML code from '.$outputPath.'/source/index.md');
$documentarian->generate($outputPath);