How to run ruby files in sublime-text-2

2019-05-23 21:36发布

问题:

When i press ctrl+b to run simple code such as:

puts "asdasd"

the result is blank field. Ruby path is /home/yukke/.rvm/rubies/default/bin/ruby and ruby -v => ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux].

so I tried to change Ruby.sublime-build to

{
    "cmd": ["/home/yukke/.rvm/rubies/default/bin/ruby", "-u","$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.ruby"
}

But it didn't change anything. Please help me to fix this problem.

回答1:

Try this, take out the "-u", and use rvm

"cmd": ["/home/yukke/.rvm/bin/rvm-auto-ruby", "$file"]


回答2:

You need to save the file before it will work. It's not nearly as nice as TextMate's CommandR, and doesn't work in the same way, if that was what you were expecting.