From 88a3343ed57c01ca358da8473d15fc4d2b4a5bff Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 15 Feb 2005 01:24:55 +0000 Subject: Backed out of routing merge.. investigating missing patches git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@616 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/lib/rails_generator/base.rb | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'railties/lib/rails_generator/base.rb') diff --git a/railties/lib/rails_generator/base.rb b/railties/lib/rails_generator/base.rb index 92a54e2453..065ce63966 100644 --- a/railties/lib/rails_generator/base.rb +++ b/railties/lib/rails_generator/base.rb @@ -1,5 +1,5 @@ -require File.dirname(__FILE__) + '/support/class_attribute_accessors' -require File.dirname(__FILE__) + '/support/inflector' +require File.dirname(__FILE__) + '/../support/class_attribute_accessors' +require File.dirname(__FILE__) + '/../support/inflector' require File.dirname(__FILE__) + '/options' require File.dirname(__FILE__) + '/manifest' require File.dirname(__FILE__) + '/spec' @@ -69,8 +69,8 @@ module Rails @source_root = options[:source] || File.join(spec.path, 'templates') if options[:destination] @destination_root = options[:destination] - elsif defined? ::RAILS_ROOT - @destination_root = ::RAILS_ROOT + elsif Object.const_defined?(:RAILS_ROOT) + @destination_root = Object.const_get(:RAILS_ROOT) end # Silence the logger if requested. @@ -173,20 +173,11 @@ module Rails def assign_names!(name) @name = name base_name, @class_path, @class_nesting = extract_modules(@name) - @class_name_without_nesting, @singular_name, @plural_name = inflect_names(base_name) - if @class_nesting.empty? - @class_name = @class_name_without_nesting - else - @class_name = "#{@class_nesting}::#{@class_name_without_nesting}" - end + @class_name, @singular_name, @plural_name = inflect_names(base_name) end - # Extract modules from filesystem-style or ruby-style path: - # good/fun/stuff - # Good::Fun::Stuff - # produce the same results. def extract_modules(name) - modules = name.include?('/') ? name.split('/') : name.split('::') + modules = name.split('/') name = modules.pop path = modules.map { |m| m.underscore } nesting = modules.map { |m| m.camelize }.join('::') -- cgit v1.2.3