开发者

What's the best way to generate an API reference document using a Rails routes.rb file?

开发者 https://www.devze.com 2023-02-02 11:43 出处:网络
I am trying to document the API for my Rails application and I can\'t help but wonder if there is a better way to generate an开发者_JS百科 XML file based on my routes.rb file.I\'m envisioning somethin

I am trying to document the API for my Rails application and I can't help but wonder if there is a better way to generate an开发者_JS百科 XML file based on my routes.rb file. I'm envisioning something similar to the output of rake routes but in a more friendly, XML type format. Corey has some interesting ideas about using reflection/introspection on the routes file here but it's not quite what I need.

Please tell me this is a solved problem and I'm not the first one to think of this. :)


rake routes is a normal rake task:

https://github.com/rails/rails/blob/master/railties/lib/rails/tasks/routes.rake

Perhaps you could learn relevant things from it and write a new task for generating routes in a (-cough-) more friendly xml format. ;)


I couldn't really find an exact match for what you're looking for (which surprised me too) but you might look at a sitemap gem to get started with what you want. This might have to be custom code ... sadly

0

精彩评论

暂无评论...
验证码 换一张
取 消