-
Notifications
You must be signed in to change notification settings - Fork 69
Description
For installing ruby, we'd like to minimize the number of locations that would need to be manually updated to declare the ruby version.
For most ruby projects, it's very common to have a .ruby-version
that contains the version. When someone does a hermit instally ruby
that files could potentially deviate. That file is commonly used by ruby version managers like rvm and rbenv, and while hermit would/could be replacing those there are other situations that that file may be used such as in custom CI scripting.
One option that appears possible is to use the on
events (as described here) to write a .ruby-version
file with the version.
Using that feature, we might be able to do something like this:
on "install" {
run {
cmd = "echo ${version} >> .ruby-version"
}
}
That would apply to all installations of ruby, even ones that may not wish to use or preserve a .ruby-version
file. We could augment this to conditionally update a .ruby-version file if it's present and not create it if it doesn't exist.
Using run
also doesn't seem as structured as the existing set of built-in set of triggers. We could add a trigger called write
and give it more options:
on "install" {
write {
content = "${version}"
file = ".ruby-version"
only-if = "exists"
}
}