Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Last active October 14, 2015 06:30
Show Gist options
  • Save amitpatelx/70ec2ec927daf104c2bd to your computer and use it in GitHub Desktop.
Save amitpatelx/70ec2ec927daf104c2bd to your computer and use it in GitHub Desktop.
#Better Errors #Rubymine #Ubuntu
Ubuntu 14.10 / better_errors (2.0.0) / RubyMine 7.0
1) Put mine-open.desktop to /usr/share/applications/
2) Create mine-open.sh anywhere having content as given. Make sure to give execute permisssion(sudo chmod 777 mine-open.sh)
3) Set correct path for mine-open.sh in mine-open.desktop file
3) sudo update-desktop-database
5) Add following configuration in development.rb
BetterErrors.editor = proc { |full_path, line| "rubymine://open?file=#{full_path}&line=#{line}"}
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec=/home/amit/scripts/mine-open.sh %u
Name[en_US]=MineOpen
Comment[en_US]=Small, easy-to-use program to access Rubymine
Name=MineOpen
Comment=Small, easy-to-use program to access Rubymine
Categories=Application;Network;
MimeType=x-scheme-handler/rubymine;
Comment[en_US.utf8]=Small, easy-to-use program to access Rubymine
#!/usr/bin/env ruby
#encoding: UTF-8
#script opens URL in format rubymine://open?url=file://%{file}&line=%{line} in RubyMine
arg_line = ARGV[0]
at_exit {
ObjectSpace.garbage_collect
exit
}
/rubymine:\/\/open\?(.*)/ =~ arg_line
if $1
parts = $1.split("&")
args = {}
parts.each do |part|
arg_pair = part.split("=", 2)
if arg_pair.size == 2
args[arg_pair[0]] = arg_pair[1]
end
end
if args["file"]
command = "mine"
command += " #{args['file']}"
command += ":#{args['line']}" if args['line']
exec command
end
else
puts 'not found'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment