-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
postupdate script #305
Comments
I don't think that makes much sense. If the behaviour of IMO it's just easier to have a single script that makes sure the final state is what the shard expects. This gives you all the power to do whatever necessary. You should strive for idempotency, not for separate instructions. |
I was more so thinking of this for like private shards used within a closed-source project. I.e. that may run internal build processes, such as creating rabbitMQ queues for example; things that should happen once on an env when installing the app. Then there are things that should happen when updating a dependency, like writing parameter files based on the current env. Currently there isn't really a nice way to handle this within Crystal/shards itself. EDIT: On a related note, it would be nice if it supported an array of commands that it should run: postinstall:
- cmd 1
- cmd 2
- .. |
So you think to have your install script be idempotent, that is examining the current environment and only doing necessary changes, is too much to ask? |
From the point of view of Shards, there are no updates, only installs. The only update is to build a new lockfile of shards that will be installed. When installing, if the folder exists it's deleted then the shard is installed and the postinstall script is eventually run (when all shards have been installed). I think the postinstall script must be idempotent. Whatever if the shard was previously installed, whatever version of it was previously installed. You can never assume a previous state. My worry with a postupdate script is that we either dont prevent postinstall to run, making postupdate pointless, or require every shard to also have a postupdate... that is identical to postinstall, which is just as pointless :-( |
I believe that's the whole reason only the postinstall script was added. We only ever install a shard, and whatever the previous version did, it must be usually redone ror the new version, and it doesn't hurt (e.g. build a binary, install some script to the dependent project, ...). If it does hurt, then the script must check whether something was done or not before doing it. |
Currently the
postinstall
script is ran for bothinstall
andupdate
. I propose to only runpostinstall
oninstall
and introduce apostupdate
script to only run onupdate
.Use case would be preventing something you only need to run once on install from running every time a shard is updated.
The text was updated successfully, but these errors were encountered: