Documentation
¶
Overview ¶
Package generate writes documents from SpecArch files. The techspec target writes an arc42 technical specification in Markdown with Mermaid diagrams, and rewrites the generated regions of hand-written Markdown.
Index ¶
- Constants
- Variables
- func Changes(root *yaml.Node, relRoot string, state *State) string
- func Commissioning(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func DeploymentGuide(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Document(target string, root *yaml.Node, relRoot string, impls []Implementation, ...) (text string, ok bool)
- func DocumentName(target string) string
- func Estate(root *yaml.Node, relEstate string, modules []EstateModule, marks []Mark) string
- func Handover(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Holding(root *yaml.Node, impls []Implementation, target string) []string
- func IsDocumentTarget(t string) bool
- func Questions(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Releases(root *yaml.Node, relRoot string, state *State) string
- func Requirements(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Site(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Techspec(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Testplan(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- func Traceability(root *yaml.Node, relRoot string, impls []Implementation, state *State) string
- type EstateModule
- type IdiomUse
- type Implementation
- type LeftOut
- type Listed
- type Mark
- type MarkerError
- type Reference
- type SiteParts
- type State
- type Withheld
Constants ¶
const CompanionName = "specarch.md"
CompanionName is the hand-written explanation beside a specification's root file, whose marked regions the techspec target rewrites.
const EstateName = "estate.md"
EstateName is the file the module map of an estate is written to, beside the modules' own documents.
Variables ¶
var ( DocumentTargets = []string{"techspec", "requirements", "testplan", "traceability", "deployment", "commissioning", "handover", "questions", "problems", "changes", "releases", "html", "manual", "operations"} BuiltDocuments = map[string]bool{"techspec": true, "requirements": true, "testplan": true, "traceability": true, "deployment": true, "commissioning": true, "handover": true, "questions": true, "problems": true, "changes": true, "releases": true, "html": true} )
DocumentTargets are the document targets of the design, in the order they are listed; BuiltDocuments says which this program has.
Functions ¶
func Commissioning ¶
Commissioning writes the commissioning test procedure, one section per environment in the order a release reaches them, with a column for each step's result, and the sign-off sheet.
func DeploymentGuide ¶
DeploymentGuide writes the deployment guide: the environments and the promotion path, the settings and their values in each installation, the installations of each implementation, then release, rollback and the migrations.
func Document ¶
func Document(target string, root *yaml.Node, relRoot string, impls []Implementation, state *State) (text string, ok bool)
Document writes the document of a target from a specification and its implementation files. ok is false for a target this package does not write.
func DocumentName ¶
DocumentName is the file a target writes in the folder it owns.
func Estate ¶ added in v0.7.0
Estate writes the module map of an estate (ADR-113): the modules with the version each is held at, and the references between them through their dependencies, drawn as the context diagram. marks are the estate's own problems, each shown at its module.
func Handover ¶ added in v0.7.0
Handover writes the handover document for the engineers of the customer who runs an environment (ADR-129): what they receive, what stays whose responsibility, how each implementation builds a release and the licences of its dependencies, what the hosts must provide, every setting, the migrations, how a release is installed and rolled back, backup and restore, what is watched, the checks to run after installing, the acceptance tests and the sign-off sheet, in plain words for a reader who knows nothing of SpecArch.
func Holding ¶ added in v0.2.0
func Holding(root *yaml.Node, impls []Implementation, target string) []string
Holding lists the open must and should questions that block what a code target reads: the sections its implementation files declare under targets.<name>.reads, or every section when none does.
func IsDocumentTarget ¶ added in v0.2.0
IsDocumentTarget reports whether a target name is a document's.
func Questions ¶ added in v0.2.0
Questions writes the open questions document, which specarch gaps also prints: the counts, the questions by stage, and which outputs are ready, drafts or waiting.
func Requirements ¶
Requirements writes the requirements specification: the stakeholders, their needs, and the requirements with every attribute, in the order of a requirements specification of ISO/IEC/IEEE 29148.
func Site ¶ added in v0.6.0
Site writes the specification as one HTML page that needs no server and makes no request: an overview first, then every section with an anchor at every element, named by its pointer, the problems linked both ways with the entries they mark, a search and light and dark colours.
func Techspec ¶
Techspec writes the technical specification of one specification: its merged document and its implementation files. relRoot is the root file's path as seen from the output folder; it goes into the header.
func Testplan ¶
Testplan writes the test plan and the test case specifications: the levels, how each implementation runs the tests, then every design test grouped by its subject, then the derived cases left out.
func Traceability ¶
Traceability writes the traceability matrix from needs through requirements to what satisfies and verifies them, and lists the gaps. It names elements by ID only; their Insights are in the documents that describe them.
Types ¶
type EstateModule ¶ added in v0.7.0
type EstateModule struct {
Key string
Location string // as the estate writes it
Version string // the version the estate lists
About string // the estate's description of it
RelRoot string // its root file from the document's folder; "" when it was not found
Root *yaml.Node // its specification; nil when it was not found or did not parse
}
EstateModule is one module an estate lists, as the module map shows it.
type IdiomUse ¶ added in v0.4.0
IdiomUse is one idiom as an implementation file uses it: shipped, overridden (with the parts the project replaces and the version it copied), the project's own, or excluded, with the reason.
type Implementation ¶
type Implementation struct {
Node *yaml.Node
Rel string
Path string
Idioms []IdiomUse // the idioms the file uses, as the validator resolves them
}
Implementation is one implementation file of the specification, parsed. Rel is its path as seen from the output folder; Path as given.
type LeftOut ¶ added in v0.3.0
type LeftOut struct {
Subject, Case, Scenario, Reason string
}
LeftOut is one derived case the test plan lists as left out.
type Listed ¶ added in v0.6.0
type Listed struct {
ID, Severity, Rule, Message string
// Line is the problem's line in the problems file, and Notes its
// notes there.
Line string
Notes []string
Pointer string
}
Listed is one problem as the problems file lists it, and the pointer of the entry it marks ("" for one outside the specification).
type Mark ¶ added in v0.6.0
type Mark struct {
Severity string // error or warning
File string // as the document names it, from its folder
Line, Column int
// Pointer leads into the merged specification; it is "" when the
// problem is in a file outside it, such as an implementation file or a
// record.
Pointer string
Rule, Message, ID string
}
Mark is one error or warning of the specification as a document marks it (ADR-065): a Problem paragraph at the element its pointer leads to, or under the document's summary when the document shows no element for it.
type MarkerError ¶
MarkerError is a problem with the markers of a hand-written document.
func RewriteMarkers ¶
func RewriteMarkers(text string, design *yaml.Node) (string, []MarkerError)
RewriteMarkers replaces the text between each pair of markers with what the begin marker names, drawn from the design file, and leaves every other line as it is. It follows the markersWellFormed algorithm: regions never nest, every begin has an end, and a marker for an object that does not exist is an error, never an empty block.
type Reference ¶ added in v0.7.0
type Reference struct {
Path, Text, Specification, Version, Waits string
}
Reference is one reference into another specification that waits: the specification is not given, or the element is blocked there.
type SiteParts ¶ added in v0.6.0
type SiteParts struct {
// Workflows are each workflow's diagram as specarch-gen-bpmn draws it
// in SVG, by the workflow's name.
Workflows map[string]string
// Previews are each page's screen as specarch-gen-ui writes it, with
// its style sheet inside and its scripts left out, by the page's name.
Previews map[string]string
// NoPreview says, by page name, why a page has no screen preview, and
// NoPreviews why no page has one, when that is so.
NoPreview map[string]string
NoPreviews string
// Problems are every error, warning and open question in the order of
// the problems file.
Problems []Listed
}
SiteParts are what the html target shows that other generators make, and the problems it lists; specarch gathers them before the page is written.
type State ¶ added in v0.2.0
type State struct {
Missing map[string][]string // element pointer -> the keys missing there, as the validator found them
Approval string // one sentence: approved on, not approved because
Approved bool
LeftOut []LeftOut // the derived cases of rank other no test covers, for the test plan
// Records are the record files beside the specification, parsed, in
// path order, and RecordsRel their folder as the document names it.
Records []*yaml.Node
RecordsRel string
// StatePaths are, per entity with a state machine, its paths from an
// initial to a terminal state, for the test plan.
StatePaths map[string][]string
// Places are, per block of a question that names what the source
// gives, the file and line of the element whose key it leaves out.
Places map[string]string
// Marks are the errors and warnings of the specification, which the
// documents mark at their elements.
Marks []Mark
// Site is what the html target shows that other generators make, and
// the problems it lists.
Site *SiteParts
// References are the references into other specifications that the
// run could not resolve, in document order.
References []Reference
// Withheld is, for a document for everyone, the internal elements it
// left out (ADR-119); nil for a document that holds every element.
Withheld *Withheld
// contains filtered or unexported fields
}
State is what the questions document needs beyond the specification: the keys the open questions cover, and where the approval stands.
type Withheld ¶ added in v0.7.0
type Withheld struct {
Pointers []string
// Questions are the pointers of the open questions left out, whose
// every pointer is at or under an element left out.
Questions []string
Sections []string // the sections that lost an element, in document order
Counts map[string]int // by section
// contains filtered or unexported fields
}
Withheld is what a document for everyone leaves out (ADR-119): the pointer of every internal element, outermost only, and how many each section lost, in document order.
func ForEveryone ¶ added in v0.7.0
ForEveryone is the specification as a document for everyone reads it: every element whose audience is internal left out, with what is inside it; the satisfies, verifies and needs entries that name a requirement or need left out; and the open questions whose every pointer is at or under an element left out. The nodes that stay are the specification's own, so their pointers do not change.
func (*Withheld) Covers ¶ added in v0.7.0
Covers reports whether a pointer is at or under an element left out.
func (*Withheld) ForEveryoneImplementation ¶ added in v0.7.0
ForEveryoneImplementation is an implementation file as a document for everyone reads it: the mappings of an element left out are left out, and so are the satisfies entries that name a requirement left out.