Skip to content
This repository
  • 1 commit
  • 33 files changed
  • 0 comments
  • 1 contributor
Dec 17, 2007
David Heinemeier Hansson Tagged Rails 2.0.2
git-svn-id: http://svn-commit.rubyonrails.org/rails/tags/rel_2-0-2@8430 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
c8da518

Showing 33 changed files with 276 additions and 72 deletions. Show diff stats Hide diff stats

  1. 2  Rakefile
  2. 5  actionmailer/CHANGELOG
  3. 2  actionmailer/Rakefile
  4. 2  actionmailer/lib/action_mailer/version.rb
  5. 18  actionpack/CHANGELOG
  6. 2  actionpack/Rakefile
  7. 43  actionpack/lib/action_controller/integration.rb
  8. 2  actionpack/lib/action_controller/request.rb
  9. 2  actionpack/lib/action_controller/session/cookie_store.rb
  10. 2  actionpack/lib/action_pack/version.rb
  11. 46  actionpack/lib/action_view/helpers/asset_tag_helper.rb
  12. 4  actionpack/lib/action_view/helpers/text_helper.rb
  13. 2  actionpack/lib/action_view/template_handlers/erb.rb
  14. 52  actionpack/test/controller/integration_test.rb
  15. 2  actionpack/test/controller/request_test.rb
  16. 39  actionpack/test/template/asset_tag_helper_test.rb
  17. 56  actionpack/test/template/erb_util_test.rb
  18. 2  activerecord/CHANGELOG
  19. 2  activerecord/Rakefile
  20. 2  activerecord/lib/active_record/version.rb
  21. 2  activeresource/CHANGELOG
  22. 2  activeresource/Rakefile
  23. 2  activeresource/lib/active_resource/version.rb
  24. 18  activesupport/lib/active_support/core_ext/date_time/conversions.rb
  25. 2  activesupport/lib/active_support/version.rb
  26. 8  railties/CHANGELOG
  27. 10  railties/Rakefile
  28. 2  railties/configs/databases/mysql.yml
  29. 2  railties/configs/databases/sqlite3.yml
  30. 1  railties/environments/production.rb
  31. 2  railties/lib/rails/version.rb
  32. 2  railties/lib/rails_generator/generators/applications/app/app_generator.rb
  33. 8  railties/lib/tasks/misc.rake
2  Rakefile
@@ -11,7 +11,7 @@ end
11 11
 desc 'Run all tests by default'
12 12
 task :default => :test
13 13
 
14  
-%w(test docs package pgem release).each do |task_name|
  14
+%w(test rdoc package pgem release).each do |task_name|
15 15
   desc "Run #{task_name} task for all projects"
16 16
   task task_name do
17 17
     PROJECTS.each do |project|
5  actionmailer/CHANGELOG
... ...
@@ -1,3 +1,8 @@
  1
+*2.0.2* (December 16th, 2007)
  2
+
  3
+* Included in Rails 2.0.2
  4
+
  5
+
1 6
 *2.0.1* (December 7th, 2007)
2 7
 
3 8
 * Update ActionMailer so it treats ActionView the same way that ActionController does.  Closes #10244 [rick]
2  actionmailer/Rakefile
@@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
55 55
   s.rubyforge_project = "actionmailer"
56 56
   s.homepage = "http://www.rubyonrails.org"
57 57
 
58  
-  s.add_dependency('actionpack', '= 2.0.1' + PKG_BUILD)
  58
+  s.add_dependency('actionpack', '= 2.0.2' + PKG_BUILD)
59 59
 
60 60
   s.has_rdoc = true
61 61
   s.requirements << 'none'
2  actionmailer/lib/action_mailer/version.rb
@@ -2,7 +2,7 @@ module ActionMailer
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
18  actionpack/CHANGELOG
... ...
@@ -1,4 +1,20 @@
1  
-*SVN*
  1
+*2.0.2* (December 16th, 2007)
  2
+
  3
+* Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos]
  4
+
  5
+* Allow headers['Accept'] to be set by hand when calling xml_http_request #10461 [BMorearty]
  6
+
  7
+* Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]
  8
+
  9
+* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:
  10
+
  11
+    ActionController::Base.asset_host = Proc.new { |source|
  12
+      if source.starts_with?('/images')
  13
+        "http://images.example.com"
  14
+      else
  15
+        "http://assets.example.com"
  16
+      end
  17
+    }
2 18
 
3 19
 * Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]
4 20
 
2  actionpack/Rakefile
@@ -76,7 +76,7 @@ spec = Gem::Specification.new do |s|
76 76
   s.has_rdoc = true
77 77
   s.requirements << 'none'
78 78
 
79  
-  s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
  79
+  s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
80 80
 
81 81
   s.require_path = 'lib'
82 82
   s.autorequire = 'action_controller'
43  actionpack/lib/action_controller/integration.rb
@@ -121,23 +121,38 @@ def follow_redirect!
121 121
         status
122 122
       end
123 123
 
124  
-      # Performs a GET request, following any subsequent redirect. Note that
125  
-      # the redirects are followed until the response is not a redirect--this
126  
-      # means you may run into an infinite loop if your redirect loops back to
127  
-      # itself. Headers are treated in the same way as #get.
128  
-      def get_via_redirect(path, args={}, headers = {})
129  
-        get path, args, headers
  124
+      # Performs a request using the specified method, following any subsequent
  125
+      # redirect. Note that the redirects are followed until the response is
  126
+      # not a redirect--this means you may run into an infinite loop if your
  127
+      # redirect loops back to itself.
  128
+      def request_via_redirect(http_method, path, parameters = nil, headers = nil)
  129
+        send(http_method, path, parameters, headers)
130 130
         follow_redirect! while redirect?
131 131
         status
132 132
       end
133 133
 
134  
-      # Performs a POST request, following any subsequent redirect. This is
135  
-      # vulnerable to infinite loops, the same as #get_via_redirect. Headers are
136  
-      # treated in the same way as #get.
137  
-      def post_via_redirect(path, args={}, headers = {})
138  
-        post path, args, headers
139  
-        follow_redirect! while redirect?
140  
-        status
  134
+      # Performs a GET request, following any subsequent redirect.
  135
+      # See #request_via_redirect() for more information.
  136
+      def get_via_redirect(path, parameters = nil, headers = nil)
  137
+        request_via_redirect(:get, path, parameters, headers)
  138
+      end
  139
+
  140
+      # Performs a POST request, following any subsequent redirect.
  141
+      # See #request_via_redirect() for more information.
  142
+      def post_via_redirect(path, parameters = nil, headers = nil)
  143
+        request_via_redirect(:post, path, parameters, headers)
  144
+      end
  145
+
  146
+      # Performs a PUT request, following any subsequent redirect.
  147
+      # See #request_via_redirect() for more information.
  148
+      def put_via_redirect(path, parameters = nil, headers = nil)
  149
+        request_via_redirect(:put, path, parameters, headers)
  150
+      end
  151
+
  152
+      # Performs a DELETE request, following any subsequent redirect.
  153
+      # See #request_via_redirect() for more information.
  154
+      def delete_via_redirect(path, parameters = nil, headers = nil)
  155
+        request_via_redirect(:delete, path, parameters, headers)
141 156
       end
142 157
 
143 158
       # Returns +true+ if the last response was a redirect.
@@ -187,7 +202,7 @@ def head(path, parameters = nil, headers = nil)
187 202
       def xml_http_request(request_method, path, parameters = nil, headers = nil)
188 203
         headers ||= {}
189 204
         headers['X-Requested-With'] = 'XMLHttpRequest'
190  
-        headers['Accept'] = 'text/javascript, text/html, application/xml, text/xml, */*'
  205
+        headers['Accept'] ||= 'text/javascript, text/html, application/xml, text/xml, */*'
191 206
 
192 207
         process(request_method, path, parameters, headers)
193 208
       end
2  actionpack/lib/action_controller/request.rb
@@ -4,7 +4,7 @@
4 4
 
5 5
 module ActionController
6 6
   # HTTP methods which are accepted by default. 
7  
-  ACCEPTED_HTTP_METHODS = Set.new(%w( get head put post delete ))
  7
+  ACCEPTED_HTTP_METHODS = Set.new(%w( get head put post delete options ))
8 8
 
9 9
   # CgiRequest and TestRequest provide concrete implementations.
10 10
   class AbstractRequest
2  actionpack/lib/action_controller/session/cookie_store.rb
@@ -35,7 +35,7 @@
2  actionpack/lib/action_pack/version.rb
@@ -2,7 +2,7 @@ module ActionPack #:nodoc:
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
46  actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -31,7 +31,7 @@ module Helpers #:nodoc:
31 31
     #   stylesheet_include_tag("application")
32 32
     #     => <link href="http://assets3.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
33 33
     #
34  
-    # To do this, you can either setup four actual hosts, or you can use wildcard DNS to CNAME 
  34
+    # To do this, you can either setup 4 actual hosts, or you can use wildcard DNS to CNAME 
35 35
     # the wildcard to a single asset host.  You can read more about setting up your DNS CNAME records from
36 36
     # your ISP.
37 37
     #
@@ -39,6 +39,32 @@ module Helpers #:nodoc:
39 39
     # for server load balancing. See http://www.die.net/musings/page_load_time/
40 40
     # for background.
41 41
     #
  42
+    # Alternatively, you can exert more control over the asset host by setting <tt>asset_host</tt> to a proc
  43
+    # that takes a single source argument. This is useful if you are unable to setup 4 actual hosts or have
  44
+    # fewer/more than 4 hosts. The example proc below generates http://assets1.example.com and
  45
+    # http://assets2.example.com randomly.
  46
+    #
  47
+    #   ActionController::Base.asset_host = Proc.new { |source| "http://assets#{rand(2) + 1}.example.com" }
  48
+    #   image_tag("rails.png")
  49
+    #     => <img src="http://assets2.example.com/images/rails.png" alt="Rails" />
  50
+    #   stylesheet_include_tag("application")
  51
+    #     => <link href="http://assets1.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
  52
+    #
  53
+    # The proc takes a single <tt>source</tt> parameter which is the path of the source asset. This can be used to
  54
+    # generate a particular asset host depending on the asset path.
  55
+    #
  56
+    #    ActionController::Base.asset_host = Proc.new { |source|
  57
+    #      if source.starts_with?('/images')
  58
+    #        "http://images.example.com"
  59
+    #      else
  60
+    #        "http://assets.example.com"
  61
+    #      end
  62
+    #    }
  63
+    #   image_tag("rails.png")
  64
+    #     => <img src="http://images.example.com/images/rails.png" alt="Rails" />
  65
+    #   stylesheet_include_tag("application")
  66
+    #     => <link href="http://assets.example.com/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />
  67
+    #
42 68
     # === Using asset timestamps
43 69
     #
44 70
     # By default, Rails will append all asset paths with that asset's timestamp. This allows you to set a cache-expiration date for the
@@ -385,19 +411,18 @@ def file_exist?(path)
385 411
         # Add the .ext if not present. Return full URLs otherwise untouched.
386 412
         # Prefix with /dir/ if lacking a leading /. Account for relative URL
387 413
         # roots. Rewrite the asset path for cache-busting asset ids. Include
388  
-        # a single or wildcarded asset host, if configured, with the correct
389  
-        # request protocol.
  414
+        # asset host, if configured, with the correct request protocol.
390 415
         def compute_public_path(source, dir, ext = nil, include_host = true)
391 416
           has_request = @controller.respond_to?(:request)
392 417
 
393 418
           cache_key =
394 419
             if has_request
