[OT] CodeRunner and RVM

I just bought the new Mac app CodeRunner, which is really very cool. If
you haven’t seen it, do give it a look, because it allows you to run a
whole lot of different languages’ scripts directly in an editor/console
environment and get the results from your snippet.

However, I can’t seem to get it to play correctly with RVM.

Has anyone here had any experience with this combination yet? Any tips?
Yes, I did try putting my RVM path into the preferences (and a shebang),
but that didn’t have any noticeable effect. It seems to be running
everything through a /Library/Ruby/Site/1.8/rubygems when I require 'rubygems' and from there on, it just gets everything wrong.

Thanks,

Walter

hello, you can change the Languages preferences ‘Run Command’ from:
ruby $filename
to:
[[ -s /Users/yourname/.rvm/scripts/rvm ]] && source
/Users/yourname/.rvm/scripts/rvm && ruby $filename

pls change yourname to your home folder name :slight_smile:

On Jan 10, 2012, at 10:54 PM, ruijie chen wrote:

hello, you can change the Languages preferences ‘Run Command’ from:
ruby $filename
to:
[[ -s /Users/yourname/.rvm/scripts/rvm ]] && source
/Users/yourname/.rvm/scripts/rvm && ruby $filename

pls change yourname to your home folder name :slight_smile:

That’s not working here. I get no output other than Run Failed. If I
pull it back to ruby $filename, I at least get an error message, and I
get the same error message if I put an explicit path to the
rvm-installed ruby in place of the bare word ruby. (It’s running the
correct ruby in either case.)

<updated rvm to very latest version, using your run command unedited
gives me:>

tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
/Users/waltd/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require': no such file to load -- nokogiri (LoadError) from /Users/waltd/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from test.rb:2

Line 2 of my test script is simply require ‘nokogiri’ (and line 1 is
require ‘rubygems’). gem list shows Nokogiri 1.5.0 installed and working
(it works in other scripts or irb).

Walter

are you sure you run stable rvm ?

rvm get stable

also you can use one of rubies listed by:

ls -1 $rvm_path/wrappers/*/ruby

just put the full path instead of ruby in the ‘Run Command’:

ruby $filename

Yes, and yes, I already tried that first. I get the correct ruby in any
script I run in there, but I don’t see the nokogiri gem, even though
it’s listed correctly in gem list.

Walter

Version 1.10.1 of RVM can also work, but it will output the error
message: ‘tput: No value for $TERM and no -T specified’, at the
console’s top.

with 1.10.1

It’s seem to the latest version of rvm (1.10.1) has some problem, you
can install the 1.10.0 version through the command:

rvm get 1.10.0

then try to re-run your code snippets.

sorry for my bad english, i am a chinese.

New version of CodeRunner just released through the MAS, it works
perfectly with gems and RVM, with no fussing in the path preferences. I
edited it back to ‘ruby $filename’ and all’s right with the world.

Walter

Unfortunately, the new version of CodeRunner Will still output the error
message ‘tput: No value for $TERM and no -T specified’, if you update
the RVM to 1.10.1

The issue I am trying to solve is the gem loading. If I want to run a
simple snippet such as the one you showed, I agree, it works perfectly.
But anything fancier than that fails. I can load a standard library like
Time, but anything from gem (besides rubygems itself) seems to fail.

Walter

Sorry , I was wrong , it should be:
[[ -s /Users/scriptfans/.rvm/scripts/rvm ]] && TERM=xterm-256color
source /Users/scriptfans/.rvm/scripts/rvm

the new version of CodeRunner now can recognition of user’s PATH
variables, so I edited the Run Command back to ‘ruby $filename’, but
when I run ruby code it’s still output the message. and it causes the
problem in all other languages snippets output, etc the Python,
ObjectiveC. Then, I try to edit my ~/.profile to add the prefixes to
RVM’s config.
before the change:

[[ -s /Users/scriptfans/.rvm/scripts/rvm ]] && source
/Users/scriptfans/.rvm/scripts/rvm

after try to run the echo $TERM command in the Terminal, i see the
output is xterm-256color, so i change the config to:

[[ -s /Users/scriptfans/.rvm/scripts/rvm ]] && source
TERM=xterm-256color /Users/scriptfans/.rvm/scripts/rvm

and all’s right with the world.

But is that correct? will have any side effects? I’m not sure.

I think this is a RVM’s bug, because the old version is no problem.