Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 Launch ruby file in terminal

I am trying to launch terminal from Sublime Text 2 which would than run Ruby file (via Build System). Reason I am not using built in ruby build system is that my ruby script takes input, which does not work in sublime output panel.

Does anybody have build system which does this?

like image 938
Haris Krajina Avatar asked Nov 13 '22 22:11

Haris Krajina


1 Answers

OK, You could create a file ruby.sh (for example in your home folder):

/home/your/home/ruby.sh

 #!/bin/sh
 /usr/bin/xterm -e /bin/sh -c "/path/to/ruby $1; exec /bin/sh" &

Create a new Sublime build file:

{
    "cmd": ["/home/your/home/ruby.sh", "$file"]
}

Now when you press CTRL-B your ruby.sh should be executed, and that executes ruby with your current buffer/file. It opens xterm as a new window (tested).

like image 150
Roger Avatar answered Dec 09 '22 07:12

Roger