395 420
               [ @controller.request.protocol,
396  
-                ActionController::Base.asset_host,
  421
+                ActionController::Base.asset_host.to_s,
397 422
                 @controller.request.relative_url_root,
398 423
                 dir, source, ext, include_host ].join
399 424
             else
400  
-              [ ActionController::Base.asset_host,
  425
+              [ ActionController::Base.asset_host.to_s,
401 426
                 dir, source, ext, include_host ].join
402 427
             end
403 428
 
@@ -430,11 +455,16 @@ def compute_public_path(source, dir, ext = nil, include_host = true)
430 455
         end
431 456
 
432 457
         # Pick an asset host for this source. Returns nil if no host is set,
433  
-        # the host if no wildcard is set, or the host interpolated with the
434  
-        # numbers 0-3 if it contains %d. The number is the source hash mod 4.
  458
+        # the host if no wildcard is set, the host interpolated with the
  459
+        # numbers 0-3 if it contains %d (the number is the source hash mod 4),
  460
+        # or the value returned from invoking the proc if it's a proc.
435 461
         def compute_asset_host(source)
436 462
           if host = ActionController::Base.asset_host
437  
-            host % (source.hash % 4)
  463
+            if host.is_a?(Proc)
  464
+              host.call(source)
  465
+            else
  466
+              host % (source.hash % 4)
  467
+            end
438 468
           end
439 469
         end
440 470
 
4  actionpack/lib/action_view/helpers/text_helper.rb
@@ -287,8 +287,8 @@ def simple_format(text)
287 287
       #
288 288
       # ==== Examples
289 289
       #   auto_link("Go to http://www.rubyonrails.org and say hello to david@loudthinking.com") 
290  
-      #   # => "Go to <a href="http://www.rubyonrails.org">http://www.rubyonrails.org</a> and
291  
-      #   #     say hello to <a href="mailto:david@loudthinking.com">david@loudthinking.com</a>"
  290
+      #   # => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> and
  291
+      #   #     say hello to <a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>"
292 292
       #
293 293
       #   auto_link("Visit http://www.loudthinking.com/ or e-mail david@loudthinking.com", :urls)
294 294
       #   # => "Visit <a href=\"http://www.loudthinking.com/\">http://www.loudthinking.com/</a> 
2  actionpack/lib/action_view/template_handlers/erb.rb
@@ -5,7 +5,7 @@ module Util
5 5
     HTML_ESCAPE = { '&' => '&amp;', '"' => '&quot;', '>' => '&gt;', '<' => '&lt;' }
6 6
 
7 7
     def html_escape(s)
8  
-      s.to_s.gsub(/[&\"><]/) { |special| HTML_ESCAPE[special] }
  8
+      s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
9 9
     end
10 10
   end
11 11
 end
52  actionpack/test/controller/integration_test.rb
@@ -49,28 +49,49 @@ def test_follow_redirect_calls_get_and_returns_status
49 49
     assert_equal 200, @session.follow_redirect!
50 50
   end
51 51
 
52  
-  def test_get_via_redirect
53  
-    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
54  
-
55  
-    @session.expects(:get).with(path,args,headers)
  52
+  def test_request_via_redirect_uses_given_method
  53
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
  54
+    @session.expects(:put).with(path, args, headers)
  55
+    @session.stubs(:redirect?).returns(false)
  56
+    @session.request_via_redirect(:put, path, args, headers)
  57
+  end
56 58
 
  59
+  def test_request_via_redirect_follows_redirects
  60
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
57 61
     @session.stubs(:redirect?).returns(true, true, false)
58 62
     @session.expects(:follow_redirect!).times(2)
  63
+    @session.request_via_redirect(:get, path, args, headers)
  64
+  end
59 65
 
  66
+  def test_request_via_redirect_returns_status
  67
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
  68
+    @session.stubs(:redirect?).returns(false)
60 69
     @session.stubs(:status).returns(200)
61  
-    assert_equal 200, @session.get_via_redirect(path, args, headers)
  70
+    assert_equal 200, @session.request_via_redirect(:get, path, args, headers)
62 71
   end
63 72
 
64  
-  def test_post_via_redirect
  73
+  def test_get_via_redirect
65 74
     path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
  75
+    @session.expects(:request_via_redirect).with(:get, path, args, headers)
  76
+    @session.get_via_redirect(path, args, headers)
  77
+  end
66 78
 
67  
-    @session.expects(:post).with(path,args,headers)
  79
+  def test_post_via_redirect
  80
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
  81
+    @session.expects(:request_via_redirect).with(:post, path, args, headers)
  82
+    @session.post_via_redirect(path, args, headers)
  83
+  end
68 84
 
69  
-    @session.stubs(:redirect?).returns(true, true, false)
70  
-    @session.expects(:follow_redirect!).times(2)
  85
+  def test_put_via_redirect
  86
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
  87
+    @session.expects(:request_via_redirect).with(:put, path, args, headers)
  88
+    @session.put_via_redirect(path, args, headers)
  89
+  end
71 90
 
72  
-    @session.stubs(:status).returns(200)
73  
-    assert_equal 200, @session.post_via_redirect(path, args, headers)
  91
+  def test_delete_via_redirect
  92
+    path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
  93
+    @session.expects(:request_via_redirect).with(:delete, path, args, headers)
  94
+    @session.delete_via_redirect(path, args, headers)
74 95
   end
75 96
 
76 97
   def test_url_for_with_controller
@@ -179,6 +200,15 @@ def test_xml_http_request_head
179 200
     @session.expects(:process).with(:head,path,params,headers_after_xhr)
180 201
     @session.xml_http_request(:head,path,params,headers)
181 202
   end
  203
+  
  204
+  def test_xml_http_request_override_accept
  205
+    path = "/index"; params = "blah"; headers = {:location => 'blah', "Accept" => "application/xml"}
  206
+    headers_after_xhr = headers.merge(
  207
+      "X-Requested-With" => "XMLHttpRequest"
  208
+    )
  209
+    @session.expects(:process).with(:post,path,params,headers_after_xhr)
  210
+    @session.xml_http_request(:post,path,params,headers)
  211
+  end
182 212
 end
183 213
 
184 214
 class IntegrationTestTest < Test::Unit::TestCase
2  actionpack/test/controller/request_test.rb
@@ -316,7 +316,7 @@ def test_invalid_http_method_raises_exception
316 316
 
317 317
   def test_allow_method_hacking_on_post
318 318
     set_request_method_to :post
319  
-    [:get, :head, :put, :post, :delete].each do |method|
  319
+    [:get, :head, :options, :put, :post, :delete].each do |method|
320 320
       @request.instance_eval { @parameters = { :_method => method } ; @request_method = nil }
321 321
       assert_equal(method == :head ? :get : method, @request.method)
322 322
     end
39  actionpack/test/template/asset_tag_helper_test.rb
@@ -223,7 +223,6 @@ def test_should_not_modify_source_string
223 223
     assert_equal copy, source
224 224
   end
225 225
 
226  
-
227 226
   def test_caching_javascript_include_tag_when_caching_on
228 227
     ENV["RAILS_ASSET_ID"] = ""
229 228
     ActionController::Base.asset_host = 'http://a%d.example.com'
@@ -247,7 +246,24 @@ def test_caching_javascript_include_tag_when_caching_on
247 246
     File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js'))
248 247
     File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js'))
249 248
   end
250  
-  
  249
+
  250
+  def test_caching_javascript_include_tag_when_caching_on_with_proc_asset_host
  251
+    ENV["RAILS_ASSET_ID"] = ""
  252
+    ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }
  253
+    ActionController::Base.perform_caching = true
  254
+
  255
+    assert_equal '/javascripts/scripts.js'.length, 23
  256
+    assert_dom_equal(
  257
+      %(<script src="http://a23.example.com/javascripts/scripts.js" type="text/javascript"></script>),
  258
+      javascript_include_tag(:all, :cache => 'scripts')
  259
+    )
  260
+
  261
+    assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
  262
+
  263
+  ensure
  264
+    File.delete(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'scripts.js'))
  265
+  end
  266
+
251 267
   def test_caching_javascript_include_tag_when_caching_on_and_using_subdirectory
252 268
     ENV["RAILS_ASSET_ID"] = ""
253 269
     ActionController::Base.asset_host = 'http://a%d.example.com'
@@ -304,7 +320,24 @@ def test_caching_stylesheet_link_tag_when_caching_on
304 320
     File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css'))
305 321
     File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css'))
306 322
   end
307  
-  
  323
+
  324
+  def test_caching_stylesheet_link_tag_when_caching_on_with_proc_asset_host
  325
+    ENV["RAILS_ASSET_ID"] = ""
  326
+    ActionController::Base.asset_host = Proc.new { |source| "http://a#{source.length}.example.com" }
  327
+    ActionController::Base.perform_caching = true
  328
+
  329
+    assert_equal '/stylesheets/styles.css'.length, 23
  330
+    assert_dom_equal(
  331
+      %(<link href="http://a23.example.com/stylesheets/styles.css" media="screen" rel="stylesheet" type="text/css" />),
  332
+      stylesheet_link_tag(:all, :cache => 'styles')
  333
+    )
  334
+
  335
+    assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
  336
+
  337
+  ensure
  338
+    File.delete(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'styles.css'))
  339
