🖌 BetterRoutes
Print routes on Ruby on Rails with various formats.
It is easy way to copy and paste on Spreadsheet, GitHub and so on :)
🤲 Usage
$ rake better_routes
📐 Formats
Sample routes file
# config/routes.rb
Rails.application.routes.draw do
resources :entries
end
TSV (Tab Separated Values)
# (default)
$ FORMAT=tsv rake better_routes
Prefix, Verb, URI Pattern, Controller#Action
entries GET /entries(.:format) entries#index
POST /entries(.:format) entries#create
new_entry GET /entries/new(.:format) entries#new
edit_entry GET /entries/:id/edit(.:format) entries#edit
entry GET /entries/:id(.:format) entries#show
PATCH /entries/:id(.:format) entries#update
PUT /entries/:id(.:format) entries#update
DELETE /entries/:id(.:format) entries#destroy
CSV (Comma Separated Values)
$ FORMAT=csv rake better_routes
Prefix, Verb, URI Pattern, Controller#Action
entries,GET,/entries(.:format),entries#index
,POST,/entries(.:format),entries#create
new_entry,GET,/entries/new(.:format),entries#new
edit_entry,GET,/entries/:id/edit(.:format),entries#edit
entry,GET,/entries/:id(.:format),entries#show
,PATCH,/entries/:id(.:format),entries#update
,PUT,/entries/:id(.:format),entries#update
,DELETE,/entries/:id(.:format),entries#destroy
Markdown Table
$ FORMAT=markdown rake better_routes
|Prefix|Verb|URI Pattern|Controller#Action|
|------|----|-----------|-----------------|
|entries|GET|/entries(.:format)|entries#index|
||POST|/entries(.:format)|entries#create|
|new_entry|GET|/entries/new(.:format)|entries#new|
|edit_entry|GET|/entries/:id/edit(.:format)|entries#edit|
|entry|GET|/entries/:id(.:format)|entries#show|
||PATCH|/entries/:id(.:format)|entries#update|
||PUT|/entries/:id(.:format)|entries#update|
||DELETE|/entries/:id(.:format)|entries#destroy|
🤝 Installation
Add this line to your application's Gemfile:
gem 'better_routes'
And then execute:
$ bundle
Or install it yourself as:
$ gem install better_routes
👍 Contributing
Contribution directions go here.
👉 License
The gem is available as open source under the terms of the MIT License.