actionpack 3.2.22.1 → 3.2.22.2

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.

@@ -147,12 +147,11 @@ module AbstractController
147
147
  options = action
148
148
  when String, Symbol
149
149
  action = action.to_s
150
- key = action.include?(?/) ? :file : :action
150
+ key = action.include?(?/) ? :app_template_file : :action
151
151
  options[key] = action
152
152
  else
153
153
  options[:partial] = action
154
154
  end
155
-
156
155
  options
157
156
  end
158
157
 
@@ -3,7 +3,7 @@ module ActionPack
3
3
  MAJOR = 3
4
4
  MINOR = 2
5
5
  TINY = 22
6
- PRE = "1"
6
+ PRE = "2"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
9
9
  end
@@ -127,6 +127,10 @@ module ActionView
127
127
  @view_paths.find_all(*args_for_lookup(name, prefixes, partial, keys, options))
128
128
  end
129
129
 
130
+ def find_file(name, prefixes = [], partial = false, keys = [], options = {})
131
+ @view_paths.find_file(*args_for_lookup(name, prefixes, partial, keys, options))
132
+ end
133
+
130
134
  def exists?(name, prefixes = [], partial = false, keys = [], options = {})
131
135
  @view_paths.exists?(*args_for_lookup(name, prefixes, partial, keys, options))
132
136
  end
@@ -58,23 +58,35 @@ module ActionView #:nodoc:
58
58
  find_all(*args).first || raise(MissingTemplate.new(self, *args))
59
59
  end
60
60
 
61
+ def find_file(path, prefixes = [], *args)
62
+ _find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args))
63
+ end
64
+
61
65
  def find_all(path, prefixes = [], *args)
66
+ _find_all path, prefixes, args, false
67
+ end
68
+
69
+ def exists?(path, prefixes, *args)
70
+ find_all(path, prefixes, *args).any?
71
+ end
72
+
73
+ private
74
+
75
+ def _find_all(path, prefixes, args, outside_app)
62
76
  prefixes = [prefixes] if String === prefixes
63
77
  prefixes.each do |prefix|
64
78
  paths.each do |resolver|
65
- templates = resolver.find_all(path, prefix, *args)
79
+ if outside_app
80
+ templates = resolver.find_all_anywhere(path, prefix, *args)
81
+ else
82
+ templates = resolver.find_all(path, prefix, *args)
83
+ end
66
84
  return templates unless templates.empty?
67
85
  end
68
86
  end
69
87
  []
70
88
  end
71
89
 
72
- def exists?(path, prefixes, *args)
73
- find_all(path, prefixes, *args).any?
74
- end
75
-
76
- private
77
-
78
90
  def typecast(paths)
79
91
  paths.map do |path|
80
92
  case path
@@ -1,6 +1,6 @@
1
1
  module ActionView
2
2
  class AbstractRenderer #:nodoc:
3
- delegate :find_template, :template_exists?, :with_fallbacks, :update_details,
3
+ delegate :find_template, :find_file, :template_exists?, :with_fallbacks, :update_details,
4
4
  :with_layout_format, :formats, :to => :@lookup_context
5
5
 
6
6
  def initialize(lookup_context)
@@ -11,6 +11,11 @@ module ActionView
11
11
 
12
12
  # Main render entry point shared by AV and AC.
13
13
  def render(context, options)
14
+ if (options.is_a?(HashWithIndifferentAccess) && !options.respond_to?(:permitted?)) ||
15
+ (options.respond_to?(:permitted?) && !options.permitted?)
16
+ raise ArgumentError, "render parameters are not permitted"
17
+ end
18
+
14
19
  if options.key?(:partial)
15
20
  render_partial(context, options)
16
21
  else
@@ -21,11 +21,12 @@ module ActionView
21
21
  # Determine the template to be rendered using the given options.
22
22
  def determine_template(options) #:nodoc:
23
23
  keys = options[:locals].try(:keys) || []
24
-
25
24
  if options.key?(:text)
26
25
  Template::Text.new(options[:text], formats.try(:first))
26
+ elsif options.key?(:app_template_file)
27
+ find_template(options[:app_template_file], nil, false, keys, @details)
27
28
  elsif options.key?(:file)
