Skip to content

Commit ee0be4d

Browse files
committed
feat(gobake): editorial cookbook redesign + v0.4.0 content
Redesign the gobake project page (RubyProjectPage) as "The Engineer's Cookbook" with Fraunces/EB Garamond/Caveat/JetBrains Mono, paper grain, wax-seal version badge, numbered Roman-numeral feature cards, dotted-leader docs TOC, and order-ticket install CTA. Refresh content for gobake v0.4.0: multi-task CLI invocation, RunIn for scoped working directories, RunOutput for captured stdout, and sorted help. Add new feature cards, update terminal cards, and add three v0.4.0-flavored signature recipes. Bump fezcodex to 0.24.32.
1 parent b3c5624 commit ee0be4d

10 files changed

Lines changed: 1249 additions & 419 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fezcodex",
3-
"version": "0.24.31",
3+
"version": "0.24.32",
44
"private": true,
55
"homepage": "https://fezcode.com",
66
"dependencies": {

public/projects/gobake/details.txt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,25 @@ go install github.com/fezcode/gobake/cmd/gobake@latest
1616

1717
The `init` command is smart: it handles `go mod init` (if needed), scaffolds your `recipe.piml` and `Recipe.go`, and runs `go mod tidy` to automatically pull in the `github.com/fezcode/gobake` library as a dependency.
1818

19-
2. **Run a task:**
19+
2. **Run a task — or several:**
2020

2121
```bash
2222
gobake build
23+
gobake test build deploy
2324
```
2425

26+
Trailing arguments that aren't task names are passed to the last task as `ctx.Args`.
27+
2528
## Usage
2629

2730
### Commands
2831

2932
* **`gobake init`**: Scaffolds a new `Recipe.go` and `recipe.piml`. Handles `go.mod` and dependencies.
3033
* **`gobake version`**: Displays the current version of gobake.
31-
* **`gobake help`**: Displays the list of commands and available tasks.
34+
* **`gobake help`**: Sorted list of CLI commands and project tasks.
3235
* **`gobake bump [patch|minor|major]`**: Increments the version in `recipe.piml`.
3336
* **`gobake template <git-url>`**: Initialize from a remote repository template.
37+
* **`gobake <task> [<task>...] [args]`**: Run one or more defined tasks in order.
3438

3539
### The `Recipe.go` File
3640

@@ -39,23 +43,23 @@ go install github.com/fezcode/gobake/cmd/gobake@latest
3943
package bake_recipe
4044

4145
import (
42-
"fmt"
43-
"github.com/fezcode/gobake"
46+
"fmt"
47+
"github.com/fezcode/gobake"
4448
)
4549

4650
func Run(bake *gobake.Engine) error {
47-
if err := bake.LoadRecipeInfo("recipe.piml"); err != nil {
48-
return fmt.Errorf("error loading recipe.piml: %v", err)
49-
}
51+
if err := bake.LoadRecipeInfo("recipe.piml"); err != nil {
52+
return fmt.Errorf("error loading recipe.piml: %v", err)
53+
}
5054

51-
bake.Task("test", "Runs project tests", func(ctx *gobake.Context) error {
52-
return ctx.Run("go", "test", "./...")
53-
})
55+
bake.Task("test", "Runs project tests", func(ctx *gobake.Context) error {
56+
return ctx.Run("go", "test", "./...")
57+
})
5458

55-
bake.TaskWithDeps("build", "Builds the binary", []string{"test"}, func(ctx *gobake.Context) error {
56-
return ctx.BakeBinary("linux", "amd64", "bin/app")
57-
})
59+
bake.TaskWithDeps("build", "Builds the binary", []string{"test"}, func(ctx *gobake.Context) error {
60+
return ctx.BakeBinary("linux", "amd64", "bin/app")
61+
})
5862

59-
return nil
63+
return nil
6064
}
6165
```
Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# gobake Examples
1+
# Signature Recipes
22

3-
## 1. Cross-Compilation for Multiple Platforms
3+
## 1. Multi-Task Pipelines with Captured Git SHA
44

5-
This recipe builds your application for Windows, Linux, and macOS.
5+
Chain tasks on the CLI and embed your commit SHA into the binary using `ctx.RunOutput`.
66

77
```go
88
//go:build gobake
@@ -18,45 +18,39 @@ func Run(bake *gobake.Engine) error {
1818
return err
1919
}
2020

21-
bake.Task("release", "Build for all platforms", func(ctx *gobake.Context) error {
22-
platforms := []struct {
23-
OS string
24-
Arch string
25-
Ext string
26-
}{
27-
{"linux", "amd64", ""},
28-
{"windows", "amd64", ".exe"},
29-
{"darwin", "arm64", ""},
30-
}
31-
32-
for _, p := range platforms {
33-
output := fmt.Sprintf("dist/%s-%s-%s%s",
34-
bake.Info.Name, p.OS, p.Arch, p.Ext)
21+
bake.Task("test", "Run tests", func(ctx *gobake.Context) error {
22+
return ctx.Run("go", "test", "./...")
23+
})
3524

36-
err := ctx.BakeBinary(p.OS, p.Arch, output, "-ldflags", "-s -w")
37-
if err != nil {
38-
return err
39-
}
25+
bake.TaskWithDeps("build", "Build with embedded git SHA", []string{"test"}, func(ctx *gobake.Context) error {
26+
sha, err := ctx.RunOutput("git", "rev-parse", "--short", "HEAD")
27+
if err != nil {
28+
return err
4029
}
41-
return nil
30+
ldflags := fmt.Sprintf("-X main.Version=%s -X main.Commit=%s", bake.Info.Version, sha)
31+
ctx.Log("Building %s @ %s", bake.Info.Version, sha)
32+
return ctx.Run("go", "build", "-ldflags", ldflags, "-o", "bin/app")
33+
})
34+
35+
bake.TaskWithDeps("deploy", "Ship it", []string{"build"}, func(ctx *gobake.Context) error {
36+
ctx.Log("Deploying %s...", bake.Info.Version)
37+
return ctx.Run("scp", "bin/app", "deploy@server:/srv/app")
4238
})
4339

4440
return nil
4541
}
4642
```
4743

48-
## 2. Using External Tools
49-
50-
This recipe installs `stringer` and uses it to generate code before building.
44+
Then run the whole pipeline in one breath:
5145

52-
**recipe.piml:**
53-
```piml
54-
(name) my-app
55-
(tools)
56-
> golang.org/x/tools/cmd/stringer@latest
46+
```bash
47+
gobake test build deploy
5748
```
5849

59-
**Recipe.go:**
50+
## 2. Cross-Compilation for Multiple Platforms
51+
52+
Build for Windows, Linux, and macOS in a single task.
53+
6054
```go
6155
//go:build gobake
6256
package bake_recipe
@@ -68,37 +62,41 @@ import (
6862

6963
func Run(bake *gobake.Engine) error {
7064
if err := bake.LoadRecipeInfo("recipe.piml"); err != nil {
71-
return fmt.Errorf("error loading recipe.piml: %v", err)
65+
return err
7266
}
7367

74-
bake.Task("generate", "Generates code", func(ctx *gobake.Context) error {
75-
// Ensure tools are installed first
76-
if err := ctx.InstallTools(); err != nil {
77-
return err
68+
bake.Task("release", "Build for all platforms", func(ctx *gobake.Context) error {
69+
platforms := []struct {
70+
OS, Arch, Ext string
71+
}{
72+
{"linux", "amd64", ""},
73+
{"windows", "amd64", ".exe"},
74+
{"darwin", "arm64", ""},
7875
}
79-
ctx.Log("Running stringer...")
80-
return ctx.Run("go", "generate", "./...")
81-
})
8276

83-
bake.TaskWithDeps("build", "Builds app", []string{"generate"}, func(ctx *gobake.Context) error {
84-
return ctx.Run("go", "build", ".")
77+
for _, p := range platforms {
78+
output := fmt.Sprintf("dist/%s-%s-%s%s",
79+
bake.Info.Name, p.OS, p.Arch, p.Ext)
80+
if err := ctx.BakeBinary(p.OS, p.Arch, output, "-ldflags", "-s -w"); err != nil {
81+
return err
82+
}
83+
}
84+
return nil
8585
})
8686

8787
return nil
8888
}
8989
```
9090

91-
## 3. Injecting Version with ldflags
91+
## 3. Polyglot Builds with `RunIn`
9292

93-
Inject project version from `recipe.piml` into your binary.
93+
Drive a JavaScript frontend and a Go backend from a single recipe.
9494

95-
**Recipe.go:**
9695
```go
9796
//go:build gobake
9897
package bake_recipe
9998

10099
import (
101-
"fmt"
102100
"github.com/fezcode/gobake"
103101
)
104102

@@ -107,13 +105,19 @@ func Run(bake *gobake.Engine) error {
107105
return err
108106
}
109107

110-
bake.Task("build", "Build with version", func(ctx *gobake.Context) error {
111-
ldflags := fmt.Sprintf("-X main.Version=%s", bake.Info.Version)
112-
113-
ctx.Log("Building version %s...", bake.Info.Version)
114-
return ctx.Run("go", "build", "-ldflags", ldflags, "-o", "bin/app")
108+
bake.Task("frontend", "Build the SPA", func(ctx *gobake.Context) error {
109+
if err := ctx.RunIn("web", "npm", "ci"); err != nil {
110+
return err
111+
}
112+
return ctx.RunIn("web", "npm", "run", "build")
113+
})
114+
115+
bake.TaskWithDeps("backend", "Embed dist and build server", []string{"frontend"}, func(ctx *gobake.Context) error {
116+
return ctx.BakeBinary("linux", "amd64", "bin/server")
115117
})
116118

117119
return nil
118120
}
119121
```
122+
123+
A single `gobake backend` walks the dependency tree, builds the SPA in `web/`, then compiles the Go server with the embedded assets.

public/projects/gobake/features.txt

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,58 @@
22
title: Go-Native
33
icon: Code
44
creator: Fezcode
5-
role: CREATOR
6-
subtitle: Native Execution. Fast and elegant.
7-
quote: Go-Native changed how we build. It's the most natural build tool I've ever experienced.
8-
description: Write your build scripts in Go. No new syntax to learn. Benefit from Go's type safety and performance.
5+
role: HEAD BAKER
6+
subtitle: Native execution. Fast and elegant.
7+
quote: Writing my build in Go means autocomplete, types, and the same compiler that ships my product. The Makefile-shaped hole in my soul finally healed.
8+
description: Write your build scripts in Go. No new syntax to learn. Benefit from Go's type safety, tooling, and a familiar concurrency model that scales with your project.
9+
:::
10+
11+
:::feature
12+
title: Multi-Task CLI
13+
icon: ListChecks
14+
creator: New in 0.4.0
15+
role: FRESH OUT THE OVEN
16+
subtitle: Chain tasks on the command line.
17+
quote: One invocation, the whole pipeline. We pulled three CI yaml hops down to a single line and the deploy still smells like victory.
18+
description: Run gobake test build deploy in a single call. Trailing tokens that aren't task names flow into ctx.Args of the last task — perfect for ad-hoc inputs without rewriting your recipe.
19+
:::
20+
21+
:::feature
22+
title: Scoped Shell
23+
icon: Terminal
24+
creator: New in 0.4.0
25+
role: SOUS-CHEF
26+
subtitle: RunIn for working directories. RunOutput for captured stdout.
27+
quote: We replaced a small forest of os/exec wrappers with two helpers and a deep breath. Tests that needed cwd swaps just got readable.
28+
description: ctx.RunIn(dir, name, args...) runs a command in any working directory. ctx.RunOutput(name, args...) captures stdout while still streaming stderr — pipeline-friendly without losing visibility.
929
:::
1030

1131
:::feature
1232
title: Zero Dependencies
1333
icon: ShieldCheck
34+
creator: Pantry
35+
role: FOUNDATIONAL
1436
subtitle: Pure Go. No external mess.
15-
quote: Zero Dependencies means no more dependency hell. It's a breath of fresh air for our CI/CD.
16-
description: The build system is just a Go program. It compiles itself on the fly, requiring nothing but the Go toolchain.
37+
quote: No node_modules. No virtualenv. No yet-another-runtime. Just go install and a recipe — the way build systems were always supposed to feel.
38+
description: The build system is just a Go program. It compiles itself on the fly, requiring nothing but the Go toolchain that's already on your machine.
1739
:::
1840

1941
:::feature
20-
title: Metadata Management
21-
icon: NewspaperClipping
22-
subtitle: Centralized control. Single Source.
23-
quote: Metadata Management brings sanity to our versioning. Absolute game changer for release engineering.
24-
description: Manage versions, tools, and dependencies in a central `recipe.piml` file.
42+
title: Self-Bootstrapping
43+
icon: Cpu
44+
creator: Apparatus
45+
role: AUTOMATIC
46+
subtitle: Just run gobake. It handles the rest.
47+
quote: gobake init wired up go.mod, scaffolded Recipe.go, ran tidy, and pulled the library — all before my coffee finished steeping. That's the whole pitch.
48+
description: gobake init handles go mod init, scaffolds your recipe.piml and Recipe.go, and runs go mod tidy automatically. New machines, new contributors, new projects — same warm onboarding.
2549
:::
2650

2751
:::feature
28-
title: Self-Bootstrapping
29-
icon: Cpu
30-
subtitle: Autonomous builds. Self-healing.
31-
quote: Self-Bootstrapping is magic. It handles its own lifecycle perfectly so I don't have to.
32-
description: Just run `gobake`. It handles the rest, ensuring your build environment is always consistent.
52+
title: Metadata Management
53+
icon: NewspaperClipping
54+
creator: Provenance
55+
role: SINGLE SOURCE
56+
subtitle: Centralized control via recipe.piml.
57+
quote: Version, authors, tools — all in one PIML file the build can read. ldflags injection from metadata is the cherry on top.
58+
description: Manage version, authors, license, repository, dev tools, and dependencies in a single recipe.piml file. Bump versions with gobake bump patch — your CI tagging logic just got boring.
3359
:::

0 commit comments

Comments
 (0)