hanami 2.1.0.beta1 → 2.1.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -4
  3. data/README.md +1 -1
  4. data/lib/hanami/app.rb +5 -0
  5. data/lib/hanami/config/actions.rb +4 -7
  6. data/lib/hanami/config/assets.rb +84 -0
  7. data/lib/hanami/config/null_config.rb +3 -0
  8. data/lib/hanami/config.rb +17 -5
  9. data/lib/hanami/extensions/action.rb +4 -2
  10. data/lib/hanami/extensions/view/standard_helpers.rb +4 -0
  11. data/lib/hanami/helpers/assets_helper.rb +752 -0
  12. data/lib/hanami/middleware/assets.rb +21 -0
  13. data/lib/hanami/middleware/render_errors.rb +4 -7
  14. data/lib/hanami/providers/assets.rb +44 -0
  15. data/lib/hanami/rake_tasks.rb +19 -18
  16. data/lib/hanami/settings.rb +1 -1
  17. data/lib/hanami/slice.rb +25 -4
  18. data/lib/hanami/version.rb +1 -1
  19. data/lib/hanami.rb +2 -2
  20. data/spec/integration/assets/assets_spec.rb +101 -0
  21. data/spec/integration/assets/serve_static_assets_spec.rb +152 -0
  22. data/spec/integration/logging/exception_logging_spec.rb +115 -0
  23. data/spec/integration/logging/notifications_spec.rb +68 -0
  24. data/spec/integration/logging/request_logging_spec.rb +128 -0
  25. data/spec/integration/rack_app/middleware_spec.rb +4 -4
  26. data/spec/integration/rack_app/rack_app_spec.rb +0 -221
  27. data/spec/integration/rake_tasks_spec.rb +107 -0
  28. data/spec/integration/view/context/assets_spec.rb +3 -9
  29. data/spec/integration/web/render_detailed_errors_spec.rb +17 -0
  30. data/spec/integration/web/render_errors_spec.rb +6 -4
  31. data/spec/support/app_integration.rb +46 -2
  32. data/spec/unit/hanami/config/actions/content_security_policy_spec.rb +24 -36
  33. data/spec/unit/hanami/config/actions/csrf_protection_spec.rb +4 -3
  34. data/spec/unit/hanami/config/actions/default_values_spec.rb +3 -2
  35. data/spec/unit/hanami/env_spec.rb +11 -25
  36. data/spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb +109 -0
  37. data/spec/unit/hanami/helpers/assets_helper/audio_tag_spec.rb +132 -0
  38. data/spec/unit/hanami/helpers/assets_helper/favicon_link_tag_spec.rb +91 -0
  39. data/spec/unit/hanami/helpers/assets_helper/image_tag_spec.rb +92 -0
  40. data/spec/unit/hanami/helpers/assets_helper/javascript_tag_spec.rb +143 -0
  41. data/spec/unit/hanami/helpers/assets_helper/stylesheet_link_tag_spec.rb +126 -0
  42. data/spec/unit/hanami/helpers/assets_helper/video_tag_spec.rb +132 -0
  43. data/spec/unit/hanami/version_spec.rb +1 -1
  44. metadata +32 -4
  45. data/lib/hanami/assets/app_config.rb +0 -61
  46. data/lib/hanami/assets/config.rb +0 -53
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#javascript_tag", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def javascript_tag(...)
18
+ subject.javascript_tag(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ write "app/assets/js/app.ts", <<~JS
48
+ import "../css/app.css";
49
+
50
+ console.log("Hello from index.ts");
51
+ JS
52
+
53
+ write "app/assets/css/app.css", <<~CSS
54
+ .btn {
55
+ background: #f00;
56
+ }
57
+ CSS
58
+
59
+ stub_assets("feature-a.js")
60
+
61
+ require "hanami/setup"
62
+ before_prepare if respond_to?(:before_prepare)
63
+ require "hanami/prepare"
64
+ end
65
+ end
66
+
67
+ it "returns an instance of SafeString" do
68
+ actual = javascript_tag("feature-a")
69
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
70
+ end
71
+
72
+ it "is aliased as `js`" do
73
+ expect(subject.js("feature-a")).to eq javascript_tag("feature-a")
74
+ end
75
+
76
+ it "renders <script> tag" do
77
+ actual = javascript_tag("feature-a")
78
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
79
+ end
80
+
81
+ xit "renders <script> tag without appending ext after query string" do
82
+ actual = javascript_tag("feature-x?callback=init")
83
+ expect(actual).to eq(%(<script src="/assets/feature-x?callback=init" type="text/javascript"></script>))
84
+ end
85
+
86
+ it "renders <script> tag with a defer attribute" do
87
+ actual = javascript_tag("feature-a", defer: true)
88
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" defer="defer"></script>))
89
+ end
90
+
91
+ it "renders <script> tag with an integrity attribute" do
92
+ actual = javascript_tag("feature-a", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")
93
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="anonymous"></script>))
94
+ end
95
+
96
+ it "renders <script> tag with a crossorigin attribute" do
97
+ actual = javascript_tag("feature-a", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC", crossorigin: "use-credentials")
98
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="use-credentials"></script>))
99
+ end
100
+
101
+ it "ignores src passed as an option" do
102
+ actual = javascript_tag("feature-a", src: "wrong")
103
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
104
+ end
105
+
106
+ describe "async option" do
107
+ it "renders <script> tag with an async=true if async option is true" do
108
+ actual = javascript_tag("feature-a", async: true)
109
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript" async="async"></script>))
110
+ end
111
+
112
+ it "renders <script> tag without an async=true if async option is false" do
113
+ actual = javascript_tag("feature-a", async: false)
114
+ expect(actual).to eq(%(<script src="/assets/feature-a.js" type="text/javascript"></script>))
115
+ end
116
+ end
117
+
118
+ describe "subresource_integrity mode" do
119
+ def before_prepare
120
+ Hanami.app.config.assets.subresource_integrity = [:sha384]
121
+ end
122
+
123
+ before { compile_assets! }
124
+
125
+ it "includes subresource_integrity and crossorigin attributes" do
126
+ actual = javascript_tag("app")
127
+ expect(actual).to match(%r{<script src="/assets/app-[A-Z0-9]{8}.js" type="text/javascript" integrity="sha384-[A-Za-z0-9+/]{64}" crossorigin="anonymous"></script>})
128
+ end
129
+ end
130
+
131
+ describe "cdn mode" do
132
+ let(:base_url) { "https://hanami.test" }
133
+
134
+ def before_prepare
135
+ Hanami.app.config.assets.base_url = "https://hanami.test"
136
+ end
137
+
138
+ it "returns absolute url for src attribute" do
139
+ actual = javascript_tag("feature-a")
140
+ expect(actual).to eq(%(<script src="#{base_url}/assets/feature-a.js" type="text/javascript"></script>))
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#stylesheet_link_tag", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def stylesheet_link_tag(...)
18
+ subject.stylesheet_link_tag(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ write "app/assets/js/app.ts", <<~JS
48
+ import "../css/app.css";
49
+
50
+ console.log("Hello from index.ts");
51
+ JS
52
+
53
+ write "app/assets/css/app.css", <<~CSS
54
+ .btn {
55
+ background: #f00;
56
+ }
57
+ CSS
58
+
59
+ stub_assets("main.css")
60
+
61
+ require "hanami/setup"
62
+ before_prepare if respond_to?(:before_prepare)
63
+ require "hanami/prepare"
64
+ end
65
+ end
66
+
67
+ it "returns an instance of SafeString" do
68
+ actual = stylesheet_link_tag("main")
69
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
70
+ end
71
+
72
+ it "is aliased as `css`" do
73
+ expect(subject.css("main")).to eq stylesheet_link_tag("main")
74
+ end
75
+
76
+ it "renders <link> tag" do
77
+ actual = stylesheet_link_tag("main")
78
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet">))
79
+ end
80
+
81
+ xit "renders <link> tag without appending ext after query string" do
82
+ actual = stylesheet_link_tag("fonts?font=Helvetica")
83
+ expect(actual).to eq(%(<link href="/assets/fonts?font=Helvetica" type="text/css" rel="stylesheet">))
84
+ end
85
+
86
+ it "renders <link> tag with an integrity attribute" do
87
+ actual = stylesheet_link_tag("main", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC")
88
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="anonymous">))
89
+ end
90
+
91
+ it "renders <link> tag with a crossorigin attribute" do
92
+ actual = stylesheet_link_tag("main", integrity: "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC", crossorigin: "use-credentials")
93
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet" integrity="sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC" crossorigin="use-credentials">))
94
+ end
95
+
96
+ it "ignores href passed as an option" do
97
+ actual = stylesheet_link_tag("main", href: "wrong")
98
+ expect(actual).to eq(%(<link href="/assets/main.css" type="text/css" rel="stylesheet">))
99
+ end
100
+
101
+ describe "subresource_integrity mode" do
102
+ def before_prepare
103
+ Hanami.app.config.assets.subresource_integrity = [:sha384]
104
+ end
105
+
106
+ before { compile_assets! }
107
+
108
+ it "includes subresource_integrity and crossorigin attributes" do
109
+ actual = stylesheet_link_tag("app")
110
+ expect(actual).to match(%r{<link href="/assets/app-[A-Z0-9]{8}.css" type="text/css" rel="stylesheet" integrity="sha384-[A-Za-z0-9+/]{64}" crossorigin="anonymous">})
111
+ end
112
+ end
113
+
114
+ describe "cdn mode" do
115
+ let(:base_url) { "https://hanami.test" }
116
+
117
+ def before_prepare
118
+ Hanami.app.config.assets.base_url = base_url
119
+ end
120
+
121
+ it "returns absolute url for href attribute" do
122
+ actual = stylesheet_link_tag("main")
123
+ expect(actual).to eq(%(<link href="#{base_url}/assets/main.css" type="text/css" rel="stylesheet">))
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,132 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Hanami::Helpers::AssetsHelper, "#video_tag", :app_integration do
4
+ subject(:obj) {
5
+ helpers = described_class
6
+ Class.new {
7
+ include helpers
8
+
9
+ attr_reader :_context
10
+
11
+ def initialize(context)
12
+ @_context = context
13
+ end
14
+ }.new(context)
15
+ }
16
+
17
+ def video_tag(...)
18
+ subject.video_tag(...)
19
+ end
20
+
21
+ let(:context) { TestApp::Views::Context.new }
22
+ let(:root) { make_tmp_directory }
23
+
24
+ before do
25
+ with_directory(root) do
26
+ write "config/app.rb", <<~RUBY
27
+ module TestApp
28
+ class App < Hanami::App
29
+ config.logger.stream = StringIO.new
30
+ end
31
+ end
32
+ RUBY
33
+
34
+ write "app/views/context.rb", <<~RUBY
35
+ # auto_register: false
36
+
37
+ require "hanami/view/context"
38
+
39
+ module TestApp
40
+ module Views
41
+ class Context < Hanami::View::Context
42
+ end
43
+ end
44
+ end
45
+ RUBY
46
+
47
+ stub_assets("movie.mp4", "movie.en.vtt")
48
+
49
+ require "hanami/setup"
50
+ before_prepare if respond_to?(:before_prepare)
51
+ require "hanami/prepare"
52
+ end
53
+ end
54
+
55
+ it "returns an instance of HtmlBuilder" do
56
+ actual = video_tag("movie.mp4")
57
+ expect(actual).to be_instance_of(::Hanami::View::HTML::SafeString)
58
+ end
59
+
60
+ it "renders <video> tag" do
61
+ actual = video_tag("movie.mp4").to_s
62
+ expect(actual).to eq(%(<video src="/assets/movie.mp4"></video>))
63
+ end
64
+
65
+ it "renders with html attributes" do
66
+ actual = video_tag("movie.mp4", autoplay: true, controls: true).to_s
67
+ expect(actual).to eq(%(<video autoplay="autoplay" controls="controls" src="/assets/movie.mp4"></video>))
68
+ end
69
+
70
+ it "renders with fallback content" do
71
+ actual = video_tag("movie.mp4") do
72
+ "Your browser does not support the video tag"
73
+ end.to_s
74
+
75
+ expect(actual).to eq(%(<video src="/assets/movie.mp4">Your browser does not support the video tag</video>))
76
+ end
77
+
78
+ it "renders with tracks" do
79
+ actual = video_tag("movie.mp4") do
80
+ tag.track kind: "captions", src: subject.asset_url("movie.en.vtt"), srclang: "en", label: "English"
81
+ end.to_s
82
+
83
+ expect(actual).to eq(%(<video src="/assets/movie.mp4"><track kind="captions" src="/assets/movie.en.vtt" srclang="en" label="English"></video>))
84
+ end
85
+
86
+ xit "renders with sources" do
87
+ actual = subject.video do
88
+ tag.text "Your browser does not support the video tag"
89
+ tag.source src: subject.asset_url("movie.mp4"), type: "video/mp4"
90
+ tag.source src: subject.asset_url("movie.ogg"), type: "video/ogg"
91
+ end.to_s
92
+
93
+ expect(actual).to eq(%(<video>Your browser does not support the video tag<source src="/assets/movie.mp4" type="video/mp4"><source src="/assets/movie.ogg" type="video/ogg"></video>))
94
+ end
95
+
96
+ it "raises an exception when no arguments" do
97
+ expect do
98
+ video_tag
99
+ end.to raise_error(
100
+ ArgumentError,
101
+ "You should provide a source via `src` option or with a `source` HTML tag"
102
+ )
103
+ end
104
+
105
+ it "raises an exception when no src and no block" do
106
+ expect do
107
+ video_tag(content: true)
108
+ end.to raise_error(
109
+ ArgumentError,
110
+ "You should provide a source via `src` option or with a `source` HTML tag"
111
+ )
112
+ end
113
+
114
+ describe "cdn mode" do
115
+ let(:base_url) { "https://hanami.test" }
116
+
117
+ def before_prepare
118
+ Hanami.app.config.assets.base_url = "https://hanami.test"
119
+ end
120
+
121
+ it "returns absolute url for src attribute" do
122
+ actual = video_tag("movie.mp4").to_s
123
+ expect(actual).to eq(%(<video src="#{base_url}/assets/movie.mp4"></video>))
124
+ end
125
+ end
126
+
127
+ private
128
+
129
+ def tag(...)
130
+ subject.__send__(:tag, ...)
131
+ end
132
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  RSpec.describe "Hanami::VERSION" do
4
4
  it "returns current version" do
