Error Building Ruby in Sublime Text Editor

Error Building Ruby in Sublime Text Editor

The problem seems to be the ~ in your Ruby command path.
It may not be very general, but try to change

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

with

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

Sublime Text 3 can't compile ruby

I was having the same issue. Saving the file before building it in Sublime Text resolved it.

  1. Save File
  2. ctrl + B to build
  3. Output appears in the build window

Running RubyTest in Sublime Text 3 throws errors

Looks like the issue was with rbenv-gemset. Bundler was installed in a gemset, and Sublime wasn't picking it up. As soon as I removed rbenv-gemset and ran gem install bundler, everything worked as expected.

Sublime text can't understand gets.chomp

Sublime can't handle interactive input on its own. You can either run your script through SublimeREPL or create a customized build system to open a command prompt and then run the code. Fortunately, this isn't too difficult. Create a new file in Sublime with the following contents:

{
"cmd": ["start", "cmd", "/k", "c:/ruby193/bin/ruby.exe", "$file"],
"selector": "source.ruby",
"shell": true,
"working_dir": "$file_dir"
}

Save it as Packages/User/Ruby_cmd.sublime-build, where Packages is the directory opened when selecting Preferences -> Browse Packages.... Select Tools -> Build System -> Ruby_cmd, and run your file with CtrlB.

This should work on all versions of Windows from XP on up. It is not intended for OSX or Linux, though, as they don't have the start and cmd programs...



Related Topics



Leave a reply



Submit