https://github.com/softprops/sinatra-doc
self documentaion for your sinatra app's routes
https://github.com/softprops/sinatra-doc
Last synced: 4 months ago
JSON representation
self documentaion for your sinatra app's routes
- Host: GitHub
- URL: https://github.com/softprops/sinatra-doc
- Owner: softprops
- Created: 2009-11-05T02:41:01.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2013-03-10T19:51:41.000Z (over 13 years ago)
- Last Synced: 2025-12-05T00:36:53.848Z (6 months ago)
- Language: Ruby
- Homepage:
- Size: 103 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sinatra-doc
self documentaion for your [sinatra]("http://sinatrarb.com") app's routes
NOTE: this project is now longer being actively maintained. I recommend you check out a more active (and probably more well-written) project [sinatra-docdsl](https://github.com/jillesvangurp/sinatra-docdsl)
# install
> gem install sinatra-doc
# usage
see the reference implementation [app.rb](http://github.com/softprops/sinatra-doc/blob/master/app.rb)
básicamente above any route you want documented, just add
doc "some description"
or
doc "some description", { hash of params to param descriptions }
afterward a new route /doc will be added to your app that renders these documented routes
an example
> your app.rb
class App < Sinatra::Base
register Sinatra::Doc
doc "gets a list of foos"
get "foos" { ... }
doc "gets a specific foo", {
:id => "identifier for a given foo"
}
get "foos/:id" { ... }
end
> GET /doc
sinatra doc
GET foos gets a list of foos
GET foos/:id gets a specific foo
:id identifier for a given foo
# Props
based on an idea [@bmizerany]("http://twitter.com/bmizerany") proposed in a heroku talk in nyc
# TODO
* rake sinatra::doc #=> à la rails rake:routes
* clean up rendering of docs
2009 softprops (doug tangren)