5
- expect(Hanami::VERSION).to eq("2.1.0.beta1")
5
+ expect(Hanami::VERSION).to eq("2.1.0.beta2")
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.beta1
4
+ version: 2.1.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2023-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -255,14 +255,13 @@ files:
255
255
  - hanami.gemspec
256
256
  - lib/hanami.rb
257
257
  - lib/hanami/app.rb
258
- - lib/hanami/assets/app_config.rb
259
- - lib/hanami/assets/config.rb
260
258
  - lib/hanami/boot.rb
261
259
  - lib/hanami/config.rb
262
260
  - lib/hanami/config/actions.rb
263
261
  - lib/hanami/config/actions/content_security_policy.rb
264
262
  - lib/hanami/config/actions/cookies.rb
265
263
  - lib/hanami/config/actions/sessions.rb
264
+ - lib/hanami/config/assets.rb
266
265
  - lib/hanami/config/logger.rb
267
266
  - lib/hanami/config/null_config.rb
268
267
  - lib/hanami/config/router.rb
@@ -282,13 +281,16 @@ files:
282
281
  - lib/hanami/extensions/view/slice_configured_helpers.rb
283
282
  - lib/hanami/extensions/view/slice_configured_view.rb
284
283
  - lib/hanami/extensions/view/standard_helpers.rb
