Skip to content

Instantly share code, notes, and snippets.

@ecerulm
Created January 29, 2012 08:37
Show Gist options
  • Save ecerulm/1697895 to your computer and use it in GitHub Desktop.
Save ecerulm/1697895 to your computer and use it in GitHub Desktop.
Wrapper for spec (bundled) to use with Sublime Text 2
{
"cmd": ["/Users/ecerulm/bin/sublime_rvm.rb", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
{
"ruby_unit_exec": "ruby -Itest",
"ruby_cucumber_exec": "cucumber --no-color",
"ruby_rspec_exec": "/Users/ecerulm/bin/sublime_rspec.rb",
"ruby_unit_folder": "test",
"ruby_cucumber_folder": "features",
"ruby_rspec_folder": "spec"
}
#!/usr/bin/env ruby
file = File.expand_path(ARGV[0] || (STDERR.puts('you must specify a ruby file'); exit(-1)))
dir = File.dirname file
while dir.size > 1
if File.exist?(dir + '/.rvmrc')
to_exec = "source \"$HOME/.rvm/scripts/rvm\";cd #{dir}; bundle exec rspec #{file}"
#puts to_exec
exec(to_exec)
else
dir = dir.sub(/\/[^\/]*$/, '')
end
end
puts "Could not find any .rvmrc above #{file}"
exit(-1)
#!/usr/bin/env ruby
file = File.expand_path(ARGV[0] || (STDERR.puts('you must specify a ruby file'); exit(-1)))
dir = File.dirname file
while dir.size > 1
if File.exist?(dir + '/.rvmrc')
to_exec = "source \"$HOME/.rvm/scripts/rvm\";cd #{dir}; ruby #{file}"
#puts to_exec
exec(to_exec)
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