Files
summercms/cmd/summer/commands_documented_test.go
Jakub Zych 33460607db feat(summer): help, examples and hints for every tool command
- build runs go build under a spinner on a terminal and ends with
  'Built bin/<name> in <time>'; make:* print 'Created <path>' per file
- make:*, plugin:add, new, parity:*, docs:build, docs:sync and every
  delegate get long help and examples; delegates note that global options
  pass through to the application binary
- make:* failures (no summer.yaml, invalid plugin ID or name, existing
  artifact, unknown plugin) explain themselves and suggest a command
- docs:build and docs:sync return bonfire.Reported after the problem list
- TestCommandsDocumented covers the tool commands too
- docs: Upgrading to 0.4, delegates and global options, make: results and
  hints, the checklist for a finished command
2026-10-21 13:25:53 +02:00

43 lines
1.7 KiB
Go

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 command of the summer tool (its delegates included) and of
// an application binary has a description, long help, examples and
// described arguments and options, and the test fails on any gap.
func TestCommandsDocumented(t *testing.T) {
commands := append(toolCommands(), applicationCommands()...)
for _, problem := range bonfire.CheckDocs(commands) {
t.Error(problem)
}
}