Yeah, I think that could be a reasonable use for postinstall. However maybe this could be handled by shards with declarative configuration, i.e. a install_message property in shard.yml? This would be more versatile and implicitly portable.
Yeah this is what I meant, another property to set the install_message that will be printed to the console every time the library is installed/updated.
Maybe a prebuild hook could be useful for building libraries…?
I was thinking of another command, like shards exec-all postinstall that will run every postinstall script of the installed scripts. Or shards install --exec-all=postinstall might be better.
But at this point the question arises why use shards at all. There are better dedicated tools for running tasks / build recipes (e.g Make, Rake Task, etc.).
And it doesn’t really make much difference if you run shards exec foo.postinstall or make -C lib/foo postinstall for example.
I suppose the main merit of using shards is that it’s already available and doesn’t require an additional dependency. But then it’s also quite limiting and you get much more value out of a dedicated tool - and I don’t think it makes sense to extend shards into yet another buid tool.
Yeah this is my question for sometime: what shards is aiming to be, just a simple package manager to install some crystal libraries, or a full featured project manager?
shards currently is not very useful, I only run it when I need to install/update a library, which is a rare occasion. shards build supposedly should be a frequently useful one, but it’s faster to me to type yarn br than shards build --release -s. In my opinion, shards does not need to compete with build systems like make, rake, it just need to provide some convenience way to invoke those frequently used commands.
For developing an application, there are some actions that need to run all the time: building program, clean then build the program, build the program then upload somewhere, fetch some external resources as dependencies, run some generator scripts, run migration tools etc. It is pretty inconvenient that we need to install other tool just to do it.
Also, passing arguments to make feels dirty, so I’m not very fond of using make as task invoker.
p/s: if shards is aiming to be a full-featured project manager, then stuff like project scaffolding (currently crystal init) should move to shards, too. And then might be we can provide an another common feature of newer generation package managers: generate projects from online templates. The ecosystem can be more uniformed this way.