Created
          May 27, 2017 14:06 
        
      - 
      
 - 
        
Save mmizutani/c18bdba786211dc3ff17c236b62e5726 to your computer and use it in GitHub Desktop.  
    #Better Errors #Rubymine #Ubuntu
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | Ubuntu 14.10 / better_errors (2.0.0) / RubyMine 7.0 | |
| 1) put mine-open.desktop to /usr/share/applications/ | |
| 2) set correct path for mine-open.sh in mine-open.desktop file | |
| 3) sudo update-desktop-database | |
| 4) do executable mine-open.sh | |
| 5) update better errors BetterErrors.editor = proc { |full_path, line| "rubymine://open?file=#{full_path}&line=#{line}"} | |
| sources: | |
| https://devnet.jetbrains.net/message/5478644 | |
| http://stackoverflow.com/questions/16376429/ubuntu-custom-url-protocol-handler | |
| https://github.com/pehrlich/rubymine_heaven/blob/master/bin/mine-handler | 
  
    
      This file contains hidden or 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
    
  
  
    
  | [Desktop Entry] | |
| Encoding=UTF-8 | |
| Version=1.0 | |
| Type=Application | |
| Terminal=false | |
| Exec=/home/max/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 | |
  
    
      This file contains hidden or 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 | |
| #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