Skip to content

Commit

Permalink
Implement configuration in runme.yaml (#505)
Browse files Browse the repository at this point in the history
This PR introduces an implementation of file-based configuration in a
form of `runme.yaml`.
  • Loading branch information
adambabik authored Feb 27, 2024
1 parent 4ac5a80 commit d8cba73
Show file tree
Hide file tree
Showing 33 changed files with 6,206 additions and 178 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
rev: v2.2.4
hooks:
- id: codespell
args: ["-L=ndoes,nd"] # words that are preceeded with "\n"
args: ["-L=ndoes,nd,clen"] # 2x words that are preceeded with "\n"; cLen
exclude: (package.*\.json$|go\.sum)
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
Expand Down
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
"list",
]
},
{
"name": "Debug CLI beta run",
"type": "go",
"mode": "auto",
"request": "launch",
"program": "${workspaceFolder}/main.go",
"buildFlags": "-ldflags=-X=github.com/stateful/runme/internal/version.BuildVersion=99.9.9",
"args": [
"--filename=test.md",
"beta",
"run",
"echo-env",
"--category=echo",
]
},
{
"name": "Debug server",
"type": "go",
Expand Down
46 changes: 46 additions & 0 deletions experimental/runme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# EXPERIMENTAL: This is a work in progress and may change at any time.
# The idea behind runme.yaml is to provide a way to define consistent
# configuration per project, regardless whether blocks from Markdown
# are executed in VS Code or using the runme CLI.
#
# You can test it with the "runme beta" commands.
version: v1alpha1

# Indicate the root of the runme project. "." means that
# the project root directory will be used.
project:
dir: "."
find_repo_upward: true
ignore:
- "node_modules"
- ".venv"
disable_gitignore: false

# It's possible to point at a single file.
# filename: "README.md"

# List of dotenv files to load.
env:
use_system_env: true
sources:
- ".env"
- ".env.local"

# The list of filters to apply to blocks.
# "condition" must return a boolean value.
# You can learn about the syntax at https://expr-lang.org/docs/language-definition.
filters:
# Do not allow unnamed code blocks.
- type: "FILTER_TYPE_BLOCK"
condition: "name != ''"
# Do not allow code blocks without a language.
- type: "FILTER_TYPE_BLOCK"
condition: "language != ''"
# Do not allow code blocks starting with "test".
- type: "FILTER_TYPE_BLOCK"
condition: "!hasPrefix(name, 'test')"

log:
enabled: true
path: "/var/tmp/runme.log"
verbose: true
25 changes: 23 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ module github.com/stateful/runme/v3
go 1.22

require (
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.32.0-20240212200630-3014d81c3a48.1
github.com/Masterminds/semver/v3 v3.2.1
github.com/Microsoft/go-winio v0.6.1
github.com/atotto/clipboard v0.1.4
github.com/bufbuild/protovalidate-go v0.5.2
github.com/charmbracelet/bubbletea v0.25.0
github.com/charmbracelet/lipgloss v0.9.1
github.com/cli/cli/v2 v2.44.1
github.com/containerd/console v1.0.4
github.com/creack/pty v1.1.21
github.com/expr-lang/expr v1.16.0
github.com/fatih/color v1.16.0
github.com/go-git/go-billy/v5 v5.5.0
github.com/gobwas/glob v0.2.3
Expand All @@ -24,8 +27,10 @@ require (
github.com/oklog/ulid/v2 v2.1.0
github.com/rogpeppe/go-internal v1.12.0
github.com/rwtodd/Go.Sed v0.0.0-20230610052213-ba3e9c186f0a
github.com/spf13/afero v1.11.0
github.com/vektah/gqlparser/v2 v2.5.11
github.com/yuin/goldmark v1.7.0
go.uber.org/dig v1.17.0
go.uber.org/multierr v1.11.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
golang.org/x/oauth2 v0.17.0
Expand All @@ -38,12 +43,26 @@ require (

require (
dario.cat/mergo v1.0.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/cli/go-gh/v2 v2.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/cel-go v0.19.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
golang.org/x/net v0.21.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

require (
Expand All @@ -52,7 +71,7 @@ require (
github.com/cli/go-gh v1.2.1
github.com/cli/safeexec v1.0.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-playground/locales v0.14.1 // indirect
Expand All @@ -70,7 +89,7 @@ require (
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f // indirect
github.com/sergi/go-diff v1.3.1 // indirect
Expand All @@ -93,6 +112,7 @@ require (
github.com/go-playground/assert/v2 v2.2.0
github.com/go-playground/validator/v10 v10.18.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/henvic/httpretty v0.1.3
Expand All @@ -103,6 +123,7 @@ require (
github.com/pkg/term v1.2.0-beta.2.0.20211217091447-1a4a3b719465
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
go.uber.org/zap v1.27.0
golang.org/x/sync v0.6.0
Expand Down
Loading

0 comments on commit d8cba73

Please sign in to comment.