如何在sublime-text-2中运行ruby文件

时间:2021-03-16 07:34:01

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

按ctrl+b运行简单代码时,如:

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].

结果是空白字段。Ruby路径/home/yukke/.rvm/红宝石/默认/bin/ruby和ruby -v => ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-linux]。

so I tried to change Ruby.sublime-build to

所以我试着改变Ruby。sublime-build来

{
    "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.

但这并没有改变什么。请帮我解决这个问题。

2 个解决方案

#1


7  

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

试试这个,取出“-u”,使用rvm

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

#2


1  

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.

你需要在文件生效之前保存它。它不像TextMate的命令那样好,也不以同样的方式工作,如果这是你所期望的。

#1


7  

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

试试这个,取出“-u”,使用rvm

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

#2


1  

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.

你需要在文件生效之前保存它。它不像TextMate的命令那样好,也不以同样的方式工作,如果这是你所期望的。