Along with @abiosoft and @captncraig, I’ve been mulling over ideas for a tool to aid Caddy plugin developers and Caddy users who just want to manage plugins for their installation like packages. This tool would effectively replace caddydev and caddyext from pre-0.9 versions.
I am approaching this as a kind of wrapper to the
go command. Right now, to build caddy “properly” (with version information), you need to run build.bash (Unix-only) which runs
go build. We would replace build.bash with this tool and it would be written in Go, so cross-platform.
Here are my thoughts so far. Note that I haven’t decided on a name for the tool yet, so I just use “cadgo” in its place here because it’s kind of a Caddy-specific wrapper over the go command.
(Be sure to scroll to see full proposal.)
$ cadgo build Basically same as build.bash (which is just `go build` with version info). $ cadgo build github.com/mholt/caddy For when you're not in the repo's folder. $ cadgo build github.com/mholt/caddy with github.com/abiosoft/caddy-git Same as above, but with git plugged in. Can have multiple plugins specified. $ cadgo build from github.com/mholt/caddy When you're in your plugin's folder and want to try it out real quick. Caveat: We have to assume import path from cwd. If the 'from' syntax is weird, we could do this instead: $ cadgo build github.com/mholt/caddy with . or $ cadgo build github.com/mholt/caddy with this All the above would work with `cadgo run` or `cadgo install` as well. These just wrap `go run` and `go install`, respectively. For a "package manager" style use, for modifying your local `caddy` instance (like caddyext did): $ cadgo add http.git - Contacts the plugin registry for an import path - Runs `go get` (-u?) - Adds the import to github.com/mholt/caddy/caddy/caddymain/run.go - Runs `cadgo install` $ cadgo remove http.git - Contacts the plugin registry for an import path - Removes the import - Runs `cadgo install` (Should `add` and `remove` subcommands take import paths instead of plugin names?)
Note that for this tool to work (at least the add/remove commands), it will require constructing a new central plugin registry. I have some plans for this already, and the new build server will also use this new plugin registry.
This tool does require
go and VCS to be installed (git is most common of course). I figure only developers will be using this tool anyway. People who just want custom caddy builds can use the build server.
What do you think?