Skip to content

Commit c3c21e5

Browse files
Listener430ostermanautofix-ci[bot]coderabbitai[bot]milldr
authored
Support atmos docs generate feature natively (#934)
* docs generate * readme buildout using Gomplate 3.x with teml.Exec issue fixed * readme generationggomplate 3.11.8 work,s no terrafor yet * fix for windwos gomplate * gomodtidy * dependant acceptnace tests fix + draft test cases * Update internal/exec/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * use go-getter to download files * atmos.yaml * Update cmd/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * examples back * terrafrom test/mergo * moving fixtures to tests and reverting back the comments in template utils * test cases * initial version of documentation * mdx fixes * mdx layout fix * typo fix * defer removeTempDir move * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/test-cases/docs-generate.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * comments from pr * deleted README.md.gotmpl from the root * terraform test template * local atmos.yaml * Update pkg/schema/schema.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update cmd/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update internal/exec/template_utils.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update internal/exec/file_utils.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update internal/exec/template_utils.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update internal/exec/file_utils.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * changing func signatures * test cases * Tidy go.mod and go.sum * comments * Resolve merge conflicts in go.mod and go.sum * [autofix.ci] apply automated fixes * fix logging * intermediate results * [autofix.ci] apply automated fixes * Resolve merge conflicts in go.mod and go.sum * terrafrom docs and tests * docs generate test fix * initial linter feedback fix * Resolve merge conflicts in go.mod and go.sum * Resolve merge conflicts in go.mod and go.sum * default config * fixing test and linter * more linter * more test * tests coverage * [autofix.ci] apply automated fixes * more tests * more tests * docs update * unit test fix for win * [autofix.ci] apply automated fixes * Update internal/exec/template_utils_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * test update * Resolve merge conflicts in go.mod and go.sum * gogetter move to utils * Update internal/exec/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update pkg/config/default.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update pkg/config/load.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/fixtures/scenarios/docs-generate/atmos.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/fixtures/scenarios/docs-generate/readme/atmos.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update tests/fixtures/scenarios/docs-generate/atmos.yaml Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * adresses comments * linter * linter * snapshots and tests * Update internal/exec/template_utils.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * setting constants locally * tests * docs update with more detailed path info like it is done in !include * docs formatting updates * Update internal/exec/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update internal/exec/docs_generate.go Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> * Update website/docs/cli/commands/docs/docs-generate.mdx Co-authored-by: Dan Miller <[email protected]> * docs generate feedback implementation * linter * linter * docs update * err rename * docs update * moving docs section to top-level atmos config * tests update * add inline maps and tests for docs generation config * update docs --------- Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Dan Miller <[email protected]>
1 parent d4fa2fe commit c3c21e5

39 files changed

+2627
-21
lines changed

atmos.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,28 @@ settings:
383383
color: "${colors.muted}"
384384
italic: true
385385

386+
docs:
387+
generate:
388+
# Generate README in current working directory
389+
readme:
390+
base-dir: .
391+
input:
392+
- "./README.yaml"
393+
# To Do: template can be a remote URL/github, using this local for testing
394+
template: "https://raw.githubusercontent.com/cloudposse/.github/5a599e3b929f871f333cb9681a721d26b237d8de/README.md.gotmpl"
395+
# The final README
396+
output: "./README.md"
397+
terraform:
398+
source: src/
399+
enabled: false
400+
format: "markdown"
401+
show_providers: false
402+
show_inputs: true
403+
show_outputs: true
404+
sort_by: "name"
405+
hide_empty: false
406+
indent_level: 2
407+
386408
version:
387409
check:
388410
enabled: true

cmd/docs_generate.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package cmd
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
6+
e "github.com/cloudposse/atmos/internal/exec"
7+
)
8+
9+
// docsGenerateCmd is the subcommand under docs that groups generation operations.
10+
var docsGenerateCmd = &cobra.Command{
11+
Use: "generate",
12+
Short: "Generate documentation artifacts",
13+
Long: `Generate documentation by merging YAML data sources and applying templates.
14+
Supports native terraform-docs injection.`,
15+
Example: `Generate the README.md in the current directory:
16+
atmos docs generate readme`,
17+
Args: cobra.ExactArgs(1),
18+
ValidArgs: []string{"readme"},
19+
RunE: func(cmd *cobra.Command, args []string) error {
20+
if len(args) != 1 {
21+
return ErrInvalidArguments
22+
}
23+
err := e.ExecuteDocsGenerateCmd(cmd, args)
24+
if err != nil {
25+
return err
26+
}
27+
return nil
28+
},
29+
}
30+
31+
func init() {
32+
docsCmd.AddCommand(docsGenerateCmd)
33+
}

go.mod

+11-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)