284
+ - lib/hanami/helpers/assets_helper.rb
285
285
  - lib/hanami/helpers/form_helper.rb
286
286
  - lib/hanami/helpers/form_helper/form_builder.rb
287
287
  - lib/hanami/helpers/form_helper/values.rb
288
+ - lib/hanami/middleware/assets.rb
288
289
  - lib/hanami/middleware/public_errors_app.rb
289
290
  - lib/hanami/middleware/render_errors.rb
290
291
  - lib/hanami/port.rb
291
292
  - lib/hanami/prepare.rb
293
+ - lib/hanami/providers/assets.rb
292
294
  - lib/hanami/providers/inflector.rb
293
295
  - lib/hanami/providers/logger.rb
294
296
  - lib/hanami/providers/rack.rb
@@ -319,6 +321,8 @@ files:
319
321
  - spec/integration/action/view_rendering/paired_view_inference_spec.rb
320
322
  - spec/integration/action/view_rendering/view_context_spec.rb
321
323
  - spec/integration/action/view_rendering_spec.rb
324
+ - spec/integration/assets/assets_spec.rb
325
+ - spec/integration/assets/serve_static_assets_spec.rb
322
326
  - spec/integration/code_loading/loading_from_app_spec.rb
323
327
  - spec/integration/code_loading/loading_from_lib_spec.rb
