diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b422b55..0d81b1fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,8 +48,8 @@ jobs: go-version: ${{ matrix.go }} - name: Build run: | - go build -o rdme main.go - ./rdme --version + go build -o runme main.go + ./runme --version - name: Test run: TZ=UTC go test ./... if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e4ed22a..959c7217 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: release on: push: tags: - - '*' + - "*" jobs: goreleaser: runs-on: ubuntu-latest @@ -14,13 +14,11 @@ jobs: id-token: write steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Prepare + - name: Prepare id: prepare run: | # Get rid of v prefix. @@ -31,29 +29,24 @@ jobs: if [[ "$ref_name" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then echo "pre_release=false" >> $GITHUB_ENV fi - - - name: Set up Go + - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.18' - - - name: Auth to GCP + go-version: "1.18" + - name: Auth to GCP uses: google-github-actions/auth@v0 with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} create_credentials_file: true export_environment_variables: true - - - name: Set up gcloud + - name: Set up gcloud uses: google-github-actions/setup-gcloud@v0 - - - name: Release notes + - name: Release notes run: | go run ./cmd/release-notes/main.go -version "${GITHUB_REF_NAME}" > ${{ runner.temp }}/releasenotes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: distribution: goreleaser @@ -63,7 +56,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} SCOOP_BUCKET_GITHUB_TOKEN: ${{ secrets.SCOOP_BUCKET_GITHUB_TOKEN }} - - - name: Copy to latest + - name: Copy to latest if: env.pre_release == 'false' - run: gsutil -m cp "gs://rdme-artifacts-b4e64f/${{ env.version }}/*" gs://rdme-artifacts-b4e64f/latest + run: gsutil -m cp "gs://runme-artifacts-41eac6/${{ env.version }}/*" gs://runme-artifacts-41eac6/latest diff --git a/.gitignore b/.gitignore index 25700377..96479fa2 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ gha-creds-*.json # Binary build with make rdme +runme # Logs *.log diff --git a/.goreleaser.yml b/.goreleaser.yml index 190949ef..b07c6695 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,4 +1,4 @@ -project_name: rdme +project_name: runme snapshot: name_template: "{{ incpatch .Version }}-next" @@ -69,13 +69,13 @@ archives: blobs: - provider: gs - bucket: rdme-artifacts-b4e64f + bucket: runme-artifacts-41eac6 ids: - cli folder: "{{ .Version }}" brews: - - name: rdme + - name: runme ids: - cli homepage: https://stateful.com @@ -84,7 +84,7 @@ brews: owner: stateful name: homebrew-tap token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" - url_template: "https://download.stateful.com/rdme/{{ .Version }}/{{ .ArtifactName }}" + url_template: "https://download.stateful.com/runme/{{ .Version }}/{{ .ArtifactName }}" dependencies: [] skip_upload: auto folder: Formula @@ -93,16 +93,16 @@ brews: name: release-bot email: bot@stateful.com install: | - bin.install "rdme" - (bash_completion/"rdme").write `#{bin}/rdme completion bash` - (fish_completion/"rdme.fish").write `#{bin}/rdme completion fish` - (zsh_completion/"_rdme").write `#{bin}/rdme completion zsh` + bin.install "runme" + (bash_completion/"runme").write `#{bin}/runme completion bash` + (fish_completion/"runme.fish").write `#{bin}/runme completion fish` + (zsh_completion/"_runme").write `#{bin}/runme completion zsh` test: | - assert_match "rdme #{version}", shell_output("#{bin}/rdme version") + assert_match "runme #{version}", shell_output("#{bin}/runme version") nfpms: - id: cli - package_name: rdme + package_name: runme builds: - cli replacements: @@ -119,7 +119,7 @@ nfpms: - rpm scoop: - url_template: "https://download.stateful.com/rdme/{{ .Version }}/{{ .ArtifactName }}" + url_template: "https://download.stateful.com/runme/{{ .Version }}/{{ .ArtifactName }}" bucket: owner: stateful name: scoop-bucket diff --git a/.vscode/launch.json b/.vscode/launch.json index 6d2ae066..8ea88c0e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,7 +14,7 @@ "host": "127.0.0.1" }, { - "name": "Launch rdme json", + "name": "Launch runme json", "type": "go", "request": "launch", "mode": "auto", diff --git a/Makefile b/Makefile index 4b697a65..7b3f924d 100644 --- a/Makefile +++ b/Makefile @@ -12,13 +12,13 @@ LDFLAGS := -s -w \ .PHONY: build build: - go build -o rdme -ldflags="$(LDFLAGS)" main.go + go build -o runme -ldflags="$(LDFLAGS)" main.go .PHONY: wasm wasm: WASM_OUTPUT ?= examples/web wasm: cp $(GO_ROOT)/misc/wasm/wasm_exec.js $(WASM_OUTPUT) - GOOS=js GOARCH=wasm go build -o $(WASM_OUTPUT)/rdme.wasm -ldflags="$(LDFLAGS)" ./web + GOOS=js GOARCH=wasm go build -o $(WASM_OUTPUT)/runme.wasm -ldflags="$(LDFLAGS)" ./web .PHONY: test test: diff --git a/README.md b/README.md index bbebbaa4..79a64735 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# rdme +# runme Discover and run code snippets directly from your `README.md` or other markdowns (defaults to local `README.md`). -rdme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. rdme is currently in early alpha. +runme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. runme is currently in early alpha. You can execute commands from a different directory using a `--chdir` flag. To select a different file than `README.md`, use `--filename`. @@ -12,16 +12,16 @@ To select a different file than `README.md`, use `--filename`. The easiest way on MacOS is to use Homebrew: ```sh -$ brew install stateful/tap/rdme +$ brew install stateful/tap/runme ``` -Alternatively, check out [rdme's releases](https://github.com/stateful/rdme/releases) and select +Alternatively, check out [runme's releases](https://github.com/stateful/runme/releases) and select a binary for your operating system. If you have Go developer tools installed, you can install it with `go install`: ```sh -$ go install github.com/stateful/rdme@latest +$ go install github.com/stateful/runme@latest ``` ## Contributing & Feedback diff --git a/cmd/release-notes/main.go b/cmd/release-notes/main.go index 9adf61d7..2708f4e2 100644 --- a/cmd/release-notes/main.go +++ b/cmd/release-notes/main.go @@ -34,28 +34,28 @@ var tpl = template.Must(template.New("").Funcs(template.FuncMap{"split": split}) ### macOS: -* [rdme_darwin_x86_64.tar.gz](https://download.stateful.com/rdme/{{ .Version }}/rdme_darwin_x86_64.tar.gz) -* [rdme_darwin_arm64.tar.gz](https://download.stateful.com/rdme/{{ .Version }}/rdme_darwin_arm64.tar.gz) +* [runme_darwin_x86_64.tar.gz](https://download.stateful.com/runme/{{ .Version }}/runme_darwin_x86_64.tar.gz) +* [runme_darwin_arm64.tar.gz](https://download.stateful.com/runme/{{ .Version }}/runme_darwin_arm64.tar.gz) ### Linux -* [rdme_linux_x86_64.deb](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_x86_64.deb) -* [rdme_linux_arm64.deb](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_arm64.deb) -* [rdme_linux_x86_64.rpm](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_x86_64.rpm) -* [rdme_linux_arm64.rpm](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_arm64.rpm) -* [rdme_linux_x86_64.apk](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_x86_64.apk) -* [rdme_linux_arm64.apk](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_arm64.apk) -* [rdme_linux_x86_64.tar.gz](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_x86_64.tar.gz) -* [rdme_linux_arm64.tar.tz](https://download.stateful.com/rdme/{{ .Version }}/rdme_linux_arm64.tar.gz) +* [runme_linux_x86_64.deb](https://download.stateful.com/runme/{{ .Version }}/runme_linux_x86_64.deb) +* [runme_linux_arm64.deb](https://download.stateful.com/runme/{{ .Version }}/runme_linux_arm64.deb) +* [runme_linux_x86_64.rpm](https://download.stateful.com/runme/{{ .Version }}/runme_linux_x86_64.rpm) +* [runme_linux_arm64.rpm](https://download.stateful.com/runme/{{ .Version }}/runme_linux_arm64.rpm) +* [runme_linux_x86_64.apk](https://download.stateful.com/runme/{{ .Version }}/runme_linux_x86_64.apk) +* [runme_linux_arm64.apk](https://download.stateful.com/runme/{{ .Version }}/runme_linux_arm64.apk) +* [runme_linux_x86_64.tar.gz](https://download.stateful.com/runme/{{ .Version }}/runme_linux_x86_64.tar.gz) +* [runme_linux_arm64.tar.tz](https://download.stateful.com/runme/{{ .Version }}/runme_linux_arm64.tar.gz) ### Windows -* [rdme_windows_x86_64.zip](https://download.stateful.com/rdme/{{ .Version }}/rdme_windows_x86_64.zip) -* [rdme_windows_arm64.zip](https://download.stateful.com/rdme/{{ .Version }}/rdme_windows_arm64.zip) +* [runme_windows_x86_64.zip](https://download.stateful.com/runme/{{ .Version }}/runme_windows_x86_64.zip) +* [runme_windows_arm64.zip](https://download.stateful.com/runme/{{ .Version }}/runme_windows_arm64.zip) ## Changelog -[Full changelog](https://github.com/stateful/rdme/compare/v{{ or .PreviousVersion "main" }}...v{{ .Version }}) +[Full changelog](https://github.com/stateful/runme/compare/v{{ or .PreviousVersion "main" }}...v{{ .Version }}) {{ range $value := .Commits -}} * {{ $value.SHA }}: {{ (split "\n" $value.Commit.Message)._0 }} ([@{{ $value.Author.Login }}]({{ $value.Author.HTMLURL }})) @@ -83,7 +83,7 @@ var flagsConfig = config{} func init() { flag.StringVar(&flagsConfig.Owner, "owner", "stateful", "Owner of the repository") - flag.StringVar(&flagsConfig.Repo, "repo", "rdme", "Repository name") + flag.StringVar(&flagsConfig.Repo, "repo", "runme", "Repository name") flag.StringVar(&flagsConfig.Version, "version", "", "The new version, for example v0.1.1") flag.Usage = func() { diff --git a/examples/README.md b/examples/README.md index 8417fdbf..395fb115 100644 --- a/examples/README.md +++ b/examples/README.md @@ -5,13 +5,13 @@ This is a basic snippet with shell command: ```sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ``` With `{name=hello}` you can annotate it and give it a nice name: ```sh {name=echo} -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ``` It can contain multiple lines too: @@ -25,13 +25,13 @@ $ echo "3" Also, the dollar sign is not needed: ```sh -echo "Hello, rdme! Again!" +echo "Hello, runme! Again!" ``` It works with `cd`, `pushd`, and similar because all lines are executed as a single script: ```sh -temp_dir=$(mktemp -d -t "rdme-") +temp_dir=$(mktemp -d -t "runme-") pushd $temp_dir echo "hi!" > hi.txt pwd @@ -52,6 +52,6 @@ import ( ) func main() { - fmt.Println("Hello from Go, rdme!") + fmt.Println("Hello from Go, runme!") } ``` diff --git a/examples/web/README.md b/examples/web/README.md index 3ebb16f1..deed9322 100644 --- a/examples/web/README.md +++ b/examples/web/README.md @@ -1,7 +1,7 @@ # WASM example -This is an example of running rdme in a browser using WASM. +This is an example of running runme in a browser using WASM. -First, run `make wasm` from the root of the project. It will build rdme and copy proper files into this directory. +First, run `make wasm` from the root of the project. It will build runme and copy proper files into this directory. Second, start a webserver in this directory, for example, `python -m http.server 9000` and open `http://localhost:9000` in a browser. In the Developer Tools > Console you should see parsed snippets of some README.md file. diff --git a/examples/web/index.html b/examples/web/index.html index 75b56b4d..9e834a97 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -18,8 +18,8 @@ "IyBUb3J0dWdhIEFQSQoKVGhlIEFQSSBidWlsdCBmb3IgW1RvcnR1Z2EgUHJvdG90eXBlXShodHRwczovL3d3dy5ub3Rpb24uc28vc3RhdGVmdWxocS9Ub3J0dWdhLVByb3RvdHlwZS1jNDA2ZGQ1ZmExYWQ0NTJkYmExNTU2MGE2Y2VhZDVmOSkuCgo+ICoqV2FybmluZyEqKiBBbGwgY29kZSBzbmlwcGV0cyBiZWxvdyBhc3N1bWUgeW91J3JlIG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jI3NmFmNjVhMSJ9CmBgYAo=" ); const go = new Go(); - WebAssembly.instantiateStreaming(fetch("rdme.wasm"), go.importObject).then((rdme) => { - go.run(rdme.instance); + WebAssembly.instantiateStreaming(fetch("runme.wasm"), go.importObject).then((runme) => { + go.run(runme.instance); console.log(GetSnippets(markdown)); console.log(GetDocument(markdown)); }); diff --git a/go.mod b/go.mod index d0591e65..5a28861c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/stateful/rdme +module github.com/stateful/runme go 1.18 diff --git a/internal/cmd/common.go b/internal/cmd/common.go index 7c882ac4..c4d9e135 100644 --- a/internal/cmd/common.go +++ b/internal/cmd/common.go @@ -7,8 +7,8 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/stateful/rdme/internal/document" - "github.com/stateful/rdme/internal/renderer" + "github.com/stateful/runme/internal/document" + "github.com/stateful/runme/internal/renderer" ) func getCodeBlocks() (document.CodeBlocks, error) { diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 5dc2af80..5e7d9777 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -11,7 +11,7 @@ var ( func Root() *cobra.Command { cmd := cobra.Command{ - Use: "rdme", + Use: "runme", Short: "Execute commands directly from a README", Long: "Parses commands directly from a README (best-effort) to make them executable under a unique name.", SilenceErrors: true, diff --git a/internal/cmd/run.go b/internal/cmd/run.go index 46e77284..8e2b63ee 100644 --- a/internal/cmd/run.go +++ b/internal/cmd/run.go @@ -7,12 +7,12 @@ import ( "strings" "syscall" - "github.com/stateful/rdme/internal/document" + "github.com/stateful/runme/internal/document" "github.com/pkg/errors" "github.com/rwtodd/Go.Sed/sed" "github.com/spf13/cobra" - "github.com/stateful/rdme/internal/runner" + "github.com/stateful/runme/internal/runner" ) func runCmd() *cobra.Command { diff --git a/internal/cmd/tasks.go b/internal/cmd/tasks.go index 24081850..4e0c9045 100644 --- a/internal/cmd/tasks.go +++ b/internal/cmd/tasks.go @@ -5,7 +5,7 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - "github.com/stateful/rdme/internal/tasks" + "github.com/stateful/runme/internal/tasks" ) func tasksCmd() *cobra.Command { diff --git a/internal/document/block_test.go b/internal/document/block_test.go index 3444b06d..ae137813 100644 --- a/internal/document/block_test.go +++ b/internal/document/block_test.go @@ -13,13 +13,13 @@ func TestCodeBlock_Attributes(t *testing.T) { This is a basic snippet with a shell command: ` + "```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```" + ` It can have an annotation with a name: ` + "```" + `sh {name=echo first= second=2} -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) blocks := source.Parse().CodeBlocks() @@ -33,11 +33,11 @@ $ echo "Hello, rdme!" func TestCodeBlock_Content(t *testing.T) { data := []byte("```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) block := source.Parse().CodeBlocks()[0] - assert.Equal(t, "$ echo \"Hello, rdme!\"\n", block.Content()) + assert.Equal(t, "$ echo \"Hello, runme!\"\n", block.Content()) block.SetContent("reset") assert.Equal(t, "reset", block.Content()) @@ -45,7 +45,7 @@ $ echo "Hello, rdme!" func TestCodeBlock_Executable(t *testing.T) { data := []byte("```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) block := source.Parse().CodeBlocks()[0] @@ -57,7 +57,7 @@ func TestCodeBlock_Intro(t *testing.T) { This is a basic snippet with a shell command: ` + "```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) block := source.Parse().CodeBlocks()[0] @@ -69,7 +69,7 @@ func TestCodeBlock_Lines(t *testing.T) { blocks := source.Parse().CodeBlocks() assert.Len(t, blocks, 5) assert.Equal(t, 1, blocks[0].LineCount()) - assert.Equal(t, "echo \"Hello, rdme!\"", blocks[0].Line(0)) + assert.Equal(t, "echo \"Hello, runme!\"", blocks[0].Line(0)) assert.Equal(t, []string{ "echo \"1\"", "echo \"2\"", @@ -82,13 +82,13 @@ func TestCodeBlock_Name(t *testing.T) { This is a basic snippet with a shell command: ` + "```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```" + ` It can have an annotation with a name: ` + "```" + `sh {name=myname first= second=2} -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) blocks := source.Parse().CodeBlocks() @@ -106,11 +106,11 @@ This is a basic snippet with a shell command: > **Warning!** ` + "```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```") source := NewSource(data) blocks := source.Parse().Blocks() data, err := json.Marshal(blocks) require.NoError(t, err) - require.Equal(t, `[{"markdown":"Hi"},{"markdown":"This is a basic snippet with a shell command:"},{"markdown":"Warning!\n**Warning!**"},{"content":"$ echo \"Hello, rdme!\"\n","name":"echo-hello","language":"sh","lines":["echo \"Hello, rdme!\""]}]`, string(data)) + require.Equal(t, `[{"markdown":"Hi"},{"markdown":"This is a basic snippet with a shell command:"},{"markdown":"Warning!\n**Warning!**"},{"content":"$ echo \"Hello, runme!\"\n","name":"echo-hello","language":"sh","lines":["echo \"Hello, runme!\""]}]`, string(data)) } diff --git a/internal/document/fixture_test.go b/internal/document/fixture_test.go index db96d16b..86ec8b2d 100644 --- a/internal/document/fixture_test.go +++ b/internal/document/fixture_test.go @@ -10,13 +10,13 @@ var testREADME = []byte(` This is a basic snippet with a shell command: ` + "```" + `sh -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```" + ` It can have an annotation with a name: ` + "```" + `sh {name=echo} -$ echo "Hello, rdme!" +$ echo "Hello, runme!" ` + "```" + ` It can contain multiple lines too: @@ -30,7 +30,7 @@ $ echo "3" Also, the dollar sign is not needed: ` + "```" + `sh -echo "Hello, rdme! Again!" +echo "Hello, runme! Again!" ` + "```" + ` ## Go @@ -45,7 +45,7 @@ import ( ) func main() { - fmt.Println("Hello from Go, rdme!") + fmt.Println("Hello from Go, runme!") } ` + "```") diff --git a/internal/renderer/json.go b/internal/renderer/json.go index 287e96f0..6e24cdf4 100644 --- a/internal/renderer/json.go +++ b/internal/renderer/json.go @@ -5,7 +5,7 @@ import ( "io" "github.com/pkg/errors" - "github.com/stateful/rdme/internal/document" + "github.com/stateful/runme/internal/document" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" goldrender "github.com/yuin/goldmark/renderer" diff --git a/internal/renderer/json_test.go b/internal/renderer/json_test.go index 9e673cc2..94ef6aa2 100644 --- a/internal/renderer/json_test.go +++ b/internal/renderer/json_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/bradleyjkemp/cupaloy/v2" - "github.com/stateful/rdme/internal/document" + "github.com/stateful/runme/internal/document" "github.com/stretchr/testify/require" ) diff --git a/internal/renderer/testdata/.snapshots/TestParser_Renderer-simple b/internal/renderer/testdata/.snapshots/TestParser_Renderer-simple index 26a4c41b..70e407fd 100644 --- a/internal/renderer/testdata/.snapshots/TestParser_Renderer-simple +++ b/internal/renderer/testdata/.snapshots/TestParser_Renderer-simple @@ -1 +1 @@ -{"document":[{"markdown":"# rdme\n\nDiscover and run code snippets directly from your `README.md` or other markdowns (defaults to local `README.md`).\n\nrdme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. rdme is currently in early alpha.\n\nYou can execute commands from a different directory using a `--chdir` flag.\nTo select a different file than `README.md`, use `--filename`.\n\n## Installation\n\nThe easiest way on MacOS is to use Homebrew:"},{"content":"$ brew install stateful/tap/rdme\n","name":"brew-install","language":"sh","lines":["brew install stateful/tap/rdme"]},{"markdown":"a binary for your operating system.\n\nIf you have Go developer tools installed, you can install it with `go install`:"},{"content":"$ go install github.com/stateful/rdme@latest\n","name":"go-install","language":"sh","lines":["go install github.com/stateful/rdme@latest"]},{"markdown":"## Contributing \u0026 Feedback\n\nLet us know what you think via GitHub issues or submit a PR. Join the conversation [on Discord](https://discord.gg/MFtwcSvJsk). We're looking forward to hear from you.\n\n## LICENCE\n\nApache License, Version 2.0"}]} +{"document":[{"markdown":"# runme\n\nDiscover and run code snippets directly from your `README.md` or other markdowns (defaults to local `README.md`).\n\nrunme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. runme is currently in early alpha.\n\nYou can execute commands from a different directory using a `--chdir` flag.\nTo select a different file than `README.md`, use `--filename`.\n\n## Installation\n\nThe easiest way on MacOS is to use Homebrew:"},{"content":"$ brew install stateful/tap/runme\n","name":"brew-install","language":"sh","lines":["brew install stateful/tap/runme"]},{"markdown":"a binary for your operating system.\n\nIf you have Go developer tools installed, you can install it with `go install`:"},{"content":"$ go install github.com/stateful/runme@latest\n","name":"go-install","language":"sh","lines":["go install github.com/stateful/runme@latest"]},{"markdown":"## Contributing \u0026 Feedback\n\nLet us know what you think via GitHub issues or submit a PR. Join the conversation [on Discord](https://discord.gg/MFtwcSvJsk). We're looking forward to hear from you.\n\n## LICENCE\n\nApache License, Version 2.0"}]} diff --git a/internal/renderer/testdata/simple.md b/internal/renderer/testdata/simple.md index bbebbaa4..79a64735 100644 --- a/internal/renderer/testdata/simple.md +++ b/internal/renderer/testdata/simple.md @@ -1,8 +1,8 @@ -# rdme +# runme Discover and run code snippets directly from your `README.md` or other markdowns (defaults to local `README.md`). -rdme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. rdme is currently in early alpha. +runme makes a best effort approach to extracts all code snippets defined in code blocks and allowing to explore and execute them. runme is currently in early alpha. You can execute commands from a different directory using a `--chdir` flag. To select a different file than `README.md`, use `--filename`. @@ -12,16 +12,16 @@ To select a different file than `README.md`, use `--filename`. The easiest way on MacOS is to use Homebrew: ```sh -$ brew install stateful/tap/rdme +$ brew install stateful/tap/runme ``` -Alternatively, check out [rdme's releases](https://github.com/stateful/rdme/releases) and select +Alternatively, check out [runme's releases](https://github.com/stateful/runme/releases) and select a binary for your operating system. If you have Go developer tools installed, you can install it with `go install`: ```sh -$ go install github.com/stateful/rdme@latest +$ go install github.com/stateful/runme@latest ``` ## Contributing & Feedback diff --git a/internal/runner/go.go b/internal/runner/go.go index aeeebb0c..1edb9994 100644 --- a/internal/runner/go.go +++ b/internal/runner/go.go @@ -34,7 +34,7 @@ func (g Go) Run(ctx context.Context) error { return errors.Wrapf(err, "failed to find %q executable", "go") } - tmpDir, err := os.MkdirTemp("", "rdme-*") + tmpDir, err := os.MkdirTemp("", "runme-*") if err != nil { return errors.Wrapf(err, "failed to create a temp dir") } diff --git a/main.go b/main.go index 89e38831..409be6da 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/stateful/rdme/internal/cmd" + "github.com/stateful/runme/internal/cmd" ) // These are variables so that they can be set during the build time. diff --git a/web/main_js.go b/web/main_js.go index 72e63cf0..0fbe85d2 100644 --- a/web/main_js.go +++ b/web/main_js.go @@ -5,8 +5,8 @@ import ( "encoding/json" "syscall/js" - "github.com/stateful/rdme/internal/document" - "github.com/stateful/rdme/internal/renderer" + "github.com/stateful/runme/internal/document" + "github.com/stateful/runme/internal/renderer" ) // These are variables so that they can be set during the build time.