public
Description: Rake extension for generating and updating projects from templates
Homepage:
Clone URL: git://github.com/automatthew/rakegen.git
rakegen / README
100644 19 lines (13 sloc) 1.068 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
= Rakegen
 
Rakegen is a Rake extension for generating and updating projects from templates. Give Rakegen a source and a target, and it creates a rake task that will make the necessary directories and copy the template files to the target. Rakegen processes .erb files by default, but you can register a template processing lambda for any file extension. Because Rakegen is Rake-based, you can add your own dependencies and actions to any target file.
 
== Usage
 
  generator = Rakegen.new("generate:app") do |gen|
    gen.source = "templates/application"
    gen.target = "/Users/matthew/dev/waves/thingy"
    gen.excludes << "**/*.yaml"
    gen.template_assigns = {:application_name => "thingy"}
    gen.executables = %w{ bin/waves-console bin/waves-server }
  end
  
This will define a task named, naturally enough, "generate:app". If you define the generator in a rakefile, you can run it with <tt>rake generate:app</tt>. If you're building your own executable, you can call it from Ruby:
 
  generator.invoke
 
Rakegen asks you before clobbering existing files.