Open shawnacscott opened 9 years ago
are you using version manager like rvm or chruby?
I do use chruby.
On Tue, Dec 30, 2014, 5:09 PM Michal Papis notifications@github.com wrote:
are you using version manager like rvm or chruby?
— Reply to this email directly or view it on GitHub https://github.com/jish/pre-commit/issues/196#issuecomment-68415952.
@postmodern / @havenwood given https://github.com/jish/pre-commit/blob/master/templates/hooks/automatic I assume the command would be ~ sh -c ruby -rrubygems -rpre-commit -e "PreCommit.run"
- question: how to identify which ruby would be run and install the missing gem(scss-lint
) for it?
btw. if there is more to do to support chruby
than just calling ruby
in the subprocess, can you open a PR for the template?
As @mpapis informed me, the command is being ran in a plain shell from git? As long as auto.sh
gets loaded by the shell, auto-switching should take; before the first command for zsh and after the first command for bash. Maybe invoking sh -l ...
would work?
as discussed in irc sh -l
is out of question as it would slow down every commit, maybe new template could be an option where the auto-switching is loaded and then call to ruby is made ... or maybe chruby could provide this script and our automatic
template would use it
Or since git does not preserve the current shell environment, maybe install scss-lint globally under system ruby?
what would be the flow for chruby to do that?
chruby system
sudo gem install scss-lint
# scss-lint should now be accessible to git and cron
assuming there was a system ruby, this is complicated, is there a "default" ruby in chruby like it is in RVM?
The default ruby is system ruby. You can configure a default ruby via the shell configuration or via .ruby-version
. However, since git blows away the current environment, the default ruby may not be the user selected ruby.
this sounds like nightmare, maybe we could promote an description/wiki that shows what to do, maybe selecting one ruby and setting it in git config --global pre-commit.ruby="chruby..."
?
It is not a nightmare to install a gem globally. system ruby exists for a reason. Don't fear the system ruby, don't fear your own system.
assuming there is a system ruby, I know it's really common this days, but still not a base requirement for a linux system
Any time I commit a scss file, pre-commit fails with this error:
I am using pre-commit with a YAML configuration file like this: