bakpakin / Fennel

Lua Lisp Language
https://fennel-lang.org
MIT License
2.44k stars 126 forks source link

Create portable single-file Fennel CLI #248

Closed Benaiah closed 4 years ago

Benaiah commented 4 years ago

Users might expect to be able to move the fennel script around as a single file and have it still work. While we may or may not want a single-file CLI script to be the default fennel script, it would be useful to have one in the repo for people who want to be able to just copy a single file into a directory on their PATH. It would also be useful to allow people to install the fennel compiler by downloading just one file - that would make curl or wget a reasonable option for installing fennel if you didn't want the whole repo.

technomancy commented 4 years ago

This sounds like a good idea. Couple considerations:

A) do we make this completely standalone, or reliant on a system lua install? (maybe start with the latter and think about doing a standalone one later?)

B) do we make this part of the release process? We already have CI set up in a way that has access to push to fennel-lang.org, so maybe that would be a good place for it; we just need a way to distinguish release builds from regular builds.

jaawerth commented 4 years ago

@technomancy A) do we make this completely standalone, or reliant on a system lua install? (maybe start with the latter and think about doing a standalone one later?) For a complete standalone

Completely standalone runs into a bunch of potential cross-platform gotchas. For everything linux, we could pretty easily add the creation of an AppImage to our release pipeline, so that the resulting portable asset (fennel + lua together) is released as an asset on the releases page for easy download-and-use.

B) do we make this part of the release process? We already have CI set up in a way that has access to push to fennel-lang.org, so maybe that would be a good place for it; we just need a way to distinguish release builds from regular builds.

Yes, I think this would be best. Standard approach I've followed in CI for this kind of thing is to target tags that match a semver pattern, e.g. /^v\d+\.\d+\.\d+$/ that runs all the usual checks and creates a release using the github (or whatever) API + CI env var that embeds a tokken the API will be ok with for that build.

I am happy to set such a thing up - we could make the release job require manual approval. I've already got a script I used to generate the current releases which I planned on adding to CI, so once I do that we could just add the job to it.

Benaiah commented 4 years ago

Yeah, I think a completely standalone binary is a much bigger ask than a version of the Lua script that's self-contained in a single file but still depends on a system-wide Lua installation. It might be nice to have both eventually, but I think the self-contained Lua script would be quite useful and much easier to add. (If we compiled the fennel script from Fennel, this could simply be the difference between requireing and includeing the fennel.lua file).