actionpack 4.0.0.beta1 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionpack might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +195 -11
  3. data/lib/abstract_controller/base.rb +1 -1
  4. data/lib/abstract_controller/helpers.rb +2 -2
  5. data/lib/abstract_controller/layouts.rb +10 -5
  6. data/lib/abstract_controller/rendering.rb +11 -3
  7. data/lib/abstract_controller/translation.rb +1 -1
  8. data/lib/action_controller/log_subscriber.rb +5 -0
  9. data/lib/action_controller/metal.rb +2 -3
  10. data/lib/action_controller/metal/force_ssl.rb +52 -17
  11. data/lib/action_controller/metal/helpers.rb +0 -1
  12. data/lib/action_controller/metal/hide_actions.rb +1 -1
  13. data/lib/action_controller/metal/http_authentication.rb +3 -2
  14. data/lib/action_controller/metal/live.rb +34 -0
  15. data/lib/action_controller/metal/rendering.rb +1 -1
  16. data/lib/action_controller/metal/strong_parameters.rb +7 -3
  17. data/lib/action_controller/test_case.rb +45 -11
  18. data/lib/action_dispatch.rb +4 -6
  19. data/lib/action_dispatch/http/cache.rb +2 -2
  20. data/lib/action_dispatch/http/headers.rb +39 -15
  21. data/lib/action_dispatch/http/mime_negotiation.rb +1 -1
  22. data/lib/action_dispatch/http/mime_type.rb +11 -3
  23. data/lib/action_dispatch/http/parameters.rb +17 -24
  24. data/lib/action_dispatch/http/request.rb +17 -2
  25. data/lib/action_dispatch/http/response.rb +2 -1
  26. data/lib/action_dispatch/http/upload.rb +5 -5
  27. data/lib/action_dispatch/http/url.rb +53 -12
  28. data/lib/action_dispatch/journey/formatter.rb +1 -1
  29. data/lib/action_dispatch/journey/path/pattern.rb +1 -1
  30. data/lib/action_dispatch/journey/route.rb +8 -0
  31. data/lib/action_dispatch/journey/router.rb +3 -1
  32. data/lib/action_dispatch/journey/visitors.rb +8 -0
  33. data/lib/action_dispatch/middleware/cookies.rb +169 -135
  34. data/lib/action_dispatch/middleware/exception_wrapper.rb +1 -0
  35. data/lib/action_dispatch/middleware/remote_ip.rb +2 -2
  36. data/lib/action_dispatch/middleware/request_id.rb +1 -1
  37. data/lib/action_dispatch/middleware/session/cookie_store.rb +38 -58
  38. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb +1 -1
  39. data/lib/action_dispatch/middleware/templates/rescues/_trace.erb +4 -6
  40. data/lib/action_dispatch/middleware/templates/rescues/routing_error.erb +1 -1
  41. data/lib/action_dispatch/middleware/templates/rescues/template_error.erb +1 -1
  42. data/lib/action_dispatch/routing.rb +28 -64
  43. data/lib/action_dispatch/routing/mapper.rb +61 -48
  44. data/lib/action_dispatch/routing/route_set.rb +17 -14
  45. data/lib/action_dispatch/testing/assertions/routing.rb +2 -2
  46. data/lib/action_dispatch/testing/assertions/selector.rb +2 -2
  47. data/lib/action_dispatch/testing/integration.rb +36 -35
  48. data/lib/action_dispatch/testing/test_process.rb +1 -1
  49. data/lib/action_pack/version.rb +7 -6
  50. data/lib/action_view/buffers.rb +6 -0
  51. data/lib/action_view/dependency_tracker.rb +3 -1
  52. data/lib/action_view/helpers/asset_tag_helper.rb +13 -8
  53. data/lib/action_view/helpers/capture_helper.rb +2 -2
  54. data/lib/action_view/helpers/date_helper.rb +1 -1
  55. data/lib/action_view/helpers/form_helper.rb +56 -19
  56. data/lib/action_view/helpers/form_options_helper.rb +3 -3
  57. data/lib/action_view/helpers/form_tag_helper.rb +1 -1
  58. data/lib/action_view/helpers/javascript_helper.rb +2 -2
  59. data/lib/action_view/helpers/number_helper.rb +25 -0
  60. data/lib/action_view/helpers/tags/base.rb +9 -10
  61. data/lib/action_view/helpers/tags/check_box.rb +1 -1
  62. data/lib/action_view/helpers/tags/checkable.rb +2 -2
  63. data/lib/action_view/helpers/tags/collection_check_boxes.rb +3 -3
  64. data/lib/action_view/helpers/tags/collection_helpers.rb +3 -3
  65. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +3 -3
  66. data/lib/action_view/helpers/tags/collection_select.rb +1 -1
  67. data/lib/action_view/helpers/tags/color_field.rb +2 -2
  68. data/lib/action_view/helpers/tags/date_field.rb +2 -2
  69. data/lib/action_view/helpers/tags/date_select.rb +2 -2
  70. data/lib/action_view/helpers/tags/datetime_field.rb +2 -2
  71. data/lib/action_view/helpers/tags/datetime_local_field.rb +2 -2
  72. data/lib/action_view/helpers/tags/datetime_select.rb +2 -2
  73. data/lib/action_view/helpers/tags/email_field.rb +2 -2
  74. data/lib/action_view/helpers/tags/file_field.rb +2 -2
  75. data/lib/action_view/helpers/tags/grouped_collection_select.rb +2 -2
  76. data/lib/action_view/helpers/tags/hidden_field.rb +2 -2
  77. data/lib/action_view/helpers/tags/label.rb +2 -2
  78. data/lib/action_view/helpers/tags/month_field.rb +2 -2
  79. data/lib/action_view/helpers/tags/number_field.rb +2 -2
  80. data/lib/action_view/helpers/tags/password_field.rb +2 -2
  81. data/lib/action_view/helpers/tags/radio_button.rb +2 -2
  82. data/lib/action_view/helpers/tags/range_field.rb +2 -2
  83. data/lib/action_view/helpers/tags/search_field.rb +2 -2
  84. data/lib/action_view/helpers/tags/select.rb +2 -3
  85. data/lib/action_view/helpers/tags/tel_field.rb +2 -2
  86. data/lib/action_view/helpers/tags/text_area.rb +2 -2
  87. data/lib/action_view/helpers/tags/text_field.rb +2 -2
  88. data/lib/action_view/helpers/tags/time_field.rb +2 -2
  89. data/lib/action_view/helpers/tags/time_select.rb +2 -2
  90. data/lib/action_view/helpers/tags/time_zone_select.rb +2 -2
  91. data/lib/action_view/helpers/tags/url_field.rb +2 -2
  92. data/lib/action_view/helpers/tags/week_field.rb +2 -2
  93. data/lib/action_view/helpers/text_helper.rb +8 -5
  94. data/lib/action_view/helpers/url_helper.rb +18 -6
  95. data/lib/action_view/lookup_context.rb +7 -1
  96. data/lib/action_view/path_set.rb +6 -0
  97. data/lib/action_view/renderer/abstract_renderer.rb +15 -0
  98. data/lib/action_view/renderer/partial_renderer.rb +14 -0
  99. data/lib/action_view/renderer/renderer.rb +6 -0
  100. data/lib/action_view/template.rb +3 -2
  101. data/lib/action_view/template/handlers/erb.rb +29 -3
  102. data/lib/action_view/template/resolver.rb +3 -3
  103. data/lib/action_view/test_case.rb +1 -0
  104. data/lib/action_view/vendor/html-scanner/html/sanitizer.rb +5 -5
  105. data/lib/action_view/vendor/html-scanner/html/selector.rb +8 -8
  106. metadata +8 -8
