tags:

views:

362

answers:

4

I've grokked the code for all the aforementioned apps and I still can't find a straightforward way to create a static directory structure from a single command...

A: 

So what you want is to able to issue a command that will generate an entire directory tree?

cp -r <template> <destination>

Or am I misunderstanding? If you want to generate a consistent directory structure, your best bet is to simply copy it from a template. Fast, easy, done.

Derek Park
A: 

I thought of that but it seemed too easy; I guess I would store the template directory into the gem file structure?

jcapote
A: 

@jcapote

I thought of that but it seemed too easy; I guess I would store the template directory into the gem file structure?

I don't know for sure, but that would be my guess. Most packaging systems have the ability to pack up entire directory structures. I would assume Ruby's Gem system would support this as well. If so, then just packing up the template would be the way to go. If not, I'm thinking tar.

Hard-coding a directory structure in the code would be a nightmare, though I suppose you could write a tool that would walk a directory tree and generate a list of commands to recreate the tree, which could then be embedded in the code. Seems overkill for what effectively amounts to a cp.

Derek Park
+4  A: 

Check out rubigen. You can also view a presentation by dr nic.

guitsaru
Exactly what I needed, thanks.
jcapote