Permalink
Browse files

Merge remote branch 'mainstream/master'

  • Loading branch information...
2 parents 27fa38c + 16c0d1d commit fdcf4d6c5191b25ee3b6c357dafaf17156eb09d3 @lifo lifo committed Feb 1, 2010
Showing with 763 additions and 562 deletions.
  1. +10 −11 Gemfile
  2. +0 −1 Rakefile
  3. +5 −5 actionmailer/lib/action_mailer/base.rb
  4. +5 −9 actionmailer/lib/action_mailer/delivery_methods.rb
  5. +1 −1 actionmailer/lib/action_mailer/deprecated_api.rb
  6. +2 −8 actionmailer/test/abstract_unit.rb
  7. +12 −16 actionmailer/test/base_test.rb
  8. +4 −2 actionmailer/test/delivery_methods_test.rb
  9. +6 −4 actionpack/lib/abstract_controller/helpers.rb
  10. +6 −2 actionpack/lib/abstract_controller/layouts.rb
  11. +11 −7 actionpack/lib/abstract_controller/rendering.rb
  12. +7 −2 actionpack/lib/action_controller/metal.rb
  13. +22 −6 actionpack/lib/action_controller/metal/compatibility.rb
  14. +3 −1 actionpack/lib/action_controller/metal/helpers.rb
  15. +6 −3 actionpack/lib/action_controller/metal/hide_actions.rb
  16. +12 −9 actionpack/lib/action_controller/metal/mime_responds.rb
  17. +7 −3 actionpack/lib/action_controller/metal/renderers.rb
  18. +4 −2 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  19. +1 −1 actionpack/lib/action_controller/metal/testing.rb
  20. +4 −3 actionpack/lib/action_controller/metal/url_for.rb
  21. +1 −2 actionpack/lib/action_view.rb
  22. +3 −2 actionpack/lib/action_view/base.rb
  23. +0 −49 actionpack/lib/action_view/erb/util.rb
  24. +5 −6 actionpack/lib/action_view/helpers/active_model_helper.rb
  25. +3 −3 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  26. +1 −1 actionpack/lib/action_view/helpers/capture_helper.rb
  27. +7 −7 actionpack/lib/action_view/helpers/date_helper.rb
  28. +2 −2 actionpack/lib/action_view/helpers/debug_helper.rb
  29. +31 −2 actionpack/lib/action_view/helpers/form_helper.rb
  30. +1 −1 actionpack/lib/action_view/helpers/form_options_helper.rb
  31. +25 −11 actionpack/lib/action_view/helpers/form_tag_helper.rb
  32. +1 −1 actionpack/lib/action_view/helpers/number_helper.rb
  33. +1 −1 actionpack/lib/action_view/helpers/prototype_helper.rb
  34. +1 −1 actionpack/lib/action_view/helpers/raw_output_helper.rb
  35. +2 −10 actionpack/lib/action_view/helpers/sanitize_helper.rb
  36. +4 −5 actionpack/lib/action_view/helpers/tag_helper.rb
  37. +5 −5 actionpack/lib/action_view/helpers/text_helper.rb
  38. +1 −1 actionpack/lib/action_view/helpers/translation_helper.rb
  39. +37 −30 actionpack/lib/action_view/helpers/url_helper.rb
  40. +1 −1 actionpack/lib/action_view/render/partials.rb
  41. +0 −27 actionpack/lib/action_view/safe_buffer.rb
  42. +2 −2 actionpack/lib/action_view/template/handler.rb
  43. +6 −2 actionpack/lib/action_view/template/handlers/erb.rb
  44. +3 −3 actionpack/lib/action_view/template/resolver.rb
  45. +3 −1 actionpack/lib/action_view/test_case.rb
  46. +9 −9 actionpack/test/abstract/layouts_test.rb
  47. +1 −10 actionpack/test/abstract_unit.rb
  48. +2 −2 actionpack/test/controller/caching_test.rb
  49. +3 −3 actionpack/test/controller/filters_test.rb
  50. +14 −14 actionpack/test/controller/new_base/render_action_test.rb
  51. +10 −10 actionpack/test/controller/new_base/render_layout_test.rb
  52. +2 −2 actionpack/test/controller/new_base/render_partial_test.rb
  53. +34 −22 actionpack/test/controller/new_base/render_template_test.rb
  54. +1 −1 actionpack/test/controller/output_escaping_test.rb
  55. +2 −2 actionpack/test/controller/subscriber_test.rb
  56. +2 −2 actionpack/test/controller/view_paths_test.rb
  57. +2 −2 actionpack/test/dispatch/mime_type_test.rb
  58. +1 −1 actionpack/test/template/erb_util_test.rb
  59. +20 −1 actionpack/test/template/form_helper_test.rb
  60. +9 −3 actionpack/test/template/form_tag_helper_test.rb
  61. +2 −2 actionpack/test/template/html-scanner/sanitizer_test.rb
  62. +2 −2 actionpack/test/template/subscriber_test.rb
  63. +1 −1 actionpack/test/template/test_case_test.rb
  64. +7 −0 actionpack/test/template/url_helper_test.rb
  65. +1 −7 activemodel/test/cases/helper.rb
  66. +1 −1 activerecord/activerecord.gemspec
  67. +6 −3 activerecord/lib/active_record/observer.rb
  68. +1 −8 activerecord/test/cases/helper.rb
  69. +1 −7 activeresource/test/abstract_unit.rb
  70. +2 −0 activesupport/CHANGELOG
  71. +1 −0 activesupport/lib/active_support.rb
  72. +36 −0 activesupport/lib/active_support/core_ext/class/attribute.rb
  73. +85 −21 activesupport/lib/active_support/core_ext/string/output_safety.rb
  74. +4 −4 activesupport/lib/active_support/rescuable.rb
  75. +1 −9 activesupport/test/abstract_unit.rb
  76. +4 −4 activesupport/test/callbacks_test.rb
  77. +47 −0 activesupport/test/core_ext/class/attribute_test.rb
  78. +34 −33 activesupport/test/core_ext/string_ext_test.rb
  79. +2 −0 activesupport/test/fixtures/custom.rb
  80. +0 −2 activesupport/test/fixtures/omgomg.rb
  81. +6 −6 activesupport/test/isolation_test.rb
  82. +11 −11 activesupport/test/multibyte_chars_test.rb
  83. +3 −3 activesupport/test/notifications_test.rb
  84. +4 −4 {actionpack/test/template → activesupport/test}/safe_buffer_test.rb
  85. +7 −8 ci/ci_build.rb
  86. +0 −8 ci/geminstaller.yml
  87. +21 −0 load_paths.rb
  88. +1 −0 rails.gemspec
  89. +1 −4 railties/Rakefile
  90. +7 −1 railties/builtin/rails_info/rails/info_controller.rb
  91. +1 −1 railties/guides/source/rails_application_templates.textile
  92. +12 −0 railties/lib/generators/rails/app/app_generator.rb
  93. +10 −0 railties/lib/generators/rails/app/templates/Gemfile
  94. +14 −11 railties/lib/generators/rails/app/templates/config/boot.rb
  95. +4 −2 railties/lib/rails/application/configuration.rb
  96. +4 −3 railties/lib/rails/configuration.rb
  97. +1 −0 railties/lib/rails/generators.rb
  98. +4 −3 railties/lib/rails/generators/test_case.rb
  99. +2 −10 railties/test/abstract_unit.rb
  100. +1 −1 railties/test/application/configuration_test.rb
  101. +12 −1 railties/test/application/generators_test.rb
  102. +1 −1 railties/test/application/middleware_test.rb
  103. +1 −1 railties/test/initializable_test.rb
  104. +7 −19 railties/test/isolation/abstract_unit.rb
  105. +4 −4 railties/test/rails_info_controller_test.rb