324
328
  - spec/integration/code_loading/loading_from_slice_spec.rb
@@ -333,10 +337,14 @@ files:
333
337
  - spec/integration/container/standard_providers/rack_provider_spec.rb
334
338
  - spec/integration/container/standard_providers_spec.rb
335
339
  - spec/integration/dotenv_loading_spec.rb
340
+ - spec/integration/logging/exception_logging_spec.rb
341
+ - spec/integration/logging/notifications_spec.rb
342
+ - spec/integration/logging/request_logging_spec.rb
336
343
  - spec/integration/rack_app/body_parser_spec.rb
337
344
  - spec/integration/rack_app/middleware_spec.rb
338
345
  - spec/integration/rack_app/non_booted_rack_app_spec.rb
339
346
  - spec/integration/rack_app/rack_app_spec.rb
347
+ - spec/integration/rake_tasks_spec.rb
340
348
  - spec/integration/settings/access_in_slice_class_body_spec.rb
341
349
  - spec/integration/settings/access_to_constants_spec.rb
342
350
  - spec/integration/settings/loading_from_env_spec.rb
@@ -397,6 +405,13 @@ files:
397
405
  - spec/unit/hanami/config/views_spec.rb
398
406
  - spec/unit/hanami/env_spec.rb
399
407
  - spec/unit/hanami/extensions/view/context_spec.rb