28
- with_fallbacks { find_template(options[:file], nil, false, keys, @details) }
29
+ with_fallbacks { find_file(options[:file], nil, false, keys, @details) }
29
30
  elsif options.key?(:inline)
30
31
  handler = Template.handler_for_extension(options[:type] || "erb")
31
32
  Template.new(options[:inline], "inline template", handler, :locals => keys)
@@ -43,7 +43,13 @@ module ActionView
43
43
  # Normalizes the arguments and passes it on to find_template.
44
44
  def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
45
45
  cached(key, [name, prefix, partial], details, locals) do
46
- find_templates(name, prefix, partial, details)
46
+ find_templates(name, prefix, partial, details, false)
47
+ end
48
+ end
49
+
50
+ def find_all_anywhere(name, prefix, partial=false, details={}, key=nil, locals=[])
51
+ cached(key, [name, prefix, partial], details, locals) do
52
+ find_templates(name, prefix, partial, details, true)
47
53
  end
48
54
  end
49
55
 
@@ -54,8 +60,8 @@ module ActionView
54
60
  # This is what child classes implement. No defaults are needed
55
61
  # because Resolver guarantees that the arguments are present and
56
62
  # normalized.
57
- def find_templates(name, prefix, partial, details)
58
- raise NotImplementedError, "Subclasses must implement a find_templates(name, prefix, partial, details) method"
63
+ def find_templates(name, prefix, partial, details, outside_app_allowed = false)
64
+ raise NotImplementedError, "Subclasses must implement a find_templates(name, prefix, partial, details, outside_app_allowed) method"
59
65
  end
60
66
 
61
67
  # Helpers that builds a path. Useful for building virtual paths.
@@ -110,24 +116,21 @@ module ActionView
110
116
  super()
111
117
  end
112
118
 
113
- cattr_accessor :allow_external_files, instance_reader: false, instance_writer: false
114
- self.allow_external_files = false
119
+ cattr_accessor :instance_reader => false, :instance_writer => false
115
120
 
116
121
  private
117
122
 
118
- def find_templates(name, prefix, partial, details)
123
+ def find_templates(name, prefix, partial, details, outside_app_allowed = false)
119
124
  path = Path.build(name, prefix, partial)
120
- query(path, details, details[:formats])
125
+ query(path, details, details[:formats], outside_app_allowed)
121
126
  end
122
127
 
123
- def query(path, details, formats)
128
+ def query(path, details, formats, outside_app_allowed)
124
129
  query = build_query(path, details)
125
130
 
126
131
  template_paths = find_template_paths query
127
132
 
128
- unless self.class.allow_external_files
129
- template_paths = reject_files_external_to_app(template_paths)
130
- end
133
+ template_paths = reject_files_external_to_app(template_paths) unless outside_app_allowed
131
134
 