View
21 Gemfile
@@ -1,17 +1,20 @@
-gem "rake", ">= 0.8.7"
+path File.expand_path('..', __FILE__)
+source :gemcutter
+
+gem "rails", "3.0.pre"
+
+gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
-gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9'
-gem "rails", "3.0.pre", :path => "railties"
-%w(activesupport activemodel actionpack actionmailer activerecord activeresource).each do |lib|
- gem lib, '3.0.pre', :path => lib
+if RUBY_VERSION < '1.9'
+ gem "ruby-debug", ">= 0.10.3"
end
# AR
-gem "arel", "0.2.pre", :git => "git://github.com/rails/arel.git"
+gem "arel", ">= 0.2.0"
gem "sqlite3-ruby", ">= 1.2.5"
-only :test do
+group :test do
gem "pg", ">= 0.8.0"
gem "mysql", ">= 2.8.1"
end
@@ -21,8 +24,6 @@ gem "rack-test", "0.5.3"
gem "RedCloth", ">= 4.2.2"
if ENV['CI']
- disable_system_gems
-
gem "nokogiri", ">= 1.4.0"
gem "memcache-client", ">= 1.7.6"
@@ -34,5 +35,3 @@ if ENV['CI']
gem "test-unit", ">= 2.0.5"
end
end
-
-disable_system_gems
View
@@ -38,7 +38,6 @@ Rake::GemPackageTask.new(spec) do |pkg|
end
task :install => :gem do
- system %(cd arel && gem build arel.gemspec && gem install arel-0.2.pre.gem --no-ri --no-rdoc --ignore-dependencies)
system %(cd rack && rake gem VERSION=1.0.2.pre && gem install rack-1.0.2.pre.gem --no-ri --no-rdoc --ignore-dependencies)
(PROJECTS - ["railties"]).each do |project|
puts "INSTALLING #{project}"
@@ -268,13 +268,13 @@ class Base < AbstractController::Base
private_class_method :new #:nodoc:
- extlib_inheritable_accessor :default_params
+ class_attribute :default_params
self.default_params = {
:mime_version => "1.0",
:charset => "utf-8",
:content_type => "text/plain",
:parts_order => [ "text/plain", "text/enriched", "text/html" ]
- }
+ }.freeze
class << self
@@ -284,9 +284,9 @@ def mailer_name
attr_writer :mailer_name
alias :controller_path :mailer_name
- def default(value=nil)
- self.default_params.merge!(value) if value
- self.default_params
+ def default(value = nil)
+ self.default_params = default_params.merge(value).freeze if value
+ default_params
end
# Receives a raw email, parses it into an email object, decodes it,
@@ -7,8 +7,7 @@ module DeliveryMethods
extend ActiveSupport::Concern
included do
- extlib_inheritable_accessor :delivery_methods, :delivery_method,
- :instance_writer => false
+ class_attribute :delivery_methods, :delivery_method
# Do not make this inheritable, because we always want it to propagate
cattr_accessor :raise_delivery_errors
@@ -17,7 +16,7 @@ module DeliveryMethods
cattr_accessor :perform_deliveries
self.perform_deliveries = true
- self.delivery_methods = {}
+ self.delivery_methods = {}.freeze
self.delivery_method = :smtp
add_delivery_method :smtp, Mail::SMTP,
@@ -53,12 +52,9 @@ module ClassMethods
# :arguments => '-i -t'
#
def add_delivery_method(symbol, klass, default_options={})
- unless respond_to?(:"#{symbol}_settings")
- extlib_inheritable_accessor(:"#{symbol}_settings", :instance_writer => false)
- end
-
+ class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
- self.delivery_methods[symbol.to_sym] = klass
+ self.delivery_methods = delivery_methods.merge(symbol.to_sym => klass).freeze
end
def wrap_delivery_behavior(mail, method=nil) #:nodoc:
@@ -87,4 +83,4 @@ def wrap_delivery_behavior!(*args) #:nodoc:
self.class.wrap_delivery_behavior(message, *args)
end
end
-end
+end
@@ -47,7 +47,7 @@ def template_root
end
def template_root=(root)
- ActiveSupport::Deprecation.warn "template_root= is deprecated, use view_paths.unshift instead", caller[0,2]
+ ActiveSupport::Deprecation.warn "template_root= is deprecated, use prepend_view_path instead", caller[0,2]
self.view_paths = ActionView::Base.process_view_paths(root)
end
@@ -1,14 +1,8 @@
-begin
- require File.expand_path('../../../vendor/gems/environment', __FILE__)
-rescue LoadError
-end
-
-lib = File.expand_path('../../lib', __FILE__)
-$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
+require File.expand_path('../../../load_paths', __FILE__)
-require 'rubygems'
require 'test/unit'
require 'action_mailer'
+require 'action_mailer/test_case'
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true
@@ -81,8 +81,8 @@ def custom_block(include_html=false)
def different_template(template_name='')
mail do |format|
- format.text { render :template => template_name }
- format.html { render :template => template_name }
+ format.text { render :template => "#{mailer_name}/#{template_name}" }
+ format.html { render :template => "#{mailer_name}/#{template_name}" }
end
end
@@ -254,7 +254,7 @@ def different_layout(layout_name='')
end
test "subject gets default from I18n" do
- BaseMailer.default[:subject] = nil
+ BaseMailer.default :subject => nil
email = BaseMailer.welcome(:subject => nil)
assert_equal "Welcome", email.subject
@@ -331,22 +331,24 @@ def different_layout(layout_name='')
end
test "implicit multipart with several view paths uses the first one with template" do
+ old = BaseMailer.view_paths
begin
- BaseMailer.view_paths.unshift(File.join(FIXTURE_LOAD_PATH, "another.path"))
+ BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "another.path")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome from another path", email.body.encoded)
ensure
- BaseMailer.view_paths.shift
+ BaseMailer.view_paths = old
end
end
test "implicit multipart with inexistent templates uses the next view path" do
+ old = BaseMailer.view_paths
begin
- BaseMailer.view_paths.unshift(File.join(FIXTURE_LOAD_PATH, "unknown"))
+ BaseMailer.view_paths = [File.join(FIXTURE_LOAD_PATH, "unknown")] + old.dup
email = BaseMailer.welcome
assert_equal("Welcome", email.body.encoded)
ensure
- BaseMailer.view_paths.shift
+ BaseMailer.view_paths = old
end
end
@@ -503,16 +505,10 @@ def swap(klass, new_values)
end
def with_default(klass, new_values)
- hash = klass.default
- old_values = {}
- new_values.each do |key, value|
- old_values[key] = hash[key]
- hash[key] = value
- end
+ old = klass.default_params
+ klass.default(new_values)
yield
ensure
- old_values.each do |key, value|
- hash[key] = value
- end
+ klass.default_params = old
end
end
@@ -45,7 +45,9 @@ def setup
def teardown
ActionMailer::Base.delivery_method = @old_delivery_method
- ActionMailer::Base.delivery_methods.delete(:custom)
+ new = ActionMailer::Base.delivery_methods.dup
+ new.delete(:custom)
+ ActionMailer::Base.delivery_methods = new
end
test "allow to add custom delivery method" do
@@ -167,4 +169,4 @@ def teardown
assert_equal(0, DeliveryMailer.deliveries.length)
end
-end
+end
@@ -1,4 +1,6 @@
require 'active_support/dependencies'
+require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/delegation'
module AbstractController
module Helpers
@@ -12,10 +14,10 @@ def self.next_serial
end
included do
- extlib_inheritable_accessor(:_helpers) { Module.new }
- extlib_inheritable_accessor(:_helper_serial) do
- AbstractController::Helpers.next_serial
- end
+ class_attribute :_helpers, :_helper_serial
+ delegate :_helpers, :to => :'self.class'
+ self._helpers = Module.new
+ self._helper_serial = ::AbstractController::Helpers.next_serial
end
module ClassMethods
@@ -1,3 +1,6 @@
+require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/delegation'
+
module AbstractController
# Layouts reverse the common pattern of including shared headers and footers in many templates to isolate changes in
# repeated setups. The inclusion pattern has pages that look like this:
@@ -161,8 +164,9 @@ module Layouts
include Rendering
included do
- extlib_inheritable_accessor(:_layout_conditions) { Hash.new }
- extlib_inheritable_accessor(:_action_has_layout) { Hash.new }
+ class_attribute :_layout_conditions
+ delegate :_layout_conditions, :to => :'self.class'
+ self._layout_conditions = {}
_write_layout_method
end
@@ -1,4 +1,7 @@
require "abstract_controller/base"
+require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/array/wrap'
module AbstractController
class DoubleRenderError < Error
@@ -13,8 +16,9 @@ module Rendering
extend ActiveSupport::Concern
included do
- extlib_inheritable_accessor :_view_paths
- self._view_paths ||= ActionView::PathSet.new
+ class_attribute :_view_paths
+ delegate :_view_paths, :to => :'self.class'
+ self._view_paths = ActionView::PathSet.new
end
# An instance of a view class. The default view class is ActionView::Base
@@ -156,7 +160,6 @@ def _determine_template(options)
elsif options.key?(:file)
options[:_template_name] = options[:file]
end
-
name = (options[:_template_name] || options[:action] || action_name).to_s
options[:_prefix] ||= _prefix if (options.keys & [:partial, :file, :template]).empty?
@@ -201,7 +204,7 @@ def clear_template_caches!
# the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
def append_view_path(path)
- self.view_paths << path
+ self.view_paths = view_paths.dup + Array.wrap(path)
end
# Prepend a path to the list of view paths for this controller.
@@ -212,12 +215,12 @@ def append_view_path(path)
# (see ActionView::ViewPathSet for more information)
def prepend_view_path(path)
clear_template_caches!
- self.view_paths.unshift(path)
+ self.view_paths = Array.wrap(path) + view_paths.dup
end
# A list of all of the default view paths for this controller.
def view_paths
- self._view_paths
+ _view_paths
end
# Set the view paths.
@@ -228,7 +231,8 @@ def view_paths
def view_paths=(paths)
clear_template_caches!
self._view_paths = paths.is_a?(ActionView::PathSet) ? paths : ActionView::Base.process_view_paths(paths)
+ _view_paths.freeze
end
end
end
-end
+end
@@ -1,4 +1,4 @@
-require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/class/attribute'
module ActionController
# ActionController::Metal provides a way to get a valid Rack application from a controller.
@@ -90,7 +90,12 @@ def call(env)
end
end
- extlib_inheritable_accessor(:middleware_stack) { ActionDispatch::MiddlewareStack.new }
+ class_attribute :middleware_stack
+ self.middleware_stack = ActionDispatch::MiddlewareStack.new
+
+ def self.inherited(base)
+ self.middleware_stack = base.middleware_stack.dup
+ end
def self.use(*args)
middleware_stack.use(*args)
Oops, something went wrong.

0 comments on commit fdcf4d6

Please sign in to comment.