Skip to content
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

scss-lint fails #196

Open
shawnacscott opened this issue Dec 31, 2014 · 13 comments
Open

scss-lint fails #196

shawnacscott opened this issue Dec 31, 2014 · 13 comments

Comments

@shawnacscott
Copy link

Any time I commit a scss file, pre-commit fails with this error:

pre-commit: Stopping commit because of errors.
sh: scss-lint: command not found

I am using pre-commit with a YAML configuration file like this:

:checks:    [common, rails, rspec_focus, pry, ruby_symbol_hashrockets, tabs, console_log, debugger, tabs, whitespace, merge_conflict, rubocop, scss_lint]
:warnings:  []
@mpapis
Copy link
Collaborator

mpapis commented Dec 31, 2014

are you using version manager like rvm or chruby?

@shawnacscott
Copy link
Author

I do use chruby.

On Tue, Dec 30, 2014, 5:09 PM Michal Papis [email protected] wrote:

are you using version manager like rvm or chruby?


Reply to this email directly or view it on GitHub
#196 (comment).

@mpapis
Copy link
Collaborator

mpapis commented Jan 3, 2015

@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?

@postmodern
Copy link

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?

@mpapis
Copy link
Collaborator

mpapis commented Jan 3, 2015

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

@postmodern
Copy link

Or since git does not preserve the current shell environment, maybe install scss-lint globally under system ruby?

@mpapis
Copy link
Collaborator

mpapis commented Jan 4, 2015

what would be the flow for chruby to do that?

@postmodern
Copy link

chruby system
sudo gem install scss-lint
# scss-lint should now be accessible to git and cron

@mpapis
Copy link
Collaborator

mpapis commented Jan 5, 2015

assuming there was a system ruby, this is complicated, is there a "default" ruby in chruby like it is in RVM?

@postmodern
Copy link

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.

@mpapis
Copy link
Collaborator

mpapis commented Jan 5, 2015

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..."?

@postmodern
Copy link

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.

@mpapis
Copy link
Collaborator

mpapis commented Jan 5, 2015

assuming there is a system ruby, I know it's really common this days, but still not a base requirement for a linux system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants