mattetti / Weasel-Diesel

DSL to describe, document and test web services
MIT License
438 stars 21 forks source link

Move documentation generation into WeaselDiesel #30

Closed kamui closed 11 years ago

kamui commented 11 years ago

It's currently in https://github.com/mattetti/wd-sinatra, but it makes more sense in WD itself. This isn't ready to be merged, it's mostly a quick and dirty proof of concept. We should probably discuss whether or not this is the right approach.

In wd_sinatra, it was defined as a rake task. Here I changed it into a weasel_diesel CLI via Thor. It takes 1 required argument, which is the source path, and a second optional argument, which is doc destination path. I had to stub in an implementation method in WeaselDiesel, so that the doc generator could parse the web service definitions.

If you wanted it to read your ruby api files in the api directory, and put the doc in the doc directory, you would use it like:

weasel_diesel api doc

I ran it against my local test wd_sinatra app, and it seems to work.

kamui commented 11 years ago

Here's a sample of the theme I created with Bootstrap 3.0. I also managed to fix some quirks with the documentation template.

mattetti commented 11 years ago

Seems good to me as long as we can wrap that up in WD Sinatra to make a simple call to generate the doc (passing the path isn't great user experience)

On Mon, Aug 26, 2013 at 8:34 PM, Jack Chu notifications@github.com wrote:

Here's a screenshothttp://cl.ly/R2Oo/Screen%20Shot%202013-08-26%20at%2011.32.19%20PM.pngof the theme I created with Bootstrap 3.0. I also managed to fix some quirks with the documentation template.

— Reply to this email directly or view it on GitHubhttps://github.com/mattetti/Weasel-Diesel/pull/30#issuecomment-23311114 .

kamui commented 11 years ago

I agree, but it's necessary for WD to generate documentation since there's no telling where the user might put the ruby files.

I extracted the cli class from the bin. wd_sinatra will wrap that thor function and supply a source path (api). Then you can generate docs from wd_sinatra without a source path like:

thor :generate_doc
kamui commented 11 years ago

I think this can be merged now, unless anyone sees any issues. I have commits for wd_sinatra ready to push once this is merged.

mattetti commented 11 years ago

go for it

On Mon, Aug 26, 2013 at 10:10 PM, Jack Chu notifications@github.com wrote:

I think this can be merged now, unless anyone sees any issues. I have commits for wd_sinatra ready to push once this is merged.

— Reply to this email directly or view it on GitHubhttps://github.com/mattetti/Weasel-Diesel/pull/30#issuecomment-23313406 .