I'm prototyping some calendar/date stuff for a Rails app in standalone scripts, and want access to both normal Rails things (in this case, ActiveSupport's date math, like Date.today - 3.days) and my own classes within the prototyping directory. I'd like to continue using TextMate's "Run" command to run the current buffer as a Ruby script, since it's convenient. I'm using rvm; my prototyping directory has the same .rvmrc file as my Rails app.
My previous TextMate/rvm post (written for a different MacBook Pro) detailed setting TM's PATH environment variable; on this one I didn't have to do that--I just set TM's TM_RUBY to rvm's auto-ruby, ~/.rvm/bin/rvm-auto-ruby, and with a simple require 'active_support/all', date math.
Setting TM_RUBY made my own requires of code in the prototype directory fail, though. My quick fix was to set TM's RUBYLIB env var to .:${RUBYLIB} since everything I needed for this was in the current directory.
Potentially a little gross, but for now, it's letting me continue. I suspect I may rely more and more on Pry for this type of hacking in the future.
Showing posts with label textmate. Show all posts
Showing posts with label textmate. Show all posts
Monday, September 05, 2011
Friday, July 01, 2011
Textmate and rvm, behave!
Several sites describe the process necessary to get TextMate to use either a wrapped (via the rvm wrapper command) or an rvm-specified default Ruby interpreter (including gemsets, basically anything you can use with the rvm use command).
Following just those steps never worked for me, even when I explicitly gave a wrapped TM_RUBY: it would still do an exec ruby in there and blow up. I've solved this (at least temporarily) by adding my ~/.rvm/bin directory to TextMate's PATH shell variable.
Subscribe to:
Posts (Atom)