use within other scripts #22

Open
svnlto opened this Issue Feb 10, 2012 · 4 comments

Comments

Projects
None yet
3 participants

svnlto commented Feb 10, 2012

hey there,

I'm writing a grunt task that generates docs and I was thinking of using groc. I was wondering if it's possible to use groc within another script as opposed to on the CLI.

Owner

nevir commented Feb 10, 2012

I have a very rough API that you could use, though it's definitely going to be a moving target for a while. (I'm totally happy to work with you to solidify it over time though)

Take a look at where the CLI code builds a Project object for the low level API.

Alternatively, you can fake a command line call w/o the shell as an intermediary by including the CLI module directly, and calling it similar to the bin file - this interface is less likely to change, but is definitely more awkward.

Owner

nevir commented Feb 10, 2012

Thinking further on this, a better and probably relatively stable API would be to decouple the argument parsing, and have a call that takes the resultant options hash - easy to configure, and also plays nicely with the.groc.json file

I was trying to create a GrunJS taks as well: https://gist.github.com/4552595 . But can't get it to work without the .groc.json file (and using the grunt initConfig instead). Any suggestions what I could do to accomplish that?

Actually I just got it to work by converting the grunt options (same structure as the .groc.json file) to a list of CLI commands. Please check the https://gist.github.com/4552595 gist again, I just updated it.

@nevir , if you think that is a good solution, perhaps we could have that integrated with Groc so it plays nice with Grunt builds?

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment