feat: Artisan checklist for application commands, hints and coverage gate
- migrate, migrate:rollback and deferred:purge gain --pretend and --force; they and queue:clear confirm only in production on an interactive terminal, so deploys over SSH proceed as before - result lines: Applied N migrations, Rolled back <id> of <plugin>, Cleared N jobs from <queue> - --json for migrate:status, key:generate, route:list, admin:token:create, admin:token:list, admin:token:scopes and websockets:health; -q keeps the key and the token - hints for an empty DSN, an unreachable database, an invalid app.key, a missing uploads bucket and an application binary run below its root - flare and websockets:health return bonfire.Reported after printing - long help and examples for every application command, greeter:hello and blog:publish; cmd/summer TestCommandsDocumented fails on any gap
This commit is contained in:
41
cmd/summer/commands_documented_test.go
Normal file
41
cmd/summer/commands_documented_test.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/bonfire"
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
"git.golem15.com/golem15/summercms/modules/compass"
|
||||
"git.golem15.com/golem15/summercms/modules/conga"
|
||||
"git.golem15.com/golem15/summercms/modules/flare"
|
||||
"git.golem15.com/golem15/summercms/modules/lagoon"
|
||||
"git.golem15.com/golem15/summercms/modules/lighthouse/centrifugo"
|
||||
"git.golem15.com/golem15/summercms/modules/surf"
|
||||
)
|
||||
|
||||
// applicationCommands is every command the framework gives an application
|
||||
// binary, built the way docsCommands does. The blog example's blog:publish
|
||||
// is checked by its own package's test: the tool must not import example
|
||||
// plugins (TestToolDoesNotImportExamplePlugins).
|
||||
func applicationCommands() []bonfire.Command {
|
||||
app := backpack.New(&compass.Config{})
|
||||
var cmds []bonfire.Command
|
||||
cmds = append(cmds, lagoon.RuntimeCommands(app, nil)...)
|
||||
cmds = append(cmds, conga.RuntimeCommands(app, nil)...)
|
||||
cmds = append(cmds, surf.ServeCommand(app, nil), surf.RouteListCommand(app, nil))
|
||||
cmds = append(cmds, cabana.RuntimeCommands(app)...)
|
||||
cmds = append(cmds, centrifugo.Commands(app)...)
|
||||
cmds = append(cmds, flare.Commands(app)...)
|
||||
return cmds
|
||||
}
|
||||
|
||||
// TestCommandsDocumented is the framework's documentation coverage gate
|
||||
// (D-17): every framework command has a description, long help, examples
|
||||
// and described arguments and options, and the test fails on any gap.
|
||||
func TestCommandsDocumented(t *testing.T) {
|
||||
commands := applicationCommands()
|
||||
for _, problem := range bonfire.CheckDocs(commands) {
|
||||
t.Error(problem)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user