Scrimmage / karma-slim-preprocessor

Compiles slim to html for karma tests
MIT License
5 stars 6 forks source link

ability to set the location of slimrb binary #1

Open arkarkark opened 10 years ago

arkarkark commented 10 years ago

I'd really like the ability to specify where the slimrb binary is. is that possible?

My project is a jruby/rails via rvm which means that when slimrb fires up on the command line it takes ages to start up because it fires up java.

in /usr/local/bin/slimrb I have this:

#!/bin/bash
source $HOME/.rvm/scripts/rvm
rvm use ruby >/dev/null
$HOME/.rvm/gems/ruby-2.1.2/gems/slim-2.0.3/bin/slimrb "$@"

This runs nice and fast, but no matter what I do to my path before starting karma this one isn't used by karma-slim-preprocessor.

If I edit line 14 in slim2html.js to be this child = spawn("/usr/local/bin/slimrb", [origPath]) everything works great for me.

Do you know of a way for me to force use of a specific slimrb?

I feel bad opening the first issue.

ratbeard commented 10 years ago

Haha don't feel bad, I feel bad not seeing this till now :(

Yea it seems simple enough to add that as an option, probably simpler than debugging rvm path issues. I will take a look at it :rat:

ratbeard commented 10 years ago

Pushed up a fix to master that adds the slimrb config option as in your fork. I made it search for the slimrb command when the plugin is instantiated, which gives a better error message and cleans up the error checking logic inside the process function. If you wouldn't mind giving the dev version a try, otherwise I'll bump the npm version soon:

npm install Scrimmage/karma-slim-preprocessor --save-dev