From 6de83562f91028629bd24447aa521bc72ef8277a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 27 Feb 2009 14:22:39 +0100 Subject: Force all internal calls to Array#to_sentence to use English [#2010 state:resolved] --- railties/lib/rails/plugin/loader.rb | 2 +- railties/lib/tasks/testing.rake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index 7f85bb8966..f86589a689 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -178,7 +178,7 @@ module Rails if explicit_plugin_loading_order? if configuration.plugins.detect {|plugin| plugin != :all && !loaded?(plugin) } missing_plugins = configuration.plugins - (plugins.map{|p| p.name.to_sym} + [:all]) - raise LoadError, "Could not locate the following plugins: #{missing_plugins.to_sentence}" + raise LoadError, "Could not locate the following plugins: #{missing_plugins.to_sentence(:locale => :en)}" end end end diff --git a/railties/lib/tasks/testing.rake b/railties/lib/tasks/testing.rake index 4242458672..fd5e52a05b 100644 --- a/railties/lib/tasks/testing.rake +++ b/railties/lib/tasks/testing.rake @@ -48,7 +48,7 @@ task :test do task end end.compact - abort "Errors running #{errors.to_sentence}!" if errors.any? + abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any? end namespace :test do -- cgit v1.2.3 From 319106d09c0ec2daf8b5345f525f1c97b6368ce2 Mon Sep 17 00:00:00 2001 From: Matthew Rudy Jacobs Date: Sun, 22 Feb 2009 19:23:04 +0000 Subject: Metal can now line in plugins under app/metal [#2045 state:committed] Signed-off-by: David Heinemeier Hansson --- railties/CHANGELOG | 7 +++++++ railties/lib/initializer.rb | 2 ++ railties/lib/rails/plugin.rb | 8 ++++++-- railties/lib/rails/plugin/loader.rb | 5 ++++- railties/lib/rails/rack/metal.rb | 15 +++++++++------ .../plugins/engines/engine/app/metal/engine_metal.rb | 10 ++++++++++ railties/test/plugin_loader_test.rb | 4 ++-- 7 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 railties/test/fixtures/plugins/engines/engine/app/metal/engine_metal.rb (limited to 'railties') diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 38c6f808e6..a0d752b263 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,12 @@ +*Edge* + +* Allow metal to live in plugins #2045 [Matthew Rudy] + + *2.3.0 [RC1] (February 1st, 2009)* +* Added metal [Josh Peek] + * Remove script/performance/request in favour of the performance integration tests. [Pratik Naik] To continue using script/performance/request, install the request_profiler plugin : diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 09affe9e36..24ce3e75ff 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -559,6 +559,8 @@ Run `rake gems:install` to install the missing gems. end def initialize_metal + Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths + configuration.middleware.insert_before( :"ActionController::RewindableInput", Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?) diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 4901abe808..80deb73bbb 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -80,6 +80,10 @@ module Rails File.join(directory, 'app', 'controllers') end + def metal_path + File.join(directory, 'app', 'metal') + end + def routing_file File.join(directory, 'config', 'routes.rb') end @@ -100,7 +104,7 @@ module Rails def app_paths - [ File.join(directory, 'app', 'models'), File.join(directory, 'app', 'helpers'), controller_path ] + [ File.join(directory, 'app', 'models'), File.join(directory, 'app', 'helpers'), controller_path, metal_path ] end def lib_path @@ -160,4 +164,4 @@ module Rails File.join(directory, 'rails', 'init.rb') end end -end \ No newline at end of file +end diff --git a/railties/lib/rails/plugin/loader.rb b/railties/lib/rails/plugin/loader.rb index f86589a689..66e01d70da 100644 --- a/railties/lib/rails/plugin/loader.rb +++ b/railties/lib/rails/plugin/loader.rb @@ -65,6 +65,9 @@ module Rails $LOAD_PATH.uniq! end + def engine_metal_paths + engines.collect(&:metal_path) + end protected def configure_engines @@ -185,4 +188,4 @@ module Rails end end -end \ No newline at end of file +end diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb index b185227234..8dac992ef2 100644 --- a/railties/lib/rails/rack/metal.rb +++ b/railties/lib/rails/rack/metal.rb @@ -6,14 +6,17 @@ module Rails NotFoundResponse = [404, {}, []].freeze NotFound = lambda { NotFoundResponse } + cattr_accessor :metal_paths + self.metal_paths = ["#{Rails.root}/app/metal"] + def self.metals - base = "#{Rails.root}/app/metal" - matcher = /\A#{Regexp.escape(base)}\/(.*)\.rb\Z/ + matcher = /#{Regexp.escape('/app/metal/')}(.*)\.rb\Z/ + metal_glob = metal_paths.map{ |base| "#{base}/**/*.rb" } - Dir["#{base}/**/*.rb"].sort.map do |file| - file.sub!(matcher, '\1') - require file - file.classify.constantize + Dir[*metal_glob].sort.map do |file| + path = file.match(matcher)[1] + require path + path.classify.constantize end end diff --git a/railties/test/fixtures/plugins/engines/engine/app/metal/engine_metal.rb b/railties/test/fixtures/plugins/engines/engine/app/metal/engine_metal.rb new file mode 100644 index 0000000000..d67a127ca7 --- /dev/null +++ b/railties/test/fixtures/plugins/engines/engine/app/metal/engine_metal.rb @@ -0,0 +1,10 @@ +class EngineMetal + def self.call(env) + if env["PATH_INFO"] =~ /^\/metal/ + [200, {"Content-Type" => "text/html"}, ["Engine metal"]] + else + [404, {"Content-Type" => "text/html"}, ["Not Found"]] + end + end +end + diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb index e802b1ace7..b270748dd6 100644 --- a/railties/test/plugin_loader_test.rb +++ b/railties/test/plugin_loader_test.rb @@ -120,7 +120,7 @@ class TestPluginLoader < Test::Unit::TestCase @loader.add_plugin_load_paths - %w( models controllers helpers ).each do |app_part| + %w( models controllers metal helpers ).each do |app_part| assert ActiveSupport::Dependencies.load_paths.include?( File.join(plugin_fixture_path('engines/engine'), 'app', app_part) ), "Couldn't find #{app_part} in load path" @@ -161,4 +161,4 @@ class TestPluginLoader < Test::Unit::TestCase $LOAD_PATH.clear ORIGINAL_LOAD_PATH.each { |path| $LOAD_PATH << path } end -end \ No newline at end of file +end -- cgit v1.2.3 From 77b0994c7835610982d708ce7ce5cd95e6e99e5a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 27 Feb 2009 14:46:23 +0100 Subject: Prep for RC2 later today --- railties/CHANGELOG | 2 +- railties/Rakefile | 10 +++++----- railties/lib/rails/version.rb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'railties') diff --git a/railties/CHANGELOG b/railties/CHANGELOG index a0d752b263..962869f9e1 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,4 +1,4 @@ -*Edge* +*2.3.1 [RC2] (February 27th, 2009)* * Allow metal to live in plugins #2045 [Matthew Rudy] diff --git a/railties/Rakefile b/railties/Rakefile index 05f767dc3b..62dc62502f 100644 --- a/railties/Rakefile +++ b/railties/Rakefile @@ -310,11 +310,11 @@ spec = Gem::Specification.new do |s| EOF s.add_dependency('rake', '>= 0.8.3') - s.add_dependency('activesupport', '= 2.3.0' + PKG_BUILD) - s.add_dependency('activerecord', '= 2.3.0' + PKG_BUILD) - s.add_dependency('actionpack', '= 2.3.0' + PKG_BUILD) - s.add_dependency('actionmailer', '= 2.3.0' + PKG_BUILD) - s.add_dependency('activeresource', '= 2.3.0' + PKG_BUILD) + s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD) + s.add_dependency('activerecord', '= 2.3.1' + PKG_BUILD) + s.add_dependency('actionpack', '= 2.3.1' + PKG_BUILD) + s.add_dependency('actionmailer', '= 2.3.1' + PKG_BUILD) + s.add_dependency('activeresource', '= 2.3.1' + PKG_BUILD) s.rdoc_options << '--exclude' << '.' s.has_rdoc = false diff --git a/railties/lib/rails/version.rb b/railties/lib/rails/version.rb index 9bb4b2a96d..fd38705e75 100644 --- a/railties/lib/rails/version.rb +++ b/railties/lib/rails/version.rb @@ -2,7 +2,7 @@ module Rails module VERSION #:nodoc: MAJOR = 2 MINOR = 3 - TINY = 0 + TINY = 1 STRING = [MAJOR, MINOR, TINY].join('.') end -- cgit v1.2.3