Browse files

Add a rake task to apply a template to an existing application.

Example : rake rails:template LOCATION=~/template.rb
  • Loading branch information...
lifo committed Dec 7, 2008
1 parent 2dc5d12 commit f7f113610e7cdca8ef03e206f2cbeb8400cdfefa
@@ -1,5 +1,7 @@
*2.3.0 [Edge]*
* Add a rake task to apply a template to an existing application : rake rails:template LOCATION=~/template.rb [Pratik]
* Add "-m/--template" option to Rails generator to apply a template to the generated application. [Jeremy McAnally]
This has been extracted from rg -
@@ -40,7 +40,7 @@ def manifest
def after_generate
if options[:template], options[:template])[:template], @destination_root)
@@ -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}"
@@ -80,6 +80,12 @@ namespace :rails do
desc "Update both configs, scripts and public/javascripts from Rails"
task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:application_controller" ]
desc "Applies the template supplied by LOCATION=/path/to/template"
task :template do
require 'rails_generator/generators/applications/app/template_runner'["LOCATION"])
namespace :update do
desc "Add new scripts to the application script/ directory"
task :scripts do

0 comments on commit f7f1136

Please sign in to comment.