+  end
  340
+
308 341
   def test_caching_stylesheet_include_tag_when_caching_off
309 342
     ENV["RAILS_ASSET_ID"] = ""
310 343
     ActionController::Base.perform_caching = false
56  actionpack/test/template/erb_util_test.rb
... ...
@@ -0,0 +1,56 @@
  1
+require "#{File.dirname(__FILE__)}/../abstract_unit"
  2
+
  3
+class ErbUtilTest < Test::Unit::TestCase
  4
+  include ERB::Util
  5
+  
  6
+  def test_amp
  7
+    assert_equal '&amp;', html_escape('&')
  8
+  end
  9
+  
  10
+  def test_quot
  11
+    assert_equal '&quot;', html_escape('"')
  12
+  end
  13
+
  14
+  def test_lt
  15
+    assert_equal '&lt;', html_escape('<')
  16
+  end
  17
+
  18
+  def test_gt
  19
+    assert_equal '&gt;', html_escape('>')
  20
+  end
  21
+  
  22
+  def test_rest_in_ascii
  23
+    (0..127).to_a.map(&:chr).each do |chr|
  24
+      next if %w(& " < >).include?(chr)
  25
+      assert_equal chr, html_escape(chr)
  26
+    end
  27
+  end
  28
+end
  29
+require "#{File.dirname(__FILE__)}/../abstract_unit"
  30
+
  31
+class ErbUtilTest < Test::Unit::TestCase
  32
+  include ERB::Util
  33
+  
  34
+  def test_amp
  35
+    assert_equal '&amp;', html_escape('&')
  36
+  end
  37
+  
  38
+  def test_quot
  39
+    assert_equal '&quot;', html_escape('"')
  40
+  end
  41
+
  42
+  def test_lt
  43
+    assert_equal '&lt;', html_escape('<')
  44
+  end
  45
+
  46
+  def test_gt
  47
+    assert_equal '&gt;', html_escape('>')
  48
+  end
  49
+  
  50
+  def test_rest_in_ascii
  51
+    (0..127).to_a.map(&:chr).each do |chr|
  52
+      next if %w(& " < >).include?(chr)
  53
+      assert_equal chr, html_escape(chr)
  54
+    end
  55
+  end
  56
+end
2  activerecord/CHANGELOG
... ...
@@ -1,4 +1,4 @@
1  
-*SVN*
  1
+*2.0.2* (December 16th, 2007)
2 2
 
3 3
 * Ensure optimistic locking handles nil #lock_version values properly.  Closes #10510 [rick]
4 4
 
2  activerecord/Rakefile
@@ -172,7 +172,7 @@ spec = Gem::Specification.new do |s|
172 172
     s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
173 173
   end
174 174
 
175  
-  s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
  175
+  s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
176 176
 
177 177
   s.files.delete "test/fixtures/fixture_database.sqlite"
178 178
   s.files.delete "test/fixtures/fixture_database_2.sqlite"
2  activerecord/lib/active_record/version.rb
@@ -2,7 +2,7 @@ module ActiveRecord
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
2  activeresource/CHANGELOG
... ...
@@ -1,4 +1,4 @@
1  
-*SVN*
  1
+*2.0.2* (December 16th, 2007)
2 2
 
3 3
 * Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]
4 4
 
2  activeresource/Rakefile
@@ -62,7 +62,7 @@ spec = Gem::Specification.new do |s|
62 62
     s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
63 63
   end
64 64
   
65  
-  s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
  65
+  s.add_dependency('activesupport', '= 2.0.2' + PKG_BUILD)
66 66
 
67 67
   s.require_path = 'lib'
68 68
   s.autorequire = 'active_resource'
2  activeresource/lib/active_resource/version.rb
@@ -2,7 +2,7 @@ module ActiveResource
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
18  activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -15,7 +15,22 @@ def self.included(base)
15 15
             remove_method :to_time if base.instance_methods.include?(:to_time)
16 16
           end
17 17
         end
18  
-
  18
+        
  19
+        # Convert to a formatted string - see DATE_FORMATS for predefined formats.
  20
+        # You can also add your own formats to the DATE_FORMATS constant and use them with this method.
  21
+        # 
  22
+        # This method is also aliased as <tt>to_s</tt>.
  23
+        # 
  24
+        # === Examples:
  25
+        #   datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0)   # => Tue, 04 Dec 2007 00:00:00 +0000
  26
+        # 
  27
+        #   datetime.to_formatted_s(:db)            # => "2007-12-04 00:00:00"
  28
+        #   datetime.to_s(:db)                      # => "2007-12-04 00:00:00"
  29
+        #   datetime.to_s(:number)                  # => "20071204000000"
  30
+        #   datetime.to_formatted_s(:short)         # => "04 Dec 00:00"
  31
+        #   datetime.to_formatted_s(:long)          # => "December 04, 2007 00:00"
  32
+        #   datetime.to_formatted_s(:long_ordinal)  # => "December 4th, 2007 00:00"
  33
+        #   datetime.to_formatted_s(:rfc822)        # => "Tue, 04 Dec 2007 00:00:00 +0000"
19 34
         def to_formatted_s(format = :default)
20 35
           if formatter = ::Time::DATE_FORMATS[format]
21 36
             if formatter.respond_to?(:call)
@@ -49,6 +64,7 @@ def to_datetime
49 64
           self
50 65
         end
51 66
 
  67
+        # Converts datetime to an appropriate format for use in XML
52 68
         def xmlschema
53 69
           strftime("%Y-%m-%dT%H:%M:%S%Z")
54 70
         end if RUBY_VERSION < '1.9'
2  activesupport/lib/active_support/version.rb
@@ -2,7 +2,7 @@ module ActiveSupport
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
8  railties/CHANGELOG
... ...
@@ -1,6 +1,10 @@
1  
-*SVN*
  1
+*2.0.2* (December 16th, 2007)
2 2
 
3  
-* Introduce `rake generate:secret` to output a crytographically secure secret key for use with cookie sessions.  #xxxx [update from Trac]
  3
+* Changed the default database from mysql to sqlite3, so now running "rails myapp" will have a config/database.yml that's setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run "rails -d mysql myapp" [DHH]
  4
+
  5
+* Turned on ActionView::Base.cache_template_loading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]
  6
