From e9f16256ba11544823096000d7f78c93755c787d Mon Sep 17 00:00:00 2001 From: Raghunadh Date: Sat, 23 Jul 2011 14:37:25 +0530 Subject: Improve rails:template undefined LOCATION variable error message fixed --- railties/lib/rails/tasks/framework.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index 77a5c4dc6c..206ce39773 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -2,14 +2,14 @@ namespace :rails do desc "Update configs and some other initially generated files (or use just update:configs, update:scripts, or update:application_controller)" task :update => [ "update:configs", "update:scripts", "update:application_controller" ] - desc "Applies the template supplied by LOCATION=/path/to/template" + desc "Applies the template supplied by LOCATION=(/path/to/template) or URL" task :template do template = ENV["LOCATION"] + raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank? template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} - require 'rails/generators' require 'rails/generators/rails/app/app_generator' - generator = Rails::Generators::AppGenerator.new [ Rails.root ], {}, :destination_root => Rails.root + generator = Rails::Generators::AppGenerator.new [Rails.root], {}, :destination_root => Rails.root generator.apply template, :verbose => false end -- cgit v1.2.3