Skip to content

Instantly share code, notes, and snippets.

@jewilmeer
Created January 6, 2012 12:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jewilmeer/1570296 to your computer and use it in GitHub Desktop.
Save jewilmeer/1570296 to your computer and use it in GitHub Desktop.
Sublime 2 with .rvmrc loading
// 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"
}
#!/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