+
  7
+* Introduce `rake secret` to output a crytographically secure secret key for use with cookie sessions #10363 [revans]
4 8
 
5 9
 * Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]
6 10
 
10  railties/Rakefile
@@ -312,11 +312,11 @@ spec = Gem::Specification.new do |s|
312 312
   EOF
313 313
 
314 314
   s.add_dependency('rake', '>= 0.7.2')
315  
-  s.add_dependency('activesupport',    '= 2.0.1' + PKG_BUILD)
316  
-  s.add_dependency('activerecord',     '= 2.0.1' + PKG_BUILD)
317  
-  s.add_dependency('actionpack',       '= 2.0.1' + PKG_BUILD)
318  
-  s.add_dependency('actionmailer',     '= 2.0.1' + PKG_BUILD)
319  
-  s.add_dependency('activeresource',   '= 2.0.1' + PKG_BUILD)
  315
+  s.add_dependency('activesupport',    '= 2.0.2' + PKG_BUILD)
  316
+  s.add_dependency('activerecord',     '= 2.0.2' + PKG_BUILD)
  317
+  s.add_dependency('actionpack',       '= 2.0.2' + PKG_BUILD)
  318
+  s.add_dependency('actionmailer',     '= 2.0.2' + PKG_BUILD)
  319
+  s.add_dependency('activeresource',   '= 2.0.2' + PKG_BUILD)
320 320
 
