diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-12-07 03:40:23 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-07 03:40:23 +0100 |
commit | f7f113610e7cdca8ef03e206f2cbeb8400cdfefa (patch) | |
tree | 8d8a75ebb9e096b15dc759ff6e94856f70854203 /railties/lib/rails_generator | |
parent | 2dc5d12c91d0c717f7bac6b544193e810ce4917a (diff) | |
download | rails-f7f113610e7cdca8ef03e206f2cbeb8400cdfefa.tar.gz rails-f7f113610e7cdca8ef03e206f2cbeb8400cdfefa.tar.bz2 rails-f7f113610e7cdca8ef03e206f2cbeb8400cdfefa.zip |
Add a rake task to apply a template to an existing application.
Example : rake rails:template LOCATION=~/template.rb
Diffstat (limited to 'railties/lib/rails_generator')
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/template_runner.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb index 4a191578cf..795a0d7653 100644 --- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb +++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb @@ -40,7 +40,7 @@ class AppGenerator < Rails::Generator::Base def after_generate if options[:template] - Rails::TemplateRunner.new(@destination_root, options[:template]) + Rails::TemplateRunner.new(options[:template], @destination_root) end end diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index 6c7c9deea3..00079daffd 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -9,8 +9,8 @@ module Rails class TemplateRunner attr_reader :root - def initialize(root, template) # :nodoc: - @root = Dir.pwd + "/" + root + def initialize(template, root = '') # :nodoc: + @root = File.join(Dir.pwd, root) puts "applying template: #{template}" |