carbonfive/raygun — pull request #29 by jonah-carbonfive (2012-10-04 06:51:12+00:00)
Title: Custom generators

Since `app_generator.rb` extends `Rails::Generators::AppGenerator` it gives us a nice way to interrupt the normal Rails generator process and customize the application during its generation.

However some changes do not need to be applied during the creation of the app and instead might be better expressed as self-contained Rails templates. Normally one of these can be appended to the `rails new ...` process via `rails new my_app -m "path/to/template"`. Supporting only a single custom template is somewhat limiting so I added `raygun/generators/application_template.rb` which is applied when `app_generator.rb` finishes and then applies any other `*_tempalte.rb` files in `raygun/generators/`.

Hopefully that allows us to split customizations into two categories; those which we must include while generating the base application, and those which can be applied as templates after the fact. I think those templates will be better encapsulated and easier to turn into conditionals than items added to the `app_generator` customization sequence.