321 321
   s.rdoc_options << '--exclude' << '.'
322 322
   s.has_rdoc = false
2  railties/configs/databases/mysql.yml
... ...
@@ -1,4 +1,4 @@
1  
-# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
  1
+# MySQL.  Versions 4.1 and 5.0 are recommended.
2 2
 #
3 3
 # Install the MySQL driver:
4 4
 #   gem install mysql
2  railties/configs/databases/sqlite3.yml
... ...
@@ -1,5 +1,5 @@
1 1
 # SQLite version 3.x
2  
-#   gem install sqlite3-ruby
  2
+#   gem install sqlite3-ruby (not necessary on OS X Leopard)
3 3
 development:
4 4
   adapter: sqlite3
5 5
   database: db/development.sqlite3
1  railties/environments/production.rb
@@ -10,6 +10,7 @@
10 10
 # Full error reports are disabled and caching is turned on
11 11
 config.action_controller.consider_all_requests_local = false
12 12
 config.action_controller.perform_caching             = true
  13
+config.action_view.cache_template_loading            = true
13 14
 
14 15
 # Enable serving of images, stylesheets, and javascripts from an asset server
15 16
 # config.action_controller.asset_host                  = "http://assets.example.com"
2  railties/lib/rails/version.rb
@@ -2,7 +2,7 @@ module Rails
2 2
   module VERSION #:nodoc:
3 3
     MAJOR = 2
4 4
     MINOR = 0
5  
-    TINY  = 1
  5
+    TINY  = 2
6 6
 
7 7
     STRING = [MAJOR, MINOR, TINY].join('.')
8 8
   end
2  railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -8,7 +8,7 @@ class AppGenerator < Rails::Generator::Base
8 8
 
9 9
   DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase)
10 10
 
11  
-  default_options   :db => (ENV["RAILS_DEFAULT_DATABASE"] || "mysql"),
  11
+  default_options   :db => (ENV["RAILS_DEFAULT_DATABASE"] || "sqlite3"),
12 12
     :shebang => DEFAULT_SHEBANG, :freeze => false
13 13
   mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
14 14
 
8  railties/lib/tasks/misc.rake
@@ -4,9 +4,7 @@ task :environment do
4 4
 end
5 5
 
6 6
 require 'rails_generator/secret_key_generator'
7  
-namespace :generate do
8  
-  desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
9  
-  task :secret do
10  
-    puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
11  
-  end
  7
+desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
  8
+task :secret do
  9
+  puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
12 10
 end

No commit comments for this range

Something went wrong with that request. Please try again.