basgren / railways

A plugin for RubyMine and IntelliJ IDEA Ultimate that adds a panel with routes of Ruby on Rails application.
MIT License
46 stars 18 forks source link

[feature] Grape routes #24

Open ZeroInputCtrl opened 8 years ago

ZeroInputCtrl commented 8 years ago

There is a gem called "grape_on_rails_routes". It would be nice if this gem is installed (or a setting to change) to use "rake grape:routes" so this plugin will pick up routes from grape instead.

basgren commented 8 years ago

Hi. Please open Railways settings (there's a button in Routes panel next to "Update route list" button) and set "Rake task name" parameter to grape:routes. This setting is project-wide, so other projects won't be affected. Please let me know if it works for you.

ZeroInputCtrl commented 8 years ago

This works but it can't seem to parse the path/action correctly. I think it's because they are different formats. The verb is being detected perfectly fine though.

ZeroInputCtrl commented 8 years ago

This is what the output looks like on each line, method, endpoint path, api version, description

Majority of endpoints use the api version at the beginning and all use (.:format) at the end.

DELETE | /:version/static_endpoint_path/:endpoint_variable(.:format) | v1 | Endpoint description

basgren commented 8 years ago

Hmmm... I see. Thank you for the information. While it's not hard to parse string of this format, but I need to find all possible formats of route output to parse well, otherwise output may be messy. Could you please provide more samples? Another solution would be to add another output format to grape_on_rails_routes gem itself. I'll think about it too.

ZeroInputCtrl commented 8 years ago

This is the only other thing i can think of, it's a base route so it doesn't have a api version. the url variables (:variable) can be anywhere in the route with as many of them in it.

GET | /swagger_doc/:name(.:format) | | Swagger compatible API description for specific API