Reputation: 15286
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?
Upvotes: 5
Views: 2206
Reputation: 618
About add a custom build-system file, I want to add some specific things.
1 When you create you build-system file, save it in : ~/Library/Application Support/Sublime Text 2/Packages/User
PC I'm not sure, perhaps like a directory path : ...APPDATA/ROAMING/Sublime Text2/ ...
2 The build-system file 's source code is not complete. Maybe the following is better:
{
"cmd": ["~/.rvm/bin/rvm-auto-ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
More info to:More info
Upvotes: 0
Reputation: 7612
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).
Upvotes: 1