Running "sass --watch" as an external tool

Hi,

I'm using Sass (Scss) and see that you are going to add an "automatically watch and compile .sass/.scss file(s) into .css file(s)" feature. (At least I think you are. I have the Nov. 29 build and it isn't in there yet.)

Question 1: Are you planning to implement this feature? (If so - thanks!)

In your Bug Base you told someone they could set this feature up as an external tool so they would not have to go out to the console and manually run the command. That person replied that it was a snap to set up.(RUBY-7267)

I tried that and It's not working, and I am wondering if you can tell me why.

Here is the command working from my console:
larry@larry-desk:~/RubymineProjects3/stupidtuesday/public/stylesheets/sass$ sass --watch screen.scss:../screen.css
>>> Sass is watching for changes. Press Ctrl-C to stop.
     create ../screen.css
Warning: Unable to load rb-inotify >= 0.5.1. Inotify will be unavailable.
>>> Change detected to: screen.scss
  overwrite ../screen.css

As you can see, I am in the /stylesheets/sass directory and issuing the command to watch the .scss file in that directory, and then put the compiled .css file into the regular /stylesheets directory. I did it this way because (a) a hidden '.sass-cache' directory gets created, and I wanted that to stay in the /sass directory, and (b) so the .css file would end up where it is supposed to live.

This is what I entered for the "sass" External Tool that I created:
Program: sass
Parameters: --watch screen.scss:../screen.css
Working Directory: /home/larry/RubymineProjects3/stupidtuesday/public/stylesheets/sass

As you can see, these settings mimic what I did in the command console. However, when I try to run this External Tool it gives me the following error:
Error running sass: Cannot run program sass (in directory /home/larry/RubymineProjects3/stupidtuesday/public/stylesheets/sass): java.io.IOException: error=2, No such file or directory.

Can you tell me what I am doing wrong?

Thanks,
Larry

P.S. BONUS QUESTION: if you could give us a heads-up as to when we can expect this  to be done automatically... well, that would make for a nice Christmas  present! :)

3 comments
Comment actions Permalink

Hello Larry,

Indeed, this feature is scheduled for the further versions of RubyMine.
Please fill in the full path to the sass executable - this should help.

Regards,
Oleg

0
Comment actions Permalink

Hi Oleg,

That did help. I got farther, but ran into another problem. How can I let the External Tool know where my gems are located. (I think this is the problem. As I said, the command works fine when I fire up a console and run it.) The error output is below.

Thanks,
Larry

/home/larry/.rvm/gems/ruby-1.9.2-p0@stuptues/bin/sass --watch screen.scss:../screen.css
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem haml (>= 0) (Gem::LoadError)
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
    from /home/larry/.rvm/gems/ruby-1.9.2-p0@stuptues/bin/sass:18

Process finished with exit code 1

0
Comment actions Permalink

The problem is that when you lauch anything in console you have all the environment settings configured in .bashrc, but when you create external tool action the process created doesn't inherit this bash settings. The easiest workaround is to create bash script containing the desired command sass --watch folder and configure the executable as /usr/bin/bash script.sh
Hope this helps! However expect native support in further version of RubyMine.

Regards,
Oleg

0

Please sign in to leave a comment.