-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Build hooks #40
Comments
that's a solid config format! i guess we can add extra metadata (such as the world being unpacked) as environment variables to the child process. im still skeptical about the platform compatability though, bat and sh dont mix very well maybe it can be like so: |
However, So if you have a cross-platform script (e.g. .py), or you're not interested in cross-platform compatibility (such as a lot of users), you don't do anything else, but if you are, you just do:
This would mean you could make your configuration as you want (e.g. just call your script "meow" on unix), but if demand falls upon you to fix cross-platform compatibility, it is easy to do (add a An alternative syntax could be something like:
Once again with the option of leaving any platforms missing and having the default |
Another way of fixing cross-platform compatibility that I considered mentioning in the issue itself is to run the build hooks in a container and mount the whole mcman repository into it. The problem with this approach is that you don't know what someone would want to do. Maybe it's more than just change a couple of files, maybe they want to send a notification to their phone that the build is completed (e.g. if they have extremely slow internet and/or a lot of huge worlds), or whatever other use cases we cannot think of. This "outside the repository" use would need to be facilitated by editing the container specification, and we can't expect everyone who just wants a script to run to be good at working with containers, which are a divisive technology anyway. |
It's now implemented, will release 0.4.4 soon! :3 |
Customizable build hooks, e.g. to fetch information from the host OS when building, do things differently based on the environment, etc.
First idea for how the configuration of this would look:
An
mcman
repository would get an optionalhooks/
folder, containing any number of files, to be named freely by the user.The
server.toml
file will get a new section:When running
mcman build
, each file in thehooks
folder named after a corresponding "hooks" subsection inserver.toml
will be executed at the specified "when" moment. The description would be displayed to the terminal for every hook.Each hook executed will get access to some environment variables, which will depend on the settings specified in
server.toml
, such as the "env" setting, as well as the "when" setting (e.g. apost_unpack
hook would get the folder to which a world has been unpacked passed in some environment variable).In this proposal, arguments to programs go unused.
The text was updated successfully, but these errors were encountered: