padrino-helpers 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51a50e7f371f332ea78163dcfb0bbe826f29e9a300731c71b7591dfef4515f16
4
- data.tar.gz: 2bfcef2d07e371a896c4287e9870d939dd6a7a4d4c3f049ccfb29724e96cfbfe
3
+ metadata.gz: c12f2019f3e69560b4ce45bdfb0421534a0c43302a15a61a4b9db81268ed3f74
4
+ data.tar.gz: 37f53a1e904baf5a3563ca02183205a73f04ea595dcdcd5ad9ee59c21dacb55e
5
5
  SHA512:
6
- metadata.gz: 65cdd233db5732c6561f6bd386efad8e3cd798b37e0497c87b79d69d8bf104bb54c0ec4294eddf456eb6fba8fc3dfef97604634ba652415a9d8677f9d3a0e9d9
7
- data.tar.gz: d6cd233e716c7cbf85e2b76635ed7620c9f2d1a984af95d8b553b995b78c0716e10bc54e363f2feaa396b4abe17fd53f89d58385c2a73667bd199a373a61db94
6
+ metadata.gz: 42648c4bb1307fa37cb21171159d87d2a7874df9531bc3cf988808978e2ea2fff2dc955ce9bcd086813d5dc884764a06d04341b5230bd9926aff7cc6187404db
7
+ data.tar.gz: 739b375bf67383b10d6478e89501ae5093c29e98fd22e9131a03eee1d1e45e4aa1d5c28181a1dc26c398201fa3e41cf90dc5f7227d03f76099f2d9895c02f186
@@ -349,6 +349,10 @@ module Padrino
349
349
  public_path = self.class.public_folder if self.class.respond_to?(:public_folder)
350
350
  public_path ||= Padrino.root('public') if Padrino.respond_to?(:root)
351
351
  public_file_path = File.join(public_path, file_path) if public_path
352
+ unless public_file_path && File.exist?(public_file_path)
353
+ shared_path = self.class.shared_public_folder if self.class.respond_to?(:shared_public_folder)
354
+ public_file_path = File.join(shared_path, file_path) if shared_path
355
+ end
352
356
  stamp = File.mtime(public_file_path).to_i if public_file_path && File.exist?(public_file_path)
353
357
  stamp ||= Time.now.to_i
354
358
  "?#{stamp}"
@@ -0,0 +1,40 @@
1
+ require_relative 'helper'
2
+ require 'minitest/mock'
3
+ require 'padrino-core'
4
+
5
+ describe 'AssetTagHelpers for an app mounted under a sub-path' do
6
+ after do
7
+ Object.send(:remove_const, :StampedSubApp) if defined?(::StampedSubApp)
8
+ Padrino.clear!
9
+ end
10
+
11
+ it 'should stamp an asset from the shared public folder when public/<uri_root> lacks it' do
12
+ Dir.mktmpdir do |root|
13
+ FileUtils.mkdir_p(File.join(root, 'public', 'myapp'))
14
+ css = File.join(root, 'public', 'stylesheets', 'site.css')
15
+ FileUtils.mkdir_p(File.dirname(css))
16
+ File.write(css, 'body {}')
17
+ File.utime(Time.at(1_577_836_800), Time.at(1_577_836_800), css)
18
+ Padrino.stub(:root, proc { |*args| File.expand_path(File.join(root, *args)) }) do
19
+ ::StampedSubApp = Class.new(Padrino::Application) do
20
+ register Padrino::Helpers
21
+ get('/tag') { stylesheet_link_tag('site') }
22
+ end
23
+ Padrino.mount('stamped_sub_app', app_file: __FILE__).to('/myapp')
24
+ res = Rack::MockRequest.new(Padrino.application).get('/myapp/tag')
25
+ assert_includes res.body, 'site.css?1577836800'
26
+ end
27
+ end
28
+ end
29
+
30
+ it 'should stamp assets in a standalone Sinatra app that registers Padrino::Routing' do
31
+ app = Class.new(Sinatra::Base) do
32
+ register Padrino::Routing
33
+ register Padrino::Helpers
34
+ get('/tag') { stylesheet_link_tag('nope') }
35
+ end
36
+ res = Rack::MockRequest.new(app).get('/tag')
37
+ assert_equal 200, res.status
38
+ assert_match(/nope\.css\?\d+/, res.body)
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2026-10-14 00:00:00.000000000 Z
14
+ date: 2026-10-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-support
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.17.0
22
+ version: 0.18.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.17.0
29
+ version: 0.18.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: tilt
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -225,6 +225,7 @@ files:
225
225
  - test/test_format_helpers.rb