132
135
  template_paths.map { |template|
133
136
  handler, format = extract_handler_and_format(template, formats)
@@ -267,7 +270,12 @@ module ActionView
267
270
  class OptimizedFileSystemResolver < FileSystemResolver #:nodoc:
268
271
  def build_query(path, details)
269
272
  exts = EXTENSIONS.map { |ext| details[ext] }
270
- query = escape_entry(File.join(@path, path))
273
+
274
+ if path.to_s.starts_with? @path.to_s
275
+ query = escape_entry(path)
276
+ else
277
+ query = escape_entry(File.join(@path, path))
278
+ end
271
279
 
272
280
  query + exts.map { |ext|
273
281
  "{#{ext.compact.uniq.map { |e| ".#{e}," }.join}}"
@@ -19,7 +19,7 @@ module ActionView #:nodoc:
19
19
 
20
20
  private
21
21
 
22
- def query(path, exts, formats)
22
+ def query(path, exts, formats, outside_app_allowed)
23
23
  query = ""
24
24
  EXTENSIONS.each do |ext|
25
25
  query << '(' << exts[ext].map {|e| e && Regexp.escape(".#{e}") }.join('|') << '|)'
@@ -40,11 +40,10 @@ module ActionView #:nodoc:
40
40
  end
41
41
 
42
42
  class NullResolver < PathResolver
43
- def query(path, exts, formats)
43
+ def query(path, exts, formats, outside_app_allowed)
44
44
  handler, format = extract_handler_and_format(path, formats)
45
45
  [ActionView::Template.new("Template generated by Null Resolver", path, handler, :virtual_path => path, :format => format)]
46
46
  end
47
47
  end
48
48
 
49
49
  end
50
-
metadata CHANGED
@@ -1,153 +1,174 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.22.1
4
+ version: 3.2.22.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - David Heinemeier Hansson
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
12
+ date: 2016-02-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - '='
18
20
  - !ruby/object:Gem::Version
19
- version: 3.2.22.1
21
+ version: 3.2.22.2
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - '='
25
28
  - !ruby/object:Gem::Version
26
- version: 3.2.22.1
29
+ version: 3.2.22.2
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: activemodel
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - '='
32
36
  - !ruby/object:Gem::Version
33
- version: 3.2.22.1
37
+ version: 3.2.22.2
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - '='
39
44
  - !ruby/object:Gem::Version
40
- version: 3.2.22.1
45
+ version: 3.2.22.2
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rack-cache
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
53
  version: '1.2'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
61
  version: '1.2'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: builder
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - "~>"
67
+ - - ~>
60
68
  - !ruby/object:Gem::Version
61
69
  version: 3.0.0
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - "~>"
75
+ - - ~>
67
76
  - !ruby/object:Gem::Version
68
77
  version: 3.0.0
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: rack
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - "~>"
83
+ - - ~>
74
84
  - !ruby/object:Gem::Version
75
85
  version: 1.4.5
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - "~>"
91
+ - - ~>
81
92
  - !ruby/object:Gem::Version
82
93
  version: 1.4.5
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rack-test
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - "~>"
99
+ - - ~>
88
100
  - !ruby/object:Gem::Version
89
101
  version: 0.6.1
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - "~>"
107
+ - - ~>
95
108
  - !ruby/object:Gem::Version
96
109
  version: 0.6.1
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: journey
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - "~>"
115
+ - - ~>
102
116
  - !ruby/object:Gem::Version
103
117
  version: 1.0.4
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - "~>"
123
+ - - ~>
109
124
  - !ruby/object:Gem::Version
110
125
  version: 1.0.4
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: sprockets
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - "~>"
131
+ - - ~>
116
132
  - !ruby/object:Gem::Version
117
133
  version: 2.2.1
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - "~>"
139
+ - - ~>
123
140
  - !ruby/object:Gem::Version
124
141
  version: 2.2.1
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: erubis
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - "~>"
147
+ - - ~>
130
148
  - !ruby/object:Gem::Version
131
149
  version: 2.7.0
132
150
  type: :runtime
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - "~>"
155
+ - - ~>
137
156
  - !ruby/object:Gem::Version
138
157
  version: 2.7.0
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: tzinfo
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - "~>"
163
+ - - ~>
144
164
  - !ruby/object:Gem::Version
145
165
  version: 0.3.29
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - "~>"
171
+ - - ~>
151
172
  - !ruby/object:Gem::Version
152
173
  version: 0.3.29
153
174
  description: Web apps on Rails. Simple, battle-tested conventions for building and
@@ -158,9 +179,8 @@ extensions: []
158
179
  extra_rdoc_files: []
159
180
  files:
160
181
  - CHANGELOG.md
161
- - MIT-LICENSE
162
182
  - README.rdoc
163
- - lib/abstract_controller.rb
183
+ - MIT-LICENSE
164
184
  - lib/abstract_controller/asset_paths.rb
165
185
  - lib/abstract_controller/base.rb
166
186
  - lib/abstract_controller/callbacks.rb
@@ -173,18 +193,17 @@ files:
173
193
  - lib/abstract_controller/translation.rb
174
194
  - lib/abstract_controller/url_for.rb
175
195
  - lib/abstract_controller/view_paths.rb
176
- - lib/action_controller.rb
196
+ - lib/abstract_controller.rb
177
197
  - lib/action_controller/base.rb
178
- - lib/action_controller/caching.rb
179
198
  - lib/action_controller/caching/actions.rb
180
199
  - lib/action_controller/caching/fragments.rb
181
200
  - lib/action_controller/caching/pages.rb
182
201
  - lib/action_controller/caching/sweeping.rb
183
- - lib/action_controller/deprecated.rb
202
+ - lib/action_controller/caching.rb
184
203
  - lib/action_controller/deprecated/integration_test.rb
185
204
  - lib/action_controller/deprecated/performance_test.rb
205
+ - lib/action_controller/deprecated.rb
186
206
  - lib/action_controller/log_subscriber.rb
187
- - lib/action_controller/metal.rb
188
207
  - lib/action_controller/metal/compatibility.rb
189
208
  - lib/action_controller/metal/conditional_get.rb
190
209
  - lib/action_controller/metal/cookies.rb
@@ -211,19 +230,20 @@ files:
211
230
  - lib/action_controller/metal/streaming.rb
212
231
  - lib/action_controller/metal/testing.rb
213
232
  - lib/action_controller/metal/url_for.rb
233
+ - lib/action_controller/metal.rb
214
234
  - lib/action_controller/middleware.rb
215
235
  - lib/action_controller/railtie.rb
216
236
  - lib/action_controller/railties/paths.rb
217
237
  - lib/action_controller/record_identifier.rb
218
238
  - lib/action_controller/test_case.rb
219
- - lib/action_controller/vendor/html-scanner.rb
220
239
  - lib/action_controller/vendor/html-scanner/html/document.rb
221
240
  - lib/action_controller/vendor/html-scanner/html/node.rb
222
241
  - lib/action_controller/vendor/html-scanner/html/sanitizer.rb
223
242
  - lib/action_controller/vendor/html-scanner/html/selector.rb
224
243
  - lib/action_controller/vendor/html-scanner/html/tokenizer.rb
225
244
  - lib/action_controller/vendor/html-scanner/html/version.rb
226
- - lib/action_dispatch.rb
245
+ - lib/action_controller/vendor/html-scanner.rb
246
+ - lib/action_controller.rb
227
247
  - lib/action_dispatch/http/cache.rb
228
248
  - lib/action_dispatch/http/filter_parameters.rb
229
249
  - lib/action_dispatch/http/headers.rb
@@ -267,33 +287,32 @@ files:
267
287
  - lib/action_dispatch/middleware/templates/rescues/template_error.erb
268
288
  - lib/action_dispatch/middleware/templates/rescues/unknown_action.erb
269
289
  - lib/action_dispatch/railtie.rb
270
- - lib/action_dispatch/routing.rb
271
290
  - lib/action_dispatch/routing/mapper.rb
272
291
  - lib/action_dispatch/routing/polymorphic_routes.rb
273
292
  - lib/action_dispatch/routing/redirection.rb
274
293
  - lib/action_dispatch/routing/route_set.rb
275
294
  - lib/action_dispatch/routing/routes_proxy.rb
276
295
  - lib/action_dispatch/routing/url_for.rb
277
- - lib/action_dispatch/testing/assertions.rb
296
+ - lib/action_dispatch/routing.rb
278
297
  - lib/action_dispatch/testing/assertions/dom.rb
279
298
  - lib/action_dispatch/testing/assertions/response.rb
280
299
  - lib/action_dispatch/testing/assertions/routing.rb
281
300
  - lib/action_dispatch/testing/assertions/selector.rb
282
301
  - lib/action_dispatch/testing/assertions/tag.rb
302
+ - lib/action_dispatch/testing/assertions.rb
283
303
  - lib/action_dispatch/testing/integration.rb
284
304
  - lib/action_dispatch/testing/performance_test.rb
285
305
  - lib/action_dispatch/testing/test_process.rb
286
306
  - lib/action_dispatch/testing/test_request.rb
287
307
  - lib/action_dispatch/testing/test_response.rb
288
- - lib/action_pack.rb
308
+ - lib/action_dispatch.rb
289
309
  - lib/action_pack/version.rb
290
- - lib/action_view.rb
310
+ - lib/action_pack.rb
291
311
  - lib/action_view/asset_paths.rb
292
312
  - lib/action_view/base.rb
293
313
  - lib/action_view/buffers.rb
294
314
  - lib/action_view/context.rb
295
315
  - lib/action_view/flows.rb
296
- - lib/action_view/helpers.rb
297
316
  - lib/action_view/helpers/active_model_helper.rb
298
317
  - lib/action_view/helpers/asset_paths.rb
299
318
  - lib/action_view/helpers/asset_tag_helper.rb
@@ -321,6 +340,7 @@ files:
321
340
  - lib/action_view/helpers/text_helper.rb
322
341
  - lib/action_view/helpers/translation_helper.rb
323
342
  - lib/action_view/helpers/url_helper.rb
343
+ - lib/action_view/helpers.rb
324
344
  - lib/action_view/locale/en.yml
325
345
  - lib/action_view/log_subscriber.rb
326
346
  - lib/action_view/lookup_context.rb
@@ -331,46 +351,51 @@ files:
331
351
  - lib/action_view/renderer/renderer.rb
332
352
  - lib/action_view/renderer/streaming_template_renderer.rb
333
353
  - lib/action_view/renderer/template_renderer.rb
334
- - lib/action_view/template.rb
335
354
  - lib/action_view/template/error.rb
336
- - lib/action_view/template/handlers.rb
337
355
  - lib/action_view/template/handlers/builder.rb
338
356
  - lib/action_view/template/handlers/erb.rb
357
+ - lib/action_view/template/handlers.rb
339
358
  - lib/action_view/template/resolver.rb
340
359
  - lib/action_view/template/text.rb
360
+ - lib/action_view/template.rb
341
361
  - lib/action_view/test_case.rb
342
362
  - lib/action_view/testing/resolvers.rb
363
+ - lib/action_view.rb
343
364
  - lib/sprockets/assets.rake
344
365
  - lib/sprockets/bootstrap.rb
345
366
  - lib/sprockets/compressors.rb
346
- - lib/sprockets/helpers.rb
347
367
  - lib/sprockets/helpers/isolated_helper.rb
348
368
  - lib/sprockets/helpers/rails_helper.rb
369
+ - lib/sprockets/helpers.rb
349
370
  - lib/sprockets/railtie.rb
350
371
  - lib/sprockets/static_compiler.rb
351
372
  homepage: http://www.rubyonrails.org
352
373
  licenses:
353
374
  - MIT
354
- metadata: {}
355
375
  post_install_message:
356
376
  rdoc_options: []
357
377
  require_paths:
358
378
  - lib
359
379
  required_ruby_version: !ruby/object:Gem::Requirement
380
+ none: false
360
381
  requirements:
361
- - - ">="
382
+ - - ! '>='
362
383
  - !ruby/object:Gem::Version
363
384
  version: 1.8.7
364
385
  required_rubygems_version: !ruby/object:Gem::Requirement
386
+ none: false
365
387
  requirements:
366
- - - ">="
388
+ - - ! '>='
367
389
  - !ruby/object:Gem::Version
368
390
  version: '0'
391
+ segments:
392
+ - 0
393
+ hash: 1698012621721626715
369
394
  requirements:
370
395
  - none
371
396
  rubyforge_project:
372
- rubygems_version: 2.5.1
397
+ rubygems_version: 1.8.23.2
373
398
  signing_key:
374
- specification_version: 4
399
+ specification_version: 3
375
400
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
376
401
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 8f81786e02adf6e3a78e5ce661cd08e6b0c0b428
4
- data.tar.gz: d3b8c6df5d3a0b05ea9eed8489b7b056f03d139d
5
- SHA512:
6
- metadata.gz: 07fae5ccd71863bf5b5bb24215e707722db0c0af5447daaa21c4452a0e6ac5272a522073a588cc037ddfcb5ea11c393d166208e57fbe99b387bd6ba5cf30bae0
7
- data.tar.gz: 44ed5a30d711d7e80b5ef4114bf413a69398911039e1b155a504380f3bed5bf93ec0133a3b7ca1ad35bad6286b8a166a3b5fa55589a3c69009e18f7285edaed3