Permalink
Browse files

Merge branch 'master' into bodyparts

  • Loading branch information...
jeremy committed Mar 18, 2009
2 parents 70e3dfb + dc88847 commit 6335f5d5186dfb97453dfa1a55aabe4c6f3962b0
Showing with 2,238 additions and 1,203 deletions.
  1. +1 −4 actionmailer/CHANGELOG
  2. +1 −1 actionmailer/Rakefile
  3. +1 −1 actionmailer/lib/action_mailer/version.rb
  4. +1 −4 actionpack/CHANGELOG
  5. +1 −1 actionpack/Rakefile
  6. +1 −1 actionpack/lib/action_controller/integration.rb
  7. +6 −10 actionpack/lib/action_controller/resources.rb
  8. +2 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack.rb
  9. +49 −0 actionpack/lib/action_controller/vendor/rack-1.0/rack/chunked.rb
  10. +1 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb
  11. +4 −0 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/cgi.rb
  12. +3 −0 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/fastcgi.rb
  13. +4 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/lsws.rb
  14. +3 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb
  15. +3 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/scgi.rb
  16. +3 −0 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/thin.rb
  17. +2 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb
  18. +19 −35 actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb
  19. +5 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb
  20. +1 −1 actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb
  21. +1 −1 actionpack/lib/action_pack/version.rb
  22. +2 −2 actionpack/lib/action_view/helpers/date_helper.rb
  23. +1 −1 actionpack/lib/action_view/helpers/number_helper.rb
  24. +1 −1 actionpack/lib/action_view/paths.rb
  25. +1 −1 actionpack/lib/action_view/template.rb
  26. +3 −3 actionpack/test/controller/integration_test.rb
  27. +10 −0 actionpack/test/controller/render_test.rb
  28. +1 −1 actionpack/test/controller/request/multipart_params_parsing_test.rb
  29. +19 −1 actionpack/test/controller/resources_test.rb
  30. +14 −16 actionpack/test/controller/session/cookie_store_test.rb
  31. +1 −1 activemodel/lib/active_model/validations/inclusion.rb
  32. +1 −3 activerecord/CHANGELOG
  33. +1 −1 activerecord/Rakefile
  34. +9 −5 activerecord/lib/active_record/associations/association_collection.rb
  35. +2 −2 activerecord/lib/active_record/base.rb
  36. +23 −15 activerecord/lib/active_record/batches.rb
  37. +33 −22 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  38. +1 −1 activerecord/lib/active_record/validations.rb
  39. +1 −1 activerecord/lib/active_record/version.rb
  40. +25 −1 activerecord/test/cases/migration_test.rb
  41. +10 −5 activerecord/test/cases/transactions_test.rb
  42. +2 −7 activeresource/CHANGELOG
  43. +1 −1 activeresource/Rakefile
  44. +1 −1 activeresource/lib/active_resource/version.rb
  45. +1 −7 activesupport/CHANGELOG
  46. +1 −1 activesupport/lib/active_support/core_ext/date/calculations.rb
  47. +1 −1 activesupport/lib/active_support/version.rb
  48. +1 −4 railties/CHANGELOG
  49. +5 −5 railties/Rakefile
  50. +4 −0 railties/builtin/rails_info/rails/info.rb
  51. +1 −0 railties/environments/boot.rb
  52. +14 −2 railties/guides/files/stylesheets/main.css
  53. BIN railties/guides/images/error_messages.png
  54. BIN railties/guides/images/fxn.jpg
  55. BIN railties/guides/images/i18n/demo_localized_pirate.png
  56. BIN railties/guides/images/i18n/demo_translated_en.png
  57. BIN railties/guides/images/i18n/demo_translated_pirate.png
  58. BIN railties/guides/images/i18n/demo_translation_missing.png
  59. BIN railties/guides/images/i18n/demo_untranslated.png
  60. +19 −8 railties/guides/rails_guides.rb
  61. +5 −21 railties/guides/rails_guides/generator.rb
  62. +1 −1 railties/guides/rails_guides/indexer.rb
  63. +80 −35 railties/guides/source/2_3_release_notes.textile
  64. +16 −16 railties/guides/source/action_controller_overview.textile
  65. +48 −12 railties/guides/source/action_mailer_basics.textile
  66. +4 −4 railties/guides/source/active_record_basics.textile
  67. +119 −51 railties/guides/source/active_record_querying.textile
  68. +337 −206 railties/guides/source/activerecord_validations_callbacks.textile
  69. +40 −40 railties/guides/source/association_basics.textile
  70. +79 −71 railties/guides/source/caching_with_rails.textile
  71. +23 −20 railties/guides/source/command_line.textile
  72. +8 −14 railties/guides/source/contribute.textile
  73. +239 −0 railties/guides/source/contributing_to_rails.textile
  74. +23 −10 railties/guides/source/credits.erb.textile
  75. +6 −6 railties/guides/source/debugging_rails_applications.textile
  76. +28 −28 railties/guides/source/form_helpers.textile
  77. +7 −6 railties/guides/source/getting_started.textile
  78. +161 −133 railties/guides/source/i18n.textile
  79. +7 −3 railties/guides/source/index.erb.textile
  80. +12 −9 railties/guides/source/layout.html.erb
  81. +38 −24 railties/guides/source/layouts_and_rendering.textile
  82. +23 −23 railties/guides/source/migrations.textile
  83. +222 −0 railties/guides/source/nested_model_forms.textile
  84. +30 −30 railties/guides/source/performance_testing.textile
  85. +17 −17 railties/guides/source/plugins.textile
  86. +60 −7 railties/guides/source/rails_on_rack.textile
  87. +17 −17 railties/guides/source/routing.textile
  88. +61 −39 railties/guides/source/security.textile
  89. +14 −14 railties/guides/source/testing.textile
  90. +3 −1 railties/lib/initializer.rb
  91. +125 −98 railties/lib/rails/gem_dependency.rb
  92. +1 −1 railties/lib/rails/rack/metal.rb
  93. +1 −1 railties/lib/rails/version.rb
  94. +32 −46 railties/lib/tasks/gems.rake
  95. +2 −0 railties/test/boot_test.rb
  96. +1 −1 railties/test/fixtures/metal/multiplemetals/app/metal/metal_a.rb
  97. +1 −1 railties/test/fixtures/metal/multiplemetals/app/metal/metal_b.rb
  98. +5 −0 railties/test/fixtures/metal/pluralmetal/app/metal/legacy_routes.rb
  99. +1 −1 railties/test/fixtures/metal/singlemetal/app/metal/foo_metal.rb
  100. +1 −1 railties/test/fixtures/metal/subfolders/app/metal/Folder/metal_a.rb
  101. +1 −1 railties/test/fixtures/metal/subfolders/app/metal/Folder/metal_b.rb
  102. +10 −7 railties/test/gem_dependency_test.rb
  103. +6 −0 railties/test/metal_test.rb
  104. +1 −1 railties/test/vendor/gems/dummy-gem-g-1.0.0/.specification