@@ -47,7 +47,7 @@ module ActionView
47
47
  NAME_BLOCK = lambda {|cache, name| cache[name] = SmallCache.new(&PREFIX_BLOCK)}
48
48
  KEY_BLOCK = lambda {|cache, key| cache[key] = SmallCache.new(&NAME_BLOCK)}
49
49
 
50
- # usually a majority of template look ups return nothing, use this canonical preallocated array to safe memory
50
+ # usually a majority of template look ups return nothing, use this canonical preallocated array to save memory
51
51
  NO_TEMPLATES = [].freeze
52
52
 
53
53
  def initialize
@@ -109,7 +109,7 @@ module ActionView
109
109
  @cache.clear
110
110
  end
111
111
 
112
- # Normalizes the arguments and passes it on to find_template.
112
+ # Normalizes the arguments and passes it on to find_templates.
113
113
  def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
114
114
  cached(key, [name, prefix, partial], details, locals) do
115
115
  find_templates(name, prefix, partial, details)
@@ -255,7 +255,7 @@ module ActionView
255
255
  #
256
256
  # FileSystemResolver.new("/path/to/views", ":prefix/:action{.:locale,}{.:formats,}{.:handlers,}")
257
257
  #
258
- # This one allows you to keep files with different formats in seperated subdirectories,
258
+ # This one allows you to keep files with different formats in separate subdirectories,
259
259
  # eg. `users/new.html` will be loaded from `users/html/new.erb` or `users/new.html.erb`,
