Skip to content

Instantly share code, notes, and snippets.

@jasonmay
Created February 27, 2012 23:25
Show Gist options
  • Save jasonmay/1927878 to your computer and use it in GitHub Desktop.
Save jasonmay/1927878 to your computer and use it in GitHub Desktop.
Load rails stacktraces into quickfix
#!/usr/bin/env ruby
require 'tempfile'
file = Tempfile.new('rails-trace');
ARGF.each do |line|
fields = line.chomp.strip.split(/\s+/, 3)
next unless fields.size >= 3
if fields[1] =~ /\(.+\)/
bundlepath = `bundle show #{fields[0]}`.chomp
path = "#{bundlepath}/#{fields[2]}"
else
path = fields[2]
end
file.write("#{path}\n")
end
file.close
exec("vim -q #{file.path}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment