Repository is archived
No commit activity in last 3 years
No release in over 3 years
Rake command for printing out all defined routes in Sinatra applications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
 Project Readme

sinatra-rake-routes Circle CI

rake routes command for Sinatra applications for printing out all defined routes.

Usage

Install by adding the following to your Gemfile:

gem 'sinatra-rake-routes'

Add the below code to your Rakefile. Make sure to require sinatra-rake-routes/tasks after the :configure_routes task is defined, otherwise it won't be picked up correctly.

# Rakefile

task :configure_routes do
  require "sinatra-rake-routes"
  # Tell SinatraRakeRoutes what your Sinatra::Base application class is called:
  require './my_app'
  SinatraRakeRoutes.set_app_class(MyApp)
end

require "sinatra-rake-routes/tasks"

Example output

bundle exec rake routes

POST
/users
/users/:user_id/messages

GET
/users/:user_id
/users/:user_id/messages
/users/:user_id/messages/:message_id

HEAD
/users/:user_id
/users/:user_id/messages
/users/:user_id/messages/:message_id

PUT
/users/:user_id
/users/:user_id/messages/:message_id

DELETE
/users/:user_id