Extend lookup path of Rails Application Template
Before Rails 4 one could inherit from the rails AppBuilder class in order to create a custom AppBuilder (e.g, that is how suspenders. This would give one more flexibility in customizing the generation of new rails applications than just using an applicaiton template.
In Rails 4, the AppBuilder has been removed, and the Application Template remains as the only option. You can still customize it in a similar way you could with AppBuilder though.
The Application Template runs in the context of Rails::Generators::AppGenerator
, so though it might not look as pretty, you can override mehtods of the AppGenerator class.
As an example, if you want the application template to look for files in the same directory, you can override the source_paths method from inside the application template:
def source_paths
[File.expand_path(File.dirname(__FILE__))]
end
Now when you use stuff like copy_file
in the template, the path will be relative to the current directory.