aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/dependencies.rb5
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/Rakefile13
-rw-r--r--railties/lib/rails_generator/lookup.rb6
-rw-r--r--railties/test/dispatcher_test.rb7
-rw-r--r--railties/test/generators/working/working_generator.rb (renamed from railties/test/script/generators/working/working_generator.rb)0
-rw-r--r--railties/test/mocks/dispatcher.rb2
-rw-r--r--railties/test/rails_generator_test.rb4
8 files changed, 23 insertions, 16 deletions
diff --git a/actionpack/lib/action_controller/dependencies.rb b/actionpack/lib/action_controller/dependencies.rb
index 2960330afa..5132bccd62 100644
--- a/actionpack/lib/action_controller/dependencies.rb
+++ b/actionpack/lib/action_controller/dependencies.rb
@@ -2,7 +2,6 @@ module ActionController #:nodoc:
module Dependencies #:nodoc:
def self.append_features(base)
super
- base.class_eval { class << self; alias_method :inherited_without_model, :inherited; end }
base.extend(ClassMethods)
end
@@ -79,10 +78,6 @@ module ActionController #:nodoc:
end
end
end
-
- def inherited(child)
- inherited_without_model(child)
- end
end
end
end
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index cc0cabe9f0..864cc3e2cd 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*0.13.1* (11 July, 2005)
+* Look for app-specific generators in RAILS_ROOT/generators rather than the clunky old RAILS_ROOT/script/generators. Nobody really uses this feature except for the unit tests, so it's a negligible-impact change. If you want to work with third-party generators, drop them in ~/.rails/generators or simply install gems.
+
* Fixed that each request with the WEBrick adapter would open a new database connection #1685 [Sam Stephenson]
* Added support for SQL Server in the database rake tasks #1652 [ken.barker@gmail.com] Note: osql and scptxfr may need to be installed on your development environment. This involves getting the .exes and a .rll (scptxfr) from a production SQL Server (not developer level SQL Server). Add their location to your Environment PATH and you are all set.
diff --git a/railties/Rakefile b/railties/Rakefile
index 8492666f87..94cc85a23a 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -19,6 +19,16 @@ RUBY_FORGE_PROJECT = "rails"
RUBY_FORGE_USER = "webster132"
+desc "Default Task"
+task :default => :test
+
+Rake::TestTask.new do |t|
+ t.libs << 'test'
+ t.pattern = 'test/*_test.rb'
+ t.verbose = true
+end
+
+
BASE_DIRS = %w( app config/environments components db doc log lib public script test vendor )
APP_DIRS = %w( apis models controllers helpers views views/layouts )
PUBLIC_DIRS = %w( images javascripts stylesheets )
@@ -31,9 +41,6 @@ BIN_FILES = %w( generate destroy breakpointer console server update runner pr
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties )
-desc "Default Task"
-task :default => [ :fresh_rails ]
-
desc "Generates a fresh Rails package with documentation"
task :fresh_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
diff --git a/railties/lib/rails_generator/lookup.rb b/railties/lib/rails_generator/lookup.rb
index 538e0f55ea..47cf870bd6 100644
--- a/railties/lib/rails_generator/lookup.rb
+++ b/railties/lib/rails_generator/lookup.rb
@@ -4,7 +4,7 @@ class Object
class << self
# Lookup missing generators using const_missing. This allows any
# generator to reference another without having to know its location:
- # RubyGems, ~/.rails/generators, and RAILS_ROOT/script/generators.
+ # RubyGems, ~/.rails/generators, and RAILS_ROOT/generators.
def lookup_missing_generator(class_id)
if md = /(.+)Generator$/.match(class_id.to_s)
name = md.captures.first.demodulize.underscore
@@ -92,13 +92,13 @@ module Rails
# Use component generators (model, controller, etc).
# 1. Rails application. If RAILS_ROOT is defined we know we're
# generating in the context of a Rails application, so search
- # RAILS_ROOT/script/generators.
+ # RAILS_ROOT/generators.
# 2. User home directory. Search ~/.rails/generators.
# 3. RubyGems. Search for gems named *_generator.
# 4. Builtins. Model, controller, mailer, scaffold.
def use_component_sources!
reset_sources
- sources << PathSource.new(:app, "#{::RAILS_ROOT}/script/generators") if defined? ::RAILS_ROOT
+ sources << PathSource.new(:app, "#{::RAILS_ROOT}/generators") if defined? ::RAILS_ROOT
sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators")
sources << GemSource.new if Object.const_defined?(:Gem)
sources << PathSource.new(:builtin, "#{File.dirname(__FILE__)}/generators/components")
diff --git a/railties/test/dispatcher_test.rb b/railties/test/dispatcher_test.rb
index ba41b93b24..caf36fc9e9 100644
--- a/railties/test/dispatcher_test.rb
+++ b/railties/test/dispatcher_test.rb
@@ -35,7 +35,7 @@ class DispatcherTest < Test::Unit::TestCase
def test_ac_subclasses_cleared_on_reset
Object.class_eval(ACTION_CONTROLLER_DEF)
assert_equal 1, ActionController::Base.subclasses.length
- Dispatcher.dispatch(CGI.new, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, @output)
+ dispatch
GC.start # force the subclass to be collected
assert_equal 0, ActionController::Base.subclasses.length
@@ -44,13 +44,16 @@ class DispatcherTest < Test::Unit::TestCase
def test_am_subclasses_cleared_on_reset
Object.class_eval(ACTION_MAILER_DEF)
assert_equal 1, ActionMailer::Base.subclasses.length
- Dispatcher.dispatch(CGI.new, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, @output)
+ dispatch
GC.start # force the subclass to be collected
assert_equal 0, ActionMailer::Base.subclasses.length
end
private
+ def dispatch
+ Dispatcher.dispatch(CGI.new, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, @output)
+ end
def setup_minimal_environment
value = Dependencies::LoadingModule.root
diff --git a/railties/test/script/generators/working/working_generator.rb b/railties/test/generators/working/working_generator.rb
index 465b34319a..465b34319a 100644
--- a/railties/test/script/generators/working/working_generator.rb
+++ b/railties/test/generators/working/working_generator.rb
diff --git a/railties/test/mocks/dispatcher.rb b/railties/test/mocks/dispatcher.rb
index 6561a13581..3391f398bf 100644
--- a/railties/test/mocks/dispatcher.rb
+++ b/railties/test/mocks/dispatcher.rb
@@ -4,7 +4,7 @@ class Dispatcher
attr_accessor :raise_exception
attr_accessor :dispatch_hook
- def dispatch(cgi)
+ def dispatch(cgi, session_options = nil, output = $stdout)
dispatch_hook.call(cgi) if dispatch_hook
sleep(time_to_sleep || 0)
raise raise_exception, "Something died" if raise_exception
diff --git a/railties/test/rails_generator_test.rb b/railties/test/rails_generator_test.rb
index 5934bb3e7b..3f63509384 100644
--- a/railties/test/rails_generator_test.rb
+++ b/railties/test/rails_generator_test.rb
@@ -44,7 +44,7 @@ class RailsGeneratorTest < Test::Unit::TestCase
end
def test_lookup_missing_generator
- assert_raise(LoadError) {
+ assert_raise(MissingSourceFile) {
Rails::Generator::Base.lookup('missing_generator').klass
}
end
@@ -68,7 +68,7 @@ class RailsGeneratorTest < Test::Unit::TestCase
def test_generator_spec
spec = Rails::Generator::Base.lookup('working')
assert_equal 'working', spec.name
- assert_equal "#{RAILS_ROOT}/script/generators/working", spec.path
+ assert_equal "#{RAILS_ROOT}/generators/working", spec.path
assert_equal :app, spec.source
assert_nothing_raised { assert_match /WorkingGenerator$/, spec.klass.name }
end