Teal support on Alfons! #379
daelvn
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
it can run teal scripts, both during setup, when you start to build and afterwards? Now all it need is a way to enforce a consistent naming scheme (assuming it doesn't already have that) and then it can be bundled with the proposed CLI and ideally get driven by it :) One thing that I would like if is |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In this post I'm just talking about the Teal support, for the complete usage, it's a good idea to read the full docs.
Inspired by the Teal CLI discussion, I decided to add Teal support to one of my projects, Alfons, a task runner for Lua, MoonScript and now Teal. I'll briefly describe what the project does and then move on to explain how it supports Teal.
As the README describes, Alfons is inspired by the "worst use cases of Make". The hole this tries to fill is running scripts, really. Instead of having a
Makefile
to do things like compiling, cleaning your compiled files, fetching dependencies, uploading rockspecs... you just use Alfons. You use a Taskfile (or Alfonsfile) to describe Tasks, which you can use in combination with several provided functions. You can install it via LuaRocks (rockalfons
).The first way in which Teal is supported is that you can now define your taskfiles in Teal. You make an
Alfons.tl
file in your current directory, and runningalfons
will detect it automatically. Since this is a showcase of the Teal support, and not of the whole project, I will show the second way in which Alfons supports Teal: through an utility plugin. It's shipped by default on 4.4.1 (latest), and all you have to do is create analways
task, and load the plugin there.And you're good to go! Now, if you want to declare dependencies and install them, it simply one more line:
Now you can run
alfons install
from the command line and it will install dependencies! If you want to do the same thing from the Taskfile, simply calltasks.install()
. (Note: You probably should be usingluarocks make --pin --only-deps
for this)But there's more. The task
build
is an alias to the shell commandtl build
, for convenience. It can also download type definitions from teal-types. You can do this in several ways:Individually, from the command line:
alfons typings -m <module>
Individually, from the Taskfile task:
tasks.typings{ module = "module" }
In bulk, using the Taskfile task:
tasks.typings{ modules = {"moda", "modb"} }
In bulk, automatically, using
store
:And last but not least, it supports Hooks. You can define tasks with specific names such as
teal_postbuild
to run scripts aftertl build
was run:However, there are some shortcomings:
watch
or lazy builds haven't been implemented yet. However, you can make them yourself with thewatch
andbuild
functions that Alfons provides.Here are the docs for the Teal plugin. Thanks for reading!
Beta Was this translation helpful? Give feedback.
All reactions