260
260
  # `users/new.js` from `users/js/new.erb` or `users/new.js.erb`, etc.
261
261
  #
@@ -219,6 +219,7 @@ module ActionView
219
219
  :@_routes,
220
220
  :@controller,
221
221
  :@_layouts,
222
+ :@_files,
222
223
  :@_rendered_views,
223
224
  :@method_name,
224
225
  :@output_buffer,
@@ -77,7 +77,7 @@ module HTML
77
77
 
78
78
  # A regular expression of the valid characters used to separate protocols like
79
79
  # the ':' in 'http://foo.com'
80
- self.protocol_separator = /:|(&#0*58)|(&#x70)|(%|%)3A/
80
+ self.protocol_separator = /:|(&#0*58)|(&#x70)|(&#x0*3a)|(%|%)3A/i
81
81
 
82
82
  # Specifies a Set of HTML attributes that can have URIs.
83
83
  self.uri_attributes = Set.new(%w(href src cite action longdesc xlink:href lowsrc))
@@ -121,8 +121,8 @@ module HTML
121
121
  style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ')
122
122
 
123
123
  # gauntlet
124
- if style !~ /^([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*$/ ||
125
- style !~ /^(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*$/
124
+ if style !~ /\A([:,;#%.\sa-zA-Z0-9!]|\w-\w|\'[\s\w]+\'|\"[\s\w]+\"|\([\d,\s]+\))*\z/ ||
125
+ style !~ /\A(\s*[-\w]+\s*:\s*[^:;]*(;|$)\s*)*\z/
126
126
  return ''
127
127
  end
128
128
 
@@ -133,7 +133,7 @@ module HTML
133
133
  elsif shorthand_css_properties.include?(prop.split('-')[0].downcase)
134
134
  unless val.split().any? do |keyword|
135
135
  !allowed_css_keywords.include?(keyword) &&
136
- keyword !~ /^(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)$/
136
+ keyword !~ /\A(#[0-9a-f]+|rgb\(\d+%?,\d*%?,?\d*%?\)?|\d{0,2}\.?\d{0,2}(cm|em|ex|in|mm|pc|pt|px|%|,|\))?)\z/
137
137
  end
138
138
  clean << prop + ': ' + val + ';'
139
139
  end
@@ -182,7 +182,7 @@ module HTML
182
182
 
183
183
  def contains_bad_protocols?(attr_name, value)
184
184
  uri_attributes.include?(attr_name) &&
185
- (value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(%|&#37;)3A/ && !allowed_protocols.include?(value.split(protocol_separator).first.downcase.strip))
185
+ (value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i && !allowed_protocols.include?(value.split(protocol_separator).first.downcase.strip))
186
186
  end
187
187
  end
188
188
  end
@@ -537,7 +537,7 @@ module HTML
537
537
  # Get identifier, class, attribute name, pseudo or negation.
538
538
  while true
539
539
  # Element identifier.
540
- next if statement.sub!(/^#(\?|[\w\-]+)/) do |match|
540
+ next if statement.sub!(/^#(\?|[\w\-]+)/) do
541
541
  id = $1
542
542
  if id == "?"
543
543
  id = values.shift
@@ -549,7 +549,7 @@ module HTML
549
549
  end
550
550
 
551
551
  # Class name.
552
- next if statement.sub!(/^\.([\w\-]+)/) do |match|
552
+ next if statement.sub!(/^\.([\w\-]+)/) do
553
553
  class_name = $1
554
554
  @source << ".#{class_name}"
555
555
  class_name = Regexp.new("(^|\s)#{Regexp.escape(class_name)}($|\s)") unless class_name.is_a?(Regexp)
@@ -558,7 +558,7 @@ module HTML
558
558
  end
559
559
 
560
560
  # Attribute value.
561
- next if statement.sub!(/^\[\s*([[:alpha:]][\w\-:]*)\s*((?:[~|^$*])?=)?\s*('[^']*'|"[^*]"|[^\]]*)\s*\]/) do |match|
561
+ next if statement.sub!(/^\[\s*([[:alpha:]][\w\-:]*)\s*((?:[~|^$*])?=)?\s*('[^']*'|"[^*]"|[^\]]*)\s*\]/) do
562
562
  name, equality, value = $1, $2, $3
563
563
  if value == "?"
564
564
  value = values.shift
@@ -575,7 +575,7 @@ module HTML
575
575
  end
576
576
 
577
577
  # Root element only.
578
- next if statement.sub!(/^:root/) do |match|
578
+ next if statement.sub!(/^:root/) do
579
579
  pseudo << lambda do |element|
580
580
  element.parent.nil? || !element.parent.tag?
581
581
  end
@@ -611,7 +611,7 @@ module HTML
611
611
  "" # Remove
612
612
  end
613
613
  # First/last child (of type).
614
- next if statement.sub!(/^:(first|last)-(child|of-type)/) do |match|
614
+ next if statement.sub!(/^:(first|last)-(child|of-type)/) do
615
615
  reverse = $1 == "last"
616
616
  of_type = $2 == "of-type"
617
617
  pseudo << nth_child(0, 1, of_type, reverse)
@@ -619,7 +619,7 @@ module HTML
619
619
  "" # Remove
620
620
  end
621
621
  # Only child (of type).
622
- next if statement.sub!(/^:only-(child|of-type)/) do |match|
622
+ next if statement.sub!(/^:only-(child|of-type)/) do
623
623
  of_type = $1 == "of-type"
624
624
  pseudo << only_child(of_type)
625
625
  @source << ":only-#{$1}"
@@ -628,7 +628,7 @@ module HTML
628
628
 
629
629
  # Empty: no child elements or meaningful content (whitespaces
630
630
  # are ignored).
631
- next if statement.sub!(/^:empty/) do |match|
631
+ next if statement.sub!(/^:empty/) do
632
632
  pseudo << lambda do |element|
633
633
  empty = true
634
634
  for child in element.children
@@ -644,7 +644,7 @@ module HTML
644
644
  end
645
645
  # Content: match the text content of the element, stripping
646
646
  # leading and trailing spaces.
647
- next if statement.sub!(/^:content\(\s*(\?|'[^']*'|"[^"]*"|[^)]*)\s*\)/) do |match|
647
+ next if statement.sub!(/^:content\(\s*(\?|'[^']*'|"[^"]*"|[^)]*)\s*\)/) do
648
648
  content = $1
649
649
  if content == "?"
650
650
  content = values.shift
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta1
4
+ version: 4.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-02-26 00:00:00.000000000 Z
11
+ date: 2013-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0.beta1
19
+ version: 4.0.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0.beta1
26
+ version: 4.0.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,28 +86,28 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 4.0.0.beta1
89
+ version: 4.0.0.rc1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 4.0.0.beta1
96
+ version: 4.0.0.rc1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: tzinfo
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: 0.3.33
103
+ version: 0.3.37
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 0.3.33
110
+ version: 0.3.37
111
111
  description: Web apps on Rails. Simple, battle-tested conventions for building and
112
112
  testing MVC web applications. Works with any Rack-compatible server.
113
113
  email: david@loudthinking.com