226
226
  - test/test_helpers.rb
227
227
  - test/test_locale.rb
228
+ - test/test_mounted_asset_stamp.rb
228
229
  - test/test_number_helpers.rb
229
230
  - test/test_output_helpers.rb
230
231
  - test/test_render_helpers.rb
@@ -251,109 +252,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
252
  - !ruby/object:Gem::Version
252
253
  version: 1.3.6
253
254
  requirements: []
254
- rubygems_version: 3.5.23
255
+ rubygems_version: 3.5.22
255
256
  signing_key:
256
257
  specification_version: 4
257
258
  summary: Helpers for padrino
258
- test_files:
259
- - test/fixtures/apps/.components
260
- - test/fixtures/apps/.gitignore
261
- - test/fixtures/apps/render.rb
262
- - test/fixtures/apps/views/article/comment/show.slim
263
- - test/fixtures/apps/views/blog/post.erb
264
- - test/fixtures/apps/views/layouts/specific.erb
265
- - test/fixtures/apps/views/test/post.erb
266
- - test/fixtures/layouts/layout.erb
267
- - test/fixtures/markup_app/app.rb
268
- - test/fixtures/markup_app/views/button_to.erb
269
- - test/fixtures/markup_app/views/button_to.haml
270
- - test/fixtures/markup_app/views/button_to.slim
271
- - test/fixtures/markup_app/views/capture_concat.erb
272
- - test/fixtures/markup_app/views/capture_concat.haml
273
- - test/fixtures/markup_app/views/capture_concat.slim
274
- - test/fixtures/markup_app/views/content_for.erb
275
- - test/fixtures/markup_app/views/content_for.haml
276
- - test/fixtures/markup_app/views/content_for.slim
277
- - test/fixtures/markup_app/views/content_tag.erb
278
- - test/fixtures/markup_app/views/content_tag.haml
279
- - test/fixtures/markup_app/views/content_tag.slim
280
- - test/fixtures/markup_app/views/current_engine.erb
281
- - test/fixtures/markup_app/views/current_engine.haml
282
- - test/fixtures/markup_app/views/current_engine.slim
283
- - test/fixtures/markup_app/views/fields_for.erb
284
- - test/fixtures/markup_app/views/fields_for.haml
285
- - test/fixtures/markup_app/views/fields_for.slim
286
- - test/fixtures/markup_app/views/form_for.erb
287
- - test/fixtures/markup_app/views/form_for.haml
288
- - test/fixtures/markup_app/views/form_for.slim
289
- - test/fixtures/markup_app/views/form_tag.erb
290
- - test/fixtures/markup_app/views/form_tag.haml
291
- - test/fixtures/markup_app/views/form_tag.slim
292
- - test/fixtures/markup_app/views/link_to.erb
293
- - test/fixtures/markup_app/views/link_to.haml
294
- - test/fixtures/markup_app/views/link_to.slim
295
- - test/fixtures/markup_app/views/mail_to.erb
296
- - test/fixtures/markup_app/views/mail_to.haml
297
- - test/fixtures/markup_app/views/mail_to.slim
298
- - test/fixtures/markup_app/views/meta_tag.erb
299
- - test/fixtures/markup_app/views/meta_tag.haml
300
- - test/fixtures/markup_app/views/meta_tag.slim
301
- - test/fixtures/markup_app/views/partials/_erb.erb
302
- - test/fixtures/markup_app/views/partials/_haml.haml
303
- - test/fixtures/markup_app/views/partials/_slim.slim
304
- - test/fixtures/markup_app/views/simple_partial.erb
305
- - test/fixtures/markup_app/views/simple_partial.haml
306
- - test/fixtures/markup_app/views/simple_partial.slim
307
- - test/fixtures/render_app/app.rb
308
- - test/fixtures/render_app/views/_deep.erb
309
- - test/fixtures/render_app/views/_deep.haml
310
- - test/fixtures/render_app/views/_deep.slim
311
- - test/fixtures/render_app/views/_foo.haml
312
- - test/fixtures/render_app/views/_partial_block_erb.erb
313
- - test/fixtures/render_app/views/_partial_block_haml.haml
314
- - test/fixtures/render_app/views/_partial_block_slim.slim
315
- - test/fixtures/render_app/views/_unsafe.html.builder
316
- - test/fixtures/render_app/views/_unsafe_object.html.builder
317
- - test/fixtures/render_app/views/current_engine.haml
318
- - test/fixtures/render_app/views/current_engines/_erb.erb
319
- - test/fixtures/render_app/views/current_engines/_haml.haml
320
- - test/fixtures/render_app/views/current_engines/_slim.slim
321
- - test/fixtures/render_app/views/dive_inner_erb.erb
322
- - test/fixtures/render_app/views/dive_inner_haml.haml
323
- - test/fixtures/render_app/views/dive_inner_slim.slim
324
- - test/fixtures/render_app/views/dive_outer_erb.erb
325
- - test/fixtures/render_app/views/dive_outer_haml.haml
326
- - test/fixtures/render_app/views/dive_outer_slim.slim
327
- - test/fixtures/render_app/views/double_capture_erb.erb
328
- - test/fixtures/render_app/views/double_capture_haml.haml
329
- - test/fixtures/render_app/views/double_capture_slim.slim
330
- - test/fixtures/render_app/views/erb/test.erb
331
- - test/fixtures/render_app/views/explicit_engine.haml
332
- - test/fixtures/render_app/views/haml/test.haml
333
- - test/fixtures/render_app/views/index.haml
334
- - test/fixtures/render_app/views/layouts/application.haml
335
- - test/fixtures/render_app/views/render_block_erb.erb
336
- - test/fixtures/render_app/views/render_block_haml.haml
337
- - test/fixtures/render_app/views/render_block_slim.slim
338
- - test/fixtures/render_app/views/ruby_block_capture_erb.erb
339
- - test/fixtures/render_app/views/ruby_block_capture_haml.haml
340
- - test/fixtures/render_app/views/ruby_block_capture_slim.slim
341
- - test/fixtures/render_app/views/template/_user.haml
342
- - test/fixtures/render_app/views/template/haml_template.haml
343
- - test/fixtures/render_app/views/template/some_template.haml
344
- - test/fixtures/render_app/views/wrong_capture_erb.erb
345
- - test/fixtures/render_app/views/wrong_capture_haml.haml
346
- - test/fixtures/render_app/views/wrong_capture_slim.slim
347
- - test/helper.rb
348
- - test/test_asset_tag_helpers.rb
349
- - test/test_form_builder.rb
350
- - test/test_form_helpers.rb
351
- - test/test_format_helpers.rb
352
- - test/test_helpers.rb
353
- - test/test_locale.rb
354
- - test/test_number_helpers.rb
355
- - test/test_output_helpers.rb
356
- - test/test_render_helpers.rb
357
- - test/test_rendering.rb
358
- - test/test_rendering_extensions.rb
359
- - test/test_tag_helpers.rb
259
+ test_files: []