View
@@ -1,10 +1,7 @@
-*2.3.1 [RC2] (March 5, 2009)*
+*2.3.2 [Final] (March 15, 2009)*
* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
-
-*2.3.0 [RC1] (February 1st, 2009)*
-
* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]
View
@@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
- s.add_dependency('actionpack', '= 2.3.1' + PKG_BUILD)
+ s.add_dependency('actionpack', '= 2.3.2' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
- TINY = 1
+ TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end
View
@@ -1,4 +1,4 @@
-*2.3.1 [RC2] (March 5, 2009)*
+*2.3.2 [Final] (March 15, 2009)*
* Fixed that redirection would just log the options, not the final url (which lead to "Redirected to #<Post:0x23150b8>") [DHH]
@@ -14,9 +14,6 @@
* Added localized rescue template when I18n.locale is set (ex: public/404.da.html) #1835 [José Valim]
-
-*2.3.0 [RC1] (February 1st, 2009)*
-
* Make the form_for and fields_for helpers support the new Active Record nested update options. #1202 [Eloy Duran]
<% form_for @person do |person_form| %>
View
@@ -80,7 +80,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.requirements << 'none'
- s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
+ s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'action_controller'
@@ -5,7 +5,7 @@
module ActionController
module Integration #:nodoc:
# An integration Session instance represents a set of requests and responses
- # performed sequentially by some virtual user. Becase you can instantiate
+ # performed sequentially by some virtual user. Because you can instantiate
# multiple sessions and run them side-by-side, you can also mimic (to some
# limited extent) multiple simultaneous users interacting with your system.
#
@@ -630,7 +630,7 @@ def map_member_actions(map, resource)
action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash)
action_path ||= Base.resources_path_names[action] || action
- map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m)
+ map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true })
end
end
end
@@ -641,9 +641,9 @@ def map_member_actions(map, resource)
map_resource_routes(map, resource, :destroy, resource.member_path, route_path)
end
- def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil)
+ def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} )
if resource.has_action?(action)
- action_options = action_options_for(action, resource, method)
+ action_options = action_options_for(action, resource, method, resource_options)
formatted_route_path = "#{route_path}.:format"
if route_name && @set.named_routes[route_name.to_sym].nil?
@@ -660,22 +660,18 @@ def add_conditions_for(conditions, method)
end
end
- def action_options_for(action, resource, method = nil)
+ def action_options_for(action, resource, method = nil, resource_options = {})
default_options = { :action => action.to_s }
require_id = !resource.kind_of?(SingletonResource)
+ force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource)
case default_options[:action]
when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements)
when "create"; default_options.merge(add_conditions_for(resource.conditions, method || :post)).merge(resource.requirements)
when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id))
when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id))
when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id))
- else
- if method.nil? || resource.member_methods.nil? || resource.member_methods[method.to_sym].nil?
- default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
- else
- resource.member_methods[method.to_sym].include?(action) ? default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(require_id)) : default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
- end
+ else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id))
end
end
end
@@ -23,11 +23,12 @@ def self.version
# Return the Rack release as a dotted string.
def self.release
- "0.4"
+ "1.0 bundled"
end
autoload :Builder, "rack/builder"
autoload :Cascade, "rack/cascade"
+ autoload :Chunked, "rack/chunked"
autoload :CommonLogger, "rack/commonlogger"
autoload :ConditionalGet, "rack/conditionalget"
autoload :ContentLength, "rack/content_length"
@@ -0,0 +1,49 @@
+require 'rack/utils'
+
+module Rack
+
+ # Middleware that applies chunked transfer encoding to response bodies
+ # when the response does not include a Content-Length header.
+ class Chunked
+ include Rack::Utils
+
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ status, headers, body = @app.call(env)
+ headers = HeaderHash.new(headers)
+
+ if env['HTTP_VERSION'] == 'HTTP/1.0' ||
+ STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
+ headers['Content-Length'] ||
+ headers['Transfer-Encoding']
+ [status, headers.to_hash, body]
+ else
+ dup.chunk(status, headers, body)
+ end
+ end
+
+ def chunk(status, headers, body)
+ @body = body
+ headers.delete('Content-Length')
+ headers['Transfer-Encoding'] = 'chunked'
+ [status, headers.to_hash, self]
+ end
+
+ def each
+ term = "\r\n"
+ @body.each do |chunk|
+ size = bytesize(chunk)
+ next if size == 0
+ yield [size.to_s(16), term, chunk, term].join
+ end
+ yield ["0", term, "", term].join
+ end
+
+ def close
+ @body.close if @body.respond_to?(:close)
+ end
+ end
+end
@@ -60,7 +60,7 @@ def serving
body = self
else
body = [F.read(@path)]
- size = body.first.size
+ size = Utils.bytesize(body.first)
end
[200, {
@@ -1,3 +1,5 @@
+require 'rack/content_length'
+
module Rack
module Handler
class CGI
@@ -6,6 +8,8 @@ def self.run(app, options=nil)
end
def self.serve(app)
+ app = ContentLength.new(app)
+
env = ENV.to_hash
env.delete "HTTP_CONTENT_LENGTH"
@@ -1,5 +1,6 @@
require 'fcgi'
require 'socket'
+require 'rack/content_length'
module Rack
module Handler
@@ -29,6 +30,8 @@ def read(*args)
end
def self.serve(request, app)
+ app = Rack::ContentLength.new(app)
+
env = request.env
env.delete "HTTP_CONTENT_LENGTH"
@@ -1,5 +1,6 @@
require 'lsapi'
-#require 'cgi'
+require 'rack/content_length'
+
module Rack
module Handler
class LSWS
@@ -9,6 +10,8 @@ def self.run(app, options=nil)
end
end
def self.serve(app)
+ app = Rack::ContentLength.new(app)
+
env = ENV.to_hash
env.delete "HTTP_CONTENT_LENGTH"
env["SCRIPT_NAME"] = "" if env["SCRIPT_NAME"] == "/"
@@ -1,5 +1,7 @@
require 'mongrel'
require 'stringio'
+require 'rack/content_length'
+require 'rack/chunked'
module Rack
module Handler
@@ -33,7 +35,7 @@ def self.run(app, options={})
end
def initialize(app)
- @app = app
+ @app = Rack::Chunked.new(Rack::ContentLength.new(app))
end
def process(request, response)
@@ -1,5 +1,7 @@
require 'scgi'
require 'stringio'
+require 'rack/content_length'
+require 'rack/chunked'
module Rack
module Handler
@@ -14,7 +16,7 @@ def self.run(app, options=nil)
end
def initialize(settings = {})
- @app = settings[:app]
+ @app = Rack::Chunked.new(Rack::ContentLength.new(settings[:app]))
@log = Object.new
def @log.info(*args); end
def @log.error(*args); end
@@ -1,9 +1,12 @@
require "thin"
+require "rack/content_length"
+require "rack/chunked"
module Rack
module Handler
class Thin
def self.run(app, options={})
+ app = Rack::Chunked.new(Rack::ContentLength.new(app))
server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
options[:Port] || 8080,
app)
@@ -1,5 +1,6 @@
require 'webrick'
require 'stringio'
+require 'rack/content_length'
module Rack
module Handler
@@ -14,7 +15,7 @@ def self.run(app, options={})
def initialize(server, app)
super server
- @app = app
+ @app = Rack::ContentLength.new(app)
end
def service(req, res)
@@ -374,59 +374,43 @@ def check_content_type(status, headers)
## === The Content-Length
def check_content_length(status, headers, env)
- chunked_response = false
- headers.each { |key, value|
- if key.downcase == 'transfer-encoding'
- chunked_response = value.downcase != 'identity'
- end
- }
-
headers.each { |key, value|
if key.downcase == 'content-length'
- ## There must be a <tt>Content-Length</tt>, except when the
- ## +Status+ is 1xx, 204 or 304, in which case there must be none
- ## given.
+ ## There must not be a <tt>Content-Length</tt> header when the
+ ## +Status+ is 1xx, 204 or 304.
assert("Content-Length header found in #{status} response, not allowed") {
not Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
}
- assert('Content-Length header should not be used if body is chunked') {
- not chunked_response
- }
-
bytes = 0
string_body = true
- @body.each { |part|
- unless part.kind_of?(String)
- string_body = false
- break
- end
+ if @body.respond_to?(:to_ary)
+ @body.each { |part|
+ unless part.kind_of?(String)
+ string_body = false
+ break
+ end
- bytes += Rack::Utils.bytesize(part)
- }
-
- if env["REQUEST_METHOD"] == "HEAD"
- assert("Response body was given for HEAD request, but should be empty") {
- bytes == 0
+ bytes += Rack::Utils.bytesize(part)
}
- else
- if string_body
- assert("Content-Length header was #{value}, but should be #{bytes}") {
- value == bytes.to_s
+
+ if env["REQUEST_METHOD"] == "HEAD"
+ assert("Response body was given for HEAD request, but should be empty") {
+ bytes == 0
}
+ else
+ if string_body
+ assert("Content-Length header was #{value}, but should be #{bytes}") {
+ value == bytes.to_s
+ }
+ end
end
end
return
end
}
-
- if [ String, Array ].include?(@body.class) && !chunked_response
- assert('No Content-Length header found') {
- Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include? status.to_i
- }
- end
end
## === The Body
@@ -12,7 +12,11 @@ module Rack
# first, since they are most specific.
class URLMap
- def initialize(map)
+ def initialize(map = {})
+ remap(map)
+ end
+
+ def remap(map)
@mapping = map.map { |location, app|
if location =~ %r{\Ahttps?://(.*?)(/.*)}
host, location = $1, $2
@@ -372,7 +372,7 @@ def self.parse_multipart(env)
data = body
end
- Utils.normalize_params(params, name, data)
+ Utils.normalize_params(params, name, data) unless data.nil?
break if buf.empty? || content_length == -1
}
Oops, something went wrong.

0 comments on commit 6335f5d

Please sign in to comment.