Using Thor for generators in a Ruby Gem

Posted by David Burrows on Stack Overflow See other posts from Stack Overflow or by David Burrows
Published on 2010-04-15T11:11:10Z Indexed on 2010/04/15 11:13 UTC
Read the original article Hit count: 353

Filed under:
|
|

How do I setup a Gem to have a binary command eg. "project newProject" that uses Thor's set of generator commands to create files etc.?

A good answer would describe how to layout the skeleton of a gem that that when run from the command line "project newProject" creates 1 file named "newProject.txt" in the directory it's run from.

I've seen that Rails 3 is using Thor to power it's generators, seems like a really good solution and i'd like to use a similar approach in non-Rails ruby gem i'm working on. Tried looking at the Rails 3 source but it's a bit labyrinthine hence the question.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about thor