Created
January 6, 2012 12:08
-
-
Save jewilmeer/1570296 to your computer and use it in GitHub Desktop.
Sublime 2 with .rvmrc loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// This file lives @ /Library/Application Support/Sublime Text 2/Packages/User/RubyTest.sublime-build | |
{ | |
"ruby_unit_exec": "~/bin/rvm_ruby ruby -Itest", | |
"ruby_cucumber_exec": "~/bin/rvm_ruby cucumber --no-color", | |
"ruby_rspec_exec": "~/bin/rvm_ruby rspec", | |
"ruby_unit_folder": "test", | |
"ruby_cucumber_folder": "features", | |
"ruby_rspec_folder": "spec" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# found @ http://www.langalex.org/post/150685454/Sublime-Text-2-with-RVM-on-OSX | |
# modified / hacked to work with https://github.com/maltize/sublime-text-2-ruby-tests | |
# place this file @ ~/bin/rvm_ruby | |
# make sure this file is executable | |
# search within the given arguments for a valid filepath | |
file = File.expand_path(ARGV.find{|arg| File.exists?(arg) } || (STDERR.puts('you must specify a ruby file'); exit(-1))) | |
cmd = ARGV * ' ' | |
dir = File.dirname file | |
while dir.size > 1 | |
if File.exist?(dir + '/.rvmrc') | |
exec %(source $HOME/.rvm/scripts/rvm && cd #{dir} && #{cmd}) | |
else | |
dir = dir.sub(/\/[^\/]*$/, '') | |
end | |
end | |
puts "Could not find any .rvmrc above #{file}" | |
exit -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment