rubymacosgeektool

How to run Ruby scripts in Geektool?


I want to run a Ruby script in Geektool that refreshes every 3 hours (so I set the refresh rate to 10,800 seconds) and the shell command in Geektool has this code in it:

ruby "/file.rb"

The file is located at root for convenience. Problem is, it won't run. I tried different commands, such as:

/Users/userhere/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /file.rb

But it still doesn't work. I don't want it to use my /usr/bin/ruby installation (which, by default, is 1.8.7), I want it to use 1.9.3. So doing: /usr/bin/ruby "/file.rb" won't work for me.

In Terminal, if I run any of those commands they all work (except for the latter, because of dependencies) and my script works fine, but Geektool fails to even execute it. I tried with and without double quotes around the file name, even single quotes don't work.

Any help would be greatly appreciated.


Solution

  • I needed an rvm gemset as well; I created a shell file:

    /Users/Dave/.rvm/bin/rvm use 1.9.3-p0 > /dev/null
    /Users/Dave/.rvm/rubies/ruby-1.9.3-p0/bin/ruby ~/foo.rb
    

    With that shell file (which happens to reside in a directory off my ~) as the shell command it works fine.

    Without the full paths to each command it doesn't work. GeekTool doesn't run your .bash_profile AFAICT. Also not sure that running an rvm Ruby w/o using it would do what you want anyway.