aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-07-05 13:21:01 +0200
committerYves Senn <yves.senn@gmail.com>2013-07-05 13:22:07 +0200
commit3196ceaba28be64d890e9544af218481ad54cf16 (patch)
tree1ccc787ac3e312f6ec37a687ac84052af3e30939 /guides/source
parente94be7b04cda949b2188a910257b984f98127a31 (diff)
downloadrails-3196ceaba28be64d890e9544af218481ad54cf16.tar.gz
rails-3196ceaba28be64d890e9544af218481ad54cf16.tar.bz2
rails-3196ceaba28be64d890e9544af218481ad54cf16.zip
explain how to extend application templates. [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/rails_application_templates.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md
index f8062a1f7c..0c70f379be 100644
--- a/guides/source/rails_application_templates.md
+++ b/guides/source/rails_application_templates.md
@@ -227,3 +227,22 @@ git :init
git add: "."
git commit: "-a -m 'Initial commit'"
```
+
+Advanced Usage
+--------------
+
+The application template is evaluated in the context of a
+`Rails::Generators::AppGenerator` instance. It uses the `apply` action
+provided by
+[Thor](https://github.com/erikhuda/thor/blob/master/lib/thor/actions.rb#L207).
+This means you can extend and change the instance to match your needs.
+
+For example by overwriting the `source_paths` method to contain the
+location of your template. Now methods like `copy_file` will accept
+relative paths to your template's location.
+
+```ruby
+def source_paths
+ [File.expand_path(File.dirname(__FILE__))]
+end
+```