From 7a99dc0ac2f36694b1cc11418129b8c39bb9044d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 20 Apr 2009 11:01:32 -0500 Subject: Update rails:template task to expand file paths [#2528 state:resolved] Signed-off-by: Pratik Naik --- railties/lib/tasks/framework.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'railties/lib') diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 191c9361ff..b6f2f2bc18 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -83,7 +83,9 @@ namespace :rails do 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"]) + template = ENV["LOCATION"] + template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} + Rails::TemplateRunner.new(template) end namespace :update do -- cgit v1.2.3 From ab321268f86d9013cbd4ecd0b5f46e7b05ec55a9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 16:10:49 -0700 Subject: No more free lunch --- railties/lib/rails/plugin.rb | 10 ++++++---- railties/lib/rails/rack/metal.rb | 1 + railties/lib/rails_generator.rb | 14 ++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'railties/lib') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 80deb73bbb..e66166306a 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/kernel/reporting' + module Rails # The Plugin class should be an object which provides the following methods: # @@ -35,10 +37,10 @@ module Rails def load_paths report_nonexistant_or_empty_plugin! unless valid? - returning [] do |load_paths| - load_paths << lib_path if has_lib_directory? - load_paths << app_paths if has_app_directory? - end.flatten + load_paths = [] + load_paths << lib_path if has_lib_directory? + load_paths << app_paths if has_app_directory? + load_paths.flatten end # Evaluates a plugin's init.rb file. diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index adc43da864..7a616c7911 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -1,4 +1,5 @@ require 'active_support/ordered_hash' +require 'active_support/core_ext/class/attribute_accessors' module Rails module Rack diff --git a/railties/lib/rails_generator.rb b/railties/lib/rails_generator.rb index 9f0ffc1562..201a9e0f91 100644 --- a/railties/lib/rails_generator.rb +++ b/railties/lib/rails_generator.rb @@ -21,16 +21,18 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -$:.unshift(File.dirname(__FILE__)) -$:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib") - begin - require 'active_support' + require 'active_support' rescue LoadError - require 'rubygems' - gem 'activesupport' + activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" + if File.directory?(activesupport_path) + $:.unshift activesupport_path + require 'active_support' + end end +require 'active_support/core/all' +$:.unshift(File.dirname(__FILE__)) require 'rails_generator/base' require 'rails_generator/lookup' require 'rails_generator/commands' -- cgit v1.2.3 From f5d720fb96f2e085acc4ed17f63272c4d38e567e Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 22 Apr 2009 16:41:06 -0700 Subject: Opt in to Dependencies --- railties/lib/rails/plugin.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'railties/lib') diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index e66166306a..dd840ef058 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/kernel/reporting' +require 'active_support/dependencies' module Rails # The Plugin class should be an object which provides the following methods: -- cgit v1.2.3