408
+ - spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb
409
+ - spec/unit/hanami/helpers/assets_helper/audio_tag_spec.rb
410
+ - spec/unit/hanami/helpers/assets_helper/favicon_link_tag_spec.rb
411
+ - spec/unit/hanami/helpers/assets_helper/image_tag_spec.rb
412
+ - spec/unit/hanami/helpers/assets_helper/javascript_tag_spec.rb
413
+ - spec/unit/hanami/helpers/assets_helper/stylesheet_link_tag_spec.rb
414
+ - spec/unit/hanami/helpers/assets_helper/video_tag_spec.rb
400
415
  - spec/unit/hanami/helpers/form_helper_spec.rb
401
416
  - spec/unit/hanami/port_spec.rb
402
417
  - spec/unit/hanami/router/errors/not_allowed_error_spec.rb
@@ -444,6 +459,8 @@ test_files:
444
459
  - spec/integration/action/view_rendering/paired_view_inference_spec.rb
445
460
  - spec/integration/action/view_rendering/view_context_spec.rb
446
461
  - spec/integration/action/view_rendering_spec.rb
462
+ - spec/integration/assets/assets_spec.rb
463
+ - spec/integration/assets/serve_static_assets_spec.rb
447
464
  - spec/integration/code_loading/loading_from_app_spec.rb
448
465
  - spec/integration/code_loading/loading_from_lib_spec.rb
449
466
  - spec/integration/code_loading/loading_from_slice_spec.rb
@@ -458,10 +475,14 @@ test_files:
458
475
  - spec/integration/container/standard_providers/rack_provider_spec.rb
459
476
  - spec/integration/container/standard_providers_spec.rb
460
477
  - spec/integration/dotenv_loading_spec.rb
478
+ - spec/integration/logging/exception_logging_spec.rb
479
+ - spec/integration/logging/notifications_spec.rb
480
+ - spec/integration/logging/request_logging_spec.rb
461
481
  - spec/integration/rack_app/body_parser_spec.rb
