16 Replies Last post: Apr 8, 2013 6:33 PM by nicolas de Moreau  
Gerard de Brieder Newbie 3 posts since
Jan 29, 2013
Currently Being Moderated

Jan 29, 2013 1:49 PM

Rubymine url scheme app (OSX) for you :)

Hello all,

 

I made a very basic applescript app that registers the rubymine:// url scheme.

 

Make sure you use the Rubymine Beta 5 or higher.

Update your rubymine command-line-launcher by going to Tools -> Create Command-line Launcher

 

The full url should be in the form of : rubymine://open?url=file://FULL_LOCAL_PATH_TO_FILE&line=LINE_NUMBER

 

I would advice to use BetterErrors (which kicks ass !) available here : https://github.com/charliesome/better_errors

Just put gem "better_errors" in your Gemfile

Then in your development.rb puts

 

BetterErrors.editor='rubymine://open?url=file://%{file}&line=%{line}'

 

You should now be able to click the error urls and rubymine will jump to it for you

 

 

Enjoy !

 

Gerard.

Attachments:
Omar Skalli Newbie 4 posts since
Jan 30, 2013
Currently Being Moderated
Jan 30, 2013 1:51 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Thanks, great script. I am using RubyMine 4.5 which doesn't seem to accept the file:line syntax, as such the script did not work for me in it's current form. When no line is specified, e.g. 'rubymine://open?url=file://%{file}', it would still try to open '{file}:' instead of '{file}'. I have added the following to fix that:

 

 


    set file_with_line_number to MyFile
    if myLine is not "" then
        set file_with_line_number to file_with_line_number & ":" & myLine
    end if

Omar Skalli Newbie 4 posts since
Jan 30, 2013
Currently Being Moderated
Jan 30, 2013 6:11 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Looks like the generate scripts supports: mine <file> -l <line>, so I have updated the script accordingly. Rubymine seems flaky however opening at the proper line, but that's minor: getting the proper to open from url is already super useful and more than sufficient (for me at least). Thanks again!

nicolas de Moreau Newbie 5 posts since
Feb 9, 2013
Currently Being Moderated
Feb 9, 2013 4:40 PM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Hi Gerard,

 

thanks for this input. I'm trying to get it to work but I've no clue what to do with the attached zip file.

 

When I double click it, nothing seems to happen.

 

Thanks!

Tri Nguyen Newbie 5 posts since
Apr 30, 2011
Currently Being Moderated
Feb 11, 2013 8:41 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

just an FYI...I actually had to put the RubyMine Url Handler.app file in my applications folder.  I suppose if you want to have it in a different directoy, you can update your path vars.

 

Thanks Gerard for this apple script!

nicolas de Moreau Newbie 5 posts since
Feb 9, 2013
Currently Being Moderated
Feb 11, 2013 10:56 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Thanks for your answer. I moved it to the application folder. When I click the link, I can see it popping up and closing in the OS X taskbar but then nothing happens...

 

To be more precise:

 

- At first, I had v5EAP and v4.5 coexisting and, in this config, It opened v4.5

- Then I upgraded to the official v5 and trashed the v4.5. Since then, it nothing opens anymore.

 

Any clue what could be wrong? I thought the name of the RubyMine App but when I look at your script, it seems to be ok...

 

Thx.

Omar Skalli Newbie 4 posts since
Jan 30, 2013
Currently Being Moderated
Feb 11, 2013 11:44 AM in response to: nicolas de Moreau
Re: Rubymine url scheme app (OSX) for you :)

Your old command line launcher might be pointing to RubyMine 4.5, which doesn't exist anymore. Try from RubyMine 5 to do "Tools > Create Command Line Launcher" and override the existing one. Hopefully that works.

nicolas de Moreau Newbie 5 posts since
Feb 9, 2013
Currently Being Moderated
Feb 11, 2013 5:11 PM in response to: Omar Skalli
Re: Rubymine url scheme app (OSX) for you :)

Tried it but doesn't change... Thx.

Hugues Huygens Newbie 1 posts since
Feb 27, 2013
Currently Being Moderated
Feb 27, 2013 1:36 PM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

What about Linux? What url/path should I use?

Pavel Dusanek Newbie 1 posts since
Mar 13, 2013
Currently Being Moderated
Mar 13, 2013 7:30 PM in response to: Hugues Huygens
Re: Rubymine url scheme app (OSX) for you :)

I've create simple script that opens URL in format rubymine://open?url=file://%{file}&line=%{line} in RubyMine

 

#!/usr/bin/env ruby

#encoding: UTF-8

#script opens URL in format rubymine://open?url=file://%{file}&line=%{line} in RubyMine

require 'uri'

 

url = ARGV.first

/file:\/\/(?<file>.+)&line=(?<line>\d+)/ =~ url

file_arg = URI.unescape(file)

line_arg = line ? ":#{line}" : ""

cmd = "mine #{file_arg}#{line_arg}"

`#{cmd}`

 

Put it somewhere in your PATH and name it eg mine-open.

To handle rubymine:// protocol in KDE you shoud create file ~/.kde/share/kde4/services/rubymine.protocol

[Protocol]

protocol=rubymine

exec=mine-open %u

input=none

output=none

helper=true

listing=

reading=false

writing=false

makedir=false

deleting=false

Look at http://askubuntu.com/questions/62585/how-do-i-set-a-new-xdg-open-setting how to do it in other desktop environments.

Hamed Asghari Newbie 1 posts since
Mar 3, 2013
Currently Being Moderated
Mar 3, 2013 8:25 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Is this the url that we should use verbatim to create the command-line launcher?

 

rubymine://open?url=file://FULL_LOCAL_PATH_TO_FILE&line=LINE_NUMBER

 

I'm using RubyMine 5 but it's not working.

Dennis Ushakov JetBrains 408 posts since
Sep 10, 2008
Currently Being Moderated
Mar 11, 2013 12:40 AM in response to: Gerard de Brieder
Re: Rubymine url scheme app (OSX) for you :)

Next RubyMine version is supporting custom protocol handler with x-mine scheme. Should we add rubymine scheme or x-mine:// is also ok for you?

nicolas de Moreau Newbie 5 posts since
Feb 9, 2013
Currently Being Moderated
Apr 8, 2013 1:11 PM in response to: Dennis Ushakov
Re: Rubymine url scheme app (OSX) for you :)

mine is ok for me!

 

Is it supported in the last EAP release? (5.4)

Dennis Ushakov JetBrains 408 posts since
Sep 10, 2008
Currently Being Moderated
Apr 8, 2013 5:07 PM in response to: nicolas de Moreau
Re: Rubymine url scheme app (OSX) for you :)

Yes, x-mine protocol from rubymine_heaven gem is supported in 5.4

nicolas de Moreau Newbie 5 posts since
Feb 9, 2013
Currently Being Moderated
Apr 8, 2013 6:33 PM in response to: Dennis Ushakov
Re: Rubymine url scheme app (OSX) for you :)

OK, it finally works. Thanks!

 

Just FYI, I didn't use "Rubymine heaven". I just did what Gerard said to do and adapted the sentence in development.rb:

 

BetterErrors.editor='x-mine://open?file=%{file}&line=%{line}' if defined? BetterErrors

 

Works like a charm. Thanks again!

More Like This

  • Retrieving data ...