rvm default do ruby
Closed this issue · 5 comments
In the generated pre-commit hook, if rvm
is installed it uses rvm's default Ruby installation. But the default is not what my project uses: why is it demanding to use the default? Why not just trust the system's current ruby in use?
At a minimum is there a way to remove that check from the pre-commit script?
EDIT: Ah, I realized that you need to get rvm's Ruby runtime; I'll look at rvm's documentation for something that might work better.
EDIT 2: I tried changing around my ruby version. As expected, printing RUBY_VERSION
from within the pre-commit hook always prints out my current Ruby version. So yes, an option to just use ruby
and not worry about selecting the rvm default
would be nice :)
Hmm... I think we added that because some people were having problems with RVM gemsets, or RVM just not finding the pre-commit
gem in general. I'm beginning to realize that our hook template is causing different issues for different people and I'm thinking about offering a few different options for the template:
https://github.com/jish/pre-commit/blob/master/docs/choose_your_own_template.md
What do you think? Would a simple hook template work for you?
require 'pre-commit'
PreCommit.run
Or would a hook targeted at RVM specifically help?
pre-commit install --rvm
you can force any ruby now with git config pre-commit.ruby ruby
- replace ruby
with the command you want to get used.
Cool, that works! I'll try it out now.
To enable this option you'll need to install a new version of the pre-commit
gem and install a new hook in your repo:
cd path/to/repo
gem install pre-commit
pre-commit install
Yup, I cloned the repo and installed it from source, it seems to be working fine on first inspection. I'll post here again if I run into anything problematic, at work so I'll make sure everything looks good later :)