aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb2
-rw-r--r--railties/lib/rails_generator/generators/applications/app/template_runner.rb4
-rw-r--r--railties/lib/tasks/framework.rake6
3 files changed, 9 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}"
diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake
index d639214ffe..191c9361ff 100644
--- a/railties/lib/tasks/framework.rake
+++ b/railties/lib/tasks/framework.rake
@@ -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'
+ Rails::TemplateRunner.new(ENV["LOCATION"])
+ end
+
namespace :update do
desc "Add new scripts to the application script/ directory"
task :scripts do