462
482
  - spec/integration/rack_app/middleware_spec.rb
463
483
  - spec/integration/rack_app/non_booted_rack_app_spec.rb
464
484
  - spec/integration/rack_app/rack_app_spec.rb
485
+ - spec/integration/rake_tasks_spec.rb
465
486
  - spec/integration/settings/access_in_slice_class_body_spec.rb
466
487
  - spec/integration/settings/access_to_constants_spec.rb
467
488
  - spec/integration/settings/loading_from_env_spec.rb
@@ -522,6 +543,13 @@ test_files:
522
543
  - spec/unit/hanami/config/views_spec.rb
523
544
  - spec/unit/hanami/env_spec.rb
524
545
  - spec/unit/hanami/extensions/view/context_spec.rb
546
+ - spec/unit/hanami/helpers/assets_helper/asset_url_spec.rb
547
+ - spec/unit/hanami/helpers/assets_helper/audio_tag_spec.rb
548
+ - spec/unit/hanami/helpers/assets_helper/favicon_link_tag_spec.rb
549
+ - spec/unit/hanami/helpers/assets_helper/image_tag_spec.rb
550
+ - spec/unit/hanami/helpers/assets_helper/javascript_tag_spec.rb
551
+ - spec/unit/hanami/helpers/assets_helper/stylesheet_link_tag_spec.rb
552
+ - spec/unit/hanami/helpers/assets_helper/video_tag_spec.rb
525
553
  - spec/unit/hanami/helpers/form_helper_spec.rb
526
554
  - spec/unit/hanami/port_spec.rb
527
555
  - spec/unit/hanami/router/errors/not_allowed_error_spec.rb
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/configurable"
4
-
5
- module Hanami
6
- # @api private
7
- module Assets
8
- # App config for assets.
9
- #
10
- # This is NOT RELEASED as of 2.0.0.
11
- #
12
- # @api private
13
- class AppConfig
14
- include Dry::Configurable
15
-
16
- attr_reader :base_config
17
- protected :base_config
18
-
19
- setting :server_url, default: "http://localhost:8080"
20
-
21
- def initialize(*)
22
- super
23
-
24
- @base_config = Assets::Config.new
25
- end
26
-
27
- def initialize_copy(source)
28
- super
29
- @base_config = source.base_config.dup
30
- end
31
-
32
- def finalize!
33
- end
34
-
35
- # Returns the list of available settings
36
- #
37
- # @return [Set]
38
- #
39
- # @api private
40
- def settings
41
- base_config.settings + self.class.settings
42
- end
43
-
44
- private
45
-
46
- def method_missing(name, *args, &block)
47
- if config.respond_to?(name)
48
- config.public_send(name, *args, &block)
49
- elsif base_config.respond_to?(name)
50
- base_config.public_send(name, *args, &block)
51
- else
52
- super
53
- end
54
- end
55
-
56
- def respond_to_missing?(name, _incude_all = false)
57
- config.respond_to?(name) || base_config.respond_to?(name) || super
58
- end
59
- end
60
- end
61
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/configurable"
4
-
5
- module Hanami
6
- module Assets
7
- # App config for assets.
8
- #
9
- # This is NOT RELEASED as of 2.0.0.
10
- #
11
- # @api private
12
- class Config
13
- include Dry::Configurable
14
-
15
- # Initialize the Config
16
- #
17
- # @yield [config] the config object
18
- #
19
- # @return [Config]
20
- #
21
- # @since 2.0.0
22
- # @api private
23
- def initialize(*)
24
- super
25
- yield self if block_given?
26
- end
27
-
28
- # Returns the list of available settings
29
- #
30
- # @return [Set]
31
- #
32
- # @since 2.0.0
33
- # @api private
34
- def settings
35
- self.class.settings
36
- end
37
-
38
- private
39
-
40
- def method_missing(name, *args, &block)
41
- if config.respond_to?(name)
42
- config.public_send(name, *args, &block)
43
- else
44
- super
45
- end
46
- end
47
-
48
- def respond_to_missing?(name, _incude_all = false)
49
- config.respond_to?(name) || super
50
- end
51
- end
52
- end
53
- end