hanami 2.1.0.rc3 → 2.1.1

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: f126bd2f756323d71dfe0eedd34a45f998882fd1ef2e0afcc8d05c27de224e3a
4
- data.tar.gz: c9b360c13dbb7ce88e935df753a4d9ec4234f02bc625c403664fb44617ff6261
3
+ metadata.gz: 190712bdfa529ad5769aa5effd9335e436b067cd91b6a109a3aa9a4718a73507
4
+ data.tar.gz: 353ccb232425a07133e981d5d8ae6c6906f49cb48d38d7f2b55dc4e28a9c797b
5
5
  SHA512:
6
- metadata.gz: ef015d93dfbd94b0f0617cc0966f1d081e06859b2559de39c3b180dc9afc9d0e9034d53dc66117ea7305e80afd8f643a4204246dcba202da8f3c49b59c108426
7
- data.tar.gz: bced4c311fbcf6ee66e3036cb70fd9f9edc7cb897f6ff26eca660b30a94629297ec5abc3dfb5c849d04f682f66d45e0c2aa55b46829b9ce7b5edeef80a3e9247
6
+ metadata.gz: 4a4e7e1885c9b3eb494863b63f4d376739d6736764b435b83ce75e9a1bb68340681a26bea3883ed20c679e4d88bf99b3d487ae40e2e80f0fb15adb99acfa561d
7
+ data.tar.gz: 8fe1a9d8f9f7372d67ee3f7b9c6e55b0e1aa59acbaee7264028d876dd5cd7b586f147ae08cd268d67c923d5028344bf37868d190cd2d56229932db56828dcce1
data/CHANGELOG.md CHANGED
@@ -2,15 +2,28 @@
2
2
 
3
3
  The web, with simplicity.
4
4
 
5
+ ## v2.1.1 - 2024-05-12
6
+
7
+ ### Fixed
8
+
9
+ - [Tim Riley] Ensure Rack logging continues to work when upgrading to dry-logger 1.0.4 (#1384)
10
+
11
+ ## v2.1.0 - 2024-02-27
12
+
13
+ ### Changed
14
+
15
+ - [Pat Allan] Pass keyword arguments through to configured middleware
16
+ - [Tim Riley] Expect underscored slice names in `public/assets/` to avoid naming conflicts with nested asset entry points. In this arrangement, an "admin" slice will have its assets compiled into `public/assets/_admin/`.
17
+
5
18
  ## v2.1.0.rc3 - 2024-02-16
6
19
 
7
20
  ### Changed
8
21
 
9
22
  - [Tim Riley] Return `nil` when setting content via `#content_for` on the app's view context. This
10
- allows it to be used with tempalte output tags (such as ERB's `<%=`) that capture a block for the
23
+ allows it to be used with template output tags (such as ERB's `<%=`) that capture a block for the
11
24
  given content. (#1369)
12
25
 
13
- ## Fixed
26
+ ### Fixed
14
27
 
15
28
  - [Tim Riley] Ensure assets Rake task for Heroku works (#1368)
16
29
 
@@ -45,7 +58,6 @@ The web, with simplicity.
45
58
  - Keep `video_tag` (remove `video` alias)
46
59
  - Keep `audio_tag` (remove `audio` alias)
47
60
 
48
-
49
61
  ## v2.1.0.beta2.1 - 2023-10-04
50
62
 
51
63
  ### Added
@@ -144,7 +156,7 @@ The web, with simplicity.
144
156
  ### Fixed
145
157
 
146
158
  - [Luca Guidi] Ensure to properly mount Rack middleware in routing scope and slice
147
- - [Tim Riley] Simplify and clarify usage of `Hanami::Config#enviroment`
159
+ - [Tim Riley] Simplify and clarify usage of `Hanami::Config#environment`
148
160
  - [Tim Riley] Improve error message for missing action class
149
161
  - [Tim Riley] Expect nested slices to use parent’s namespace
150
162
 
@@ -804,7 +816,7 @@ The web, with simplicity.
804
816
  - [Luca Guidi] Main configuration is available at `config/application.rb` instead of `config/enviroment.rb`
805
817
  - [Luca Guidi] Removed `Hanami.configure` in favor of main application configuration (e.g. `Bookshelf::Application.config`)
806
818
  - [Luca Guidi] Removed DSL syntax for main configuration (from `cookies max_age: 600` to `config.cookies = { max_age: 600 }`)
807
- - [Luca Guidi] Per enviroment settings must be wrapped in a block (e.g. `config.enviroment(:production) { |c| c.logger = {} }`)
819
+ - [Luca Guidi] Per environment settings must be wrapped in a block (e.g. `config.environment(:production) { |c| c.logger = {} }`)
808
820
  - [Luca Guidi] Concrete applications are no longer supported (e.g. `Web::Application` in `apps/web/application.rb`)
809
821
  - [Luca Guidi] Main routes must be configured at `config/routes.rb`:
810
822
 
@@ -1120,7 +1132,7 @@ end
1120
1132
  - [Mahesh] Fix destroy action for application architecture
1121
1133
  - [Karim Tarek & akhramov] Reference rendering errors in Rack env's `rack.exception` variable. This enables compatibility with exception reporting SaaS.
1122
1134
  - [Luca Guidi] Detect assets dependencies changes in development (Sass/SCSS)
1123
- - [Luca Guidi & Lucas Amorim] Make model generator not dependendent on the current directory name, but to the project name stored in `.hanamirc`
1135
+ - [Luca Guidi & Lucas Amorim] Make model generator not dependent on the current directory name, but to the project name stored in `.hanamirc`
1124
1136
 
1125
1137
  ### Changed
1126
1138
 
@@ -1375,7 +1387,7 @@ end
1375
1387
  - [Piotr Kurek] Allow to yield multiple configurations per application, according to the current environment
1376
1388
  - [David Celis] Allow to configure Rack middleware stack (`middleware` configuration)
1377
1389
  - [David Celis] Introduced `lotus console` command. It runs the REPL configured in `Gemfile` (eg. pry or ripl). Defaults to IRb.
1378
- - [Luca Guidi] Introduced `Lotus::Environment` which holds the informations about the current environment, and CLI arguments
1390
+ - [Luca Guidi] Introduced `Lotus::Environment` which holds the information about the current environment, and CLI arguments
1379
1391
  - [Luca Guidi] Introduced `Lotus::Application.load!` to load and configure an application without requiring user defined code (controllers, views, etc.)
1380
1392
  - [Leonard Garvey] Introduced `lotus server` command. It runs the application with the Rack server declared in `Gemfile` (eg. puma, thin, unicorn). It defaults to `WEBRick`.
1381
1393
  - [Luca Guidi] Official support for MRI 2.1 and 2.2
data/FEATURES.md CHANGED
@@ -122,7 +122,7 @@
122
122
 
123
123
  ### v0.6.0 - 2016-01-12
124
124
 
125
- - Assets preprocessors support (eg. Sass, ES6, Opal, Less, CoffeScript..)
125
+ - Assets preprocessors support (eg. Sass, ES6, Opal, Less, CoffeeScript..)
126
126
  - Assets compressors (eg. YUI, UglifyJS2, Google Closure Compiler, Sass..)
127
127
  - Assets helpers:
128
128
  - `javascript`
data/hanami.gemspec CHANGED
@@ -38,8 +38,8 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency "dry-monitor", "~> 1.0", ">= 1.0.1", "< 2"
39
39
  spec.add_dependency "dry-system", "~> 1.0", "< 2"
40
40
  spec.add_dependency "dry-logger", "~> 1.0", "< 2"
41
- spec.add_dependency "hanami-cli", "= 2.1.0.rc3"
42
- spec.add_dependency "hanami-utils", "~> 2.1.rc"
41
+ spec.add_dependency "hanami-cli", "~> 2.1"
42
+ spec.add_dependency "hanami-utils", "~> 2.1"
43
43
  spec.add_dependency "zeitwerk", "~> 2.6"
44
44
 
45
45
  spec.add_development_dependency "rspec", "~> 3.8"
data/lib/hanami/app.rb CHANGED
@@ -129,7 +129,7 @@ module Hanami
129
129
  end
130
130
  end
131
131
 
132
- # When auto-registering components in app/, ignore files in `app/lib/` (these will be
132
+ # When auto-registering components in `app/`, ignore files in `app/lib/` (these will be
133
133
  # auto-registered as above), as well as the configured no_auto_register_paths
134
134
  no_auto_register_paths = ([LIB_DIR] + config.no_auto_register_paths)
135
135
  .map { |path|
@@ -159,7 +159,7 @@ module Hanami
159
159
  end
160
160
  end
161
161
 
162
- def respond_to_missing?(name, _incude_all = false)
162
+ def respond_to_missing?(name, _include_all = false)
163
163
  config.respond_to?(name) || base_config.respond_to?(name) || super
164
164
  end
165
165
  end
@@ -76,7 +76,7 @@ module Hanami
76
76
  end
77
77
  end
78
78
 
79
- def respond_to_missing?(name, _incude_all = false)
79
+ def respond_to_missing?(name, _include_all = false)
80
80
  config.respond_to?(name) || base_config.respond_to?(name) || super
81
81
  end
82
82
  end
@@ -25,7 +25,7 @@ module Hanami
25
25
  attr_reader :env
26
26
 
27
27
  # @!attribute [rw] level
28
- # Sets or returns the logger level.
28
+ # Sets or returns the logger's level.
29
29
  #
30
30
  # Defaults to `:info` for the production environment and `:debug` for all others.
31
31
  #
@@ -191,7 +191,7 @@ module Hanami
191
191
  end
192
192
 
193
193
  # @api private
194
- def respond_to_missing?(name, _incude_all = false)
194
+ def respond_to_missing?(name, _include_all = false)
195
195
  config.respond_to?(name) || super
196
196
  end
197
197
  end
data/lib/hanami/config.rb CHANGED
@@ -481,7 +481,7 @@ module Hanami
481
481
  end
482
482
  end
483
483
 
484
- def respond_to_missing?(name, _incude_all = false)
484
+ def respond_to_missing?(name, _include_all = false)
485
485
  config.respond_to?(name) || super
486
486
  end
487
487
  end
@@ -156,7 +156,7 @@ module Hanami
156
156
  @assets
157
157
  end
158
158
 
159
- # Returns the current request, if the view is rendered from within an action.
159
+ # Returns the current request, if the view is rendered from within an action.
160
160
  #
161
161
  # @return [Hanami::Action::Request] the request
162
162
  #
@@ -46,7 +46,7 @@ module Hanami
46
46
  # Standalone helpers class including both {StandardHelpers} as well as the user-defined
47
47
  # helpers for the slice.
48
48
  #
49
- # Used used where helpers should be addressed via an intermediary object (i.e. in parts),
49
+ # Used where helpers should be addressed via an intermediary object (i.e. in parts),
50
50
  # rather than mixed into a class directly.
51
51
  #
52
52
  # @api private
@@ -3,7 +3,7 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
- # Provides slice-specific helper methods any view object requiring access to helpers.
6
+ # Provides slice-specific helper methods for any view object requiring access to helpers.
7
7
  #
8
8
  # @api public
9
9
  # @since 2.1.0
@@ -81,7 +81,7 @@ module Hanami
81
81
  # If the "CDN mode" is on, the `src` is an absolute URL of the
82
82
  # application CDN.
83
83
  #
84
- # If the "subresource integrity mode" is on, `integriy` is the
84
+ # If the "subresource integrity mode" is on, `integrity` is the
85
85
  # name of the algorithm, then a hyphen, then the hash value of the file.
86
86
  # If more than one algorithm is used, they"ll be separated by a space.
87
87
  #
@@ -185,7 +185,7 @@ module Hanami
185
185
  # If the "CDN mode" is on, the `href` is an absolute URL of the
186
186
  # application CDN.
187
187
  #
188
- # If the "subresource integrity mode" is on, `integriy` is the
188
+ # If the "subresource integrity mode" is on, `integrity` is the
189
189
  # name of the algorithm, then a hyphen, then the hashed value of the file.
190
190
  # If more than one algorithm is used, they"ll be separated by a space.
191
191
  #
@@ -270,7 +270,7 @@ module Hanami
270
270
  # Generate `img` tag for given source
271
271
  #
272
272
  # It accepts one string representing the name of the asset, if it comes
273
- # from the application or third party gems. It also accepts string
273
+ # from the application or third party gems. It also accepts strings
274
274
  # representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
275
275
  #
276
276
  # `alt` Attribute is auto generated from `src`.
@@ -382,7 +382,7 @@ module Hanami
382
382
  #
383
383
  # <%= favicon_tag "favicon.ico", id: "fav" %>
384
384
  #
385
- # # <link id: "fav" href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon">
385
+ # # <link id="fav" href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon">
386
386
  #
387
387
  # @example Fingerprint Mode
388
388
  #
@@ -412,7 +412,7 @@ module Hanami
412
412
  # Generate `video` tag for given source
413
413
  #
414
414
  # It accepts one string representing the name of the asset, if it comes
415
- # from the application or third party gems. It also accepts string
415
+ # from the application or third party gems. It also accepts strings
416
416
  # representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
417
417
  #
418
418
  # Alternatively, it accepts a block that allows to specify one or more
@@ -514,7 +514,7 @@ module Hanami
514
514
  # Generate `audio` tag for given source
515
515
  #
516
516
  # It accepts one string representing the name of the asset, if it comes
517
- # from the application or third party gems. It also accepts string
517
+ # from the application or third party gems. It also accepts strings
518
518
  # representing absolute URLs in case of public CDN (eg. Bootstrap CDN).
519
519
  #
520
520
  # Alternatively, it accepts a block that allows to specify one or more
@@ -190,7 +190,7 @@ module Hanami
190
190
  # @param name [String] the input name, also used as the base input name for all fields
191
191
  # within the block
192
192
  # @yieldparam [FormBuilder] the form builder for the nested fields
193
- # @yieldparam [Integer] the index of the iteration over the colletion, starting from zero
193
+ # @yieldparam [Integer] the index of the iteration over the collection, starting from zero
194
194
  # @yieldparam [Object] the value of the element from the collection
195
195
  #
196
196
  # @example Basic usage
@@ -694,7 +694,7 @@ module Hanami
694
694
  #
695
695
  # @example Advanced attributes
696
696
  # f.number_field("book.percent_read", min: 1, max: 100, step: 1)
697
- # => <input type="number" name="book[percent_read]" id="book-precent-read" value="" min="1" max="100" step="1">
697
+ # => <input type="number" name="book[percent_read]" id="book-percent-read" value="" min="1" max="100" step="1">
698
698
  #
699
699
  # @api public
700
700
  # @since 2.1.0
@@ -4,8 +4,8 @@ require "rack"
4
4
 
5
5
  module Hanami
6
6
  module Middleware
7
- # The errors app given to {Hanami::Middleware::RenderErrors}, which renders a error responses
8
- # from HTML pages kept in `public/` or as simple JSON structures.
7
+ # The errors app given to {Hanami::Middleware::RenderErrors}, which renders error responses
8
+ # from HTML pages kept in `public/` as simple JSON structures.
9
9
  #
10
10
  # @see Hanami::Middleware::RenderErrors
11
11
  #
@@ -29,8 +29,7 @@ module Hanami
29
29
 
30
30
  # @api private
31
31
  def start
32
- assets_dir = slice.slice_name.to_s unless slice.app.eql?(slice)
33
- root = slice.app.root.join("public", "assets", assets_dir.to_s)
32
+ root = slice.app.root.join("public", "assets", Hanami::Assets.public_assets_dir(slice).to_s)
34
33
 
35
34
  assets = Hanami::Assets.new(config: slice.config.assets, root: root)
36
35
 
@@ -20,8 +20,8 @@ module Hanami
20
20
  # Explicitly register the Rack middleware events on our notifications bus. The Dry::Monitor
21
21
  # rack extension (activated above) does register these globally, but if the notifications
22
22
  # bus has been used before this provider loads, then it will have created its own separate
23
- # locally copy of all registered events as of that moment in time, which will not included
24
- # the Rack events globally reigstered above.
23
+ # local copy of all registered events as of that moment in time, which will not be included
24
+ # in the Rack events globally registered above.
25
25
  notifications = target["notifications"]
26
26
  notifications.register_event(Dry::Monitor::Rack::Middleware::REQUEST_START)
27
27
  notifications.register_event(Dry::Monitor::Rack::Middleware::REQUEST_STOP)
@@ -32,7 +32,7 @@ Hanami::CLI::RakeTasks.register_tasks do
32
32
  # Please use them when you're in control of your deployment environment.
33
33
  #
34
34
  # If you're not in control and your deployment requires these "standard"
35
- # Rake tasks, they are here to solve this only specific problem.
35
+ # Rake tasks, they are here only to solve this specific problem.
36
36
  #
37
37
  # namespace :db do
38
38
  # task :migrate do
@@ -8,7 +8,7 @@ module Hanami
8
8
  # Provides user-defined settings for an Hanami app or slice.
9
9
  #
10
10
  # Define your own settings by inheriting from this class in `config/settings.rb` within an app or
11
- # slice. Your settings will be loaded from matching ENV vars (with upper-cased names) and made
11
+ # slice. Your settings will be loaded from matching ENV vars (with upper-cased names) and be
12
12
  # registered as a component as part of the Hanami app {Hanami::Slice::ClassMethods#prepare
13
13
  # prepare} step.
14
14
  #
@@ -160,8 +160,8 @@ module Hanami
160
160
  value = store.fetch(name, Undefined)
161
161
 
162
162
  if value.eql?(Undefined)
163
- # When a key is missing entirely from the store, _read_ its value from the config instead,
164
- # which ensures its setting constructor runs (with a `nil` argument given) and raises any
163
+ # When a key is missing entirely from the store, _read_ its value from the config instead.
164
+ # This ensures its setting constructor runs (with a `nil` argument given) and raises any
165
165
  # necessary errors.
166
166
  public_send(name)
167
167
  else
@@ -91,16 +91,16 @@ module Hanami
91
91
  #
92
92
  # @api public
93
93
  # @since 2.0.0
94
- def use(spec, *args, path_prefix: ::Hanami::Router::DEFAULT_PREFIX, before: nil, after: nil, &blk)
94
+ def use(spec, *args, path_prefix: ::Hanami::Router::DEFAULT_PREFIX, before: nil, after: nil, **kwargs, &blk)
95
95
  middleware = resolve_middleware_class(spec)
96
- item = [middleware, args, blk]
96
+ item = [middleware, args, kwargs, blk]
97
97
 
98
98
  if before
99
99
  @stack[path_prefix].insert((idx = index_of(before, path_prefix)).zero? ? 0 : idx - 1, item)
100
100
  elsif after
101
101
  @stack[path_prefix].insert(index_of(after, path_prefix) + 1, item)
102
102
  else
103
- @stack[path_prefix].push([middleware, args, blk])
103
+ @stack[path_prefix].push(item)
104
104
  end
105
105
 
106
106
  self
data/lib/hanami/slice.rb CHANGED
@@ -189,7 +189,7 @@ module Hanami
189
189
  # @api public
190
190
  # @since 2.0.0
191
191
  def root
192
- # Provide a best guess for a root when it is not yet configured.
192
+ # Provides a best guess for a root when it is not yet configured.
193
193
  #
194
194
  # This is particularly useful for user-defined slice classes that access `settings` inside
195
195
  # the class body (since the root needed to find the settings file). In this case,
@@ -265,7 +265,7 @@ module Hanami
265
265
  #
266
266
  # @example
267
267
  # module MySlice
268
- # class Sliice < Hanami::Slice
268
+ # class Slice < Hanami::Slice
269
269
  # prepare_container do |container|
270
270
  # # ...
271
271
  # end
@@ -404,7 +404,7 @@ module Hanami
404
404
  # @param key [String] the component's key
405
405
  # @param object [Object] the object to register as the component
406
406
  #
407
- # @overload reigster(key, memoize: false, &block)
407
+ # @overload register(key, memoize: false, &block)
408
408
  # Registers the given block as the component. When the component is resolved, the return
409
409
  # value of the block will be returned.
410
410
  #
@@ -422,7 +422,7 @@ module Hanami
422
422
  # @param memoize [Boolean]
423
423
  # @yieldreturn [Object] the object to register as the component
424
424
  #
425
- # @overload reigster(key, call: true, &block)
425
+ # @overload register(key, call: true, &block)
426
426
  # Registers the given block as the component. When `call: false` is given, then the block
427
427
  # itself will become the component.
428
428
  #
@@ -430,7 +430,7 @@ module Hanami
430
430
  # object for that block will be returned.
431
431
  #
432
432
  # @param key [String] the component's key
433
- # @param call [Booelan]
433
+ # @param call [Boolean]
434
434
  #
435
435
  # @return [container]
436
436
  #
@@ -493,7 +493,7 @@ module Hanami
493
493
  # namespace. May be an explicit string, or `true` for the namespace to be the provider's
494
494
  # name
495
495
  # @param from [Symbol, nil] the group for an external provider source to use, with the
496
- # provider source name inferred from `name` or passsed explicitly as `source:`
496
+ # provider source name inferred from `name` or passed explicitly as `source:`
497
497
  # @param source [Symbol, nil] the name of the external provider source to use, if different
498
498
  # from the value provided as `name`
499
499
  # @param if [Boolean] a boolean-returning expression to determine whether to register the
@@ -7,7 +7,7 @@ module Hanami
7
7
  # @api private
8
8
  module Version
9
9
  # @api public
10
- VERSION = "2.1.0.rc3"
10
+ VERSION = "2.1.1"
11
11
 
12
12
  # @since 0.9.0
13
13
  # @api private
@@ -35,8 +35,8 @@ module Hanami
35
35
  CONTENT_LENGTH = "CONTENT_LENGTH"
36
36
  private_constant :CONTENT_LENGTH
37
37
 
38
- MILISECOND = "ms"
39
- private_constant :MILISECOND
38
+ MILLISECOND = "ms"
39
+ private_constant :MILLISECOND
40
40
 
41
41
  MICROSECOND = "µs"
42
42
  private_constant :MICROSECOND
@@ -79,7 +79,7 @@ module Hanami
79
79
  end
80
80
 
81
81
  def accepts_entry_payload?(logger)
82
- logger.method(:info).parameters.last.then { |type, _| type == :keyrest }
82
+ logger.method(:info).parameters.any? { |(type, _)| type == :keyrest }
83
83
  end
84
84
  end
85
85
 
@@ -7,7 +7,7 @@
7
7
  <title>Hanami</title>
8
8
  <style>
9
9
  :root {
10
- --max-width: 1024px;
10
+ --max-width: 768px;
11
11
  --foreground-rgb: 0, 0, 0;
12
12
  --background-rgb: 255, 255, 255;
13
13
  --card-border-rgb: 200, 200, 200;
@@ -84,7 +84,7 @@
84
84
 
85
85
  .grid {
86
86
  display: grid;
87
- grid-template-columns: repeat(4, 1fr);
87
+ grid-template-columns: repeat(3, 1fr);
88
88
  column-gap: 20px;
89
89
  max-width: 100%;
90
90
  margin-bottom: 8vh;
@@ -182,10 +182,6 @@
182
182
  <h2>Guides</h2>
183
183
  <p>Get started with the Hanami guides</p>
184
184
  </a>
185
- <a href="https://docs.hanamirb.org/" class="card">
186
- <h2>API docs</h2>
187
- <p>Learn more through the API docs</p>
188
- </a>
189
185
  <a href="http://github.com/hanami" class="card">
190
186
  <h2>Code</h2>
191
187
  <p>Contribute to the source code</p>
@@ -133,13 +133,13 @@ RSpec.describe "Assets", :app_integration do
133
133
 
134
134
  output = Main::Slice["views.posts.show"].call.to_s
135
135
 
136
- expect(output).to match(%r{<link href="/assets/main/app-[A-Z0-9]{8}.css" type="text/css" rel="stylesheet">})
137
- expect(output).to match(%r{<script src="/assets/main/app-[A-Z0-9]{8}.js" type="text/javascript"></script>})
136
+ expect(output).to match(%r{<link href="/assets/_main/app-[A-Z0-9]{8}.css" type="text/css" rel="stylesheet">})
137
+ expect(output).to match(%r{<script src="/assets/_main/app-[A-Z0-9]{8}.js" type="text/javascript"></script>})
138
138
 
139
139
  assets = Main::Slice["assets"]
140
140
 
141
- expect(assets["app.css"].to_s).to match(%r{/assets/main/app-[A-Z0-9]{8}.css})
142
- expect(assets["app.js"].to_s).to match(%r{/assets/main/app-[A-Z0-9]{8}.js})
141
+ expect(assets["app.css"].to_s).to match(%r{/assets/_main/app-[A-Z0-9]{8}.css})
142
+ expect(assets["app.js"].to_s).to match(%r{/assets/_main/app-[A-Z0-9]{8}.js})
143
143
  end
144
144
  end
145
145
 
@@ -147,6 +147,72 @@ RSpec.describe "Hanami web app", :app_integration do
147
147
  expect(last_response.body).to eql("one.two")
148
148
  end
149
149
 
150
+ specify "Setting a middleware that requires keyword arguments" do
151
+ write "config/app.rb", <<~RUBY
152
+ require "hanami"
153
+
154
+ module TestApp
155
+ class TestMiddleware
156
+ def initialize(app, key:, value:)
157
+ @app = app
158
+ @key = key
159
+ @value = value
160
+ end
161
+
162
+ def call(env)
163
+ env[@key] = @value
164
+ @app.call(env)
165
+ end
166
+ end
167
+
168
+ class App < Hanami::App
169
+ config.logger.stream = StringIO.new
170
+
171
+ # Test middleware with keywords inside config
172
+ config.middleware.use(TestApp::TestMiddleware, key: "from_config", value: "config")
173
+ end
174
+ end
175
+ RUBY
176
+
177
+ write "config/routes.rb", <<~RUBY
178
+ require "hanami/router"
179
+
180
+ module TestApp
181
+ class Routes < Hanami::Routes
182
+ slice :main, at: "/" do
183
+ # Also test middleware with keywords inside routes
184
+ use TestApp::TestMiddleware, key: "from_routes", value: "routes"
185
+
186
+ root to: "home.index"
187
+ end
188
+ end
189
+ end
190
+ RUBY
191
+
192
+ write "slices/main/actions/home/index.rb", <<~RUBY
193
+ require "hanami/action"
194
+
195
+ module Main
196
+ module Actions
197
+ module Home
198
+ class Index < Hanami::Action
199
+ def handle(request, response)
200
+ response.body = [request.env["from_config"], request.env["from_routes"]].join(", ")
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ RUBY
207
+
208
+ require "hanami/boot"
209
+
210
+ get "/"
211
+
212
+ expect(last_response).to be_successful
213
+ expect(last_response.body).to eq "config, routes"
214
+ end
215
+
150
216
  specify "Setting a middleware that requires a block" do
151
217
  write "config/app.rb", <<~RUBY
152
218
  require "hanami"
@@ -32,7 +32,7 @@ RSpec.describe "App view / Config / Template", :app_integration do
32
32
  subject(:template) { view_class.config.template }
33
33
  let(:view_class) { TestApp::Views::Article::Index }
34
34
 
35
- it "configures the tempalte to match the class name" do
35
+ it "configures the template to match the class name" do
36
36
  expect(template).to eq "article/index"
37
37
  end
38
38
  end
@@ -31,7 +31,7 @@ RSpec.describe "App view / Context / Request", :app_integration do
31
31
  end
32
32
  end
33
33
 
34
- describe "#sesion" do
34
+ describe "#session" do
35
35
  let(:session) { double(:session) }
36
36
 
37
37
  before do
@@ -37,7 +37,7 @@ module RSpec
37
37
 
38
38
  write "public/assets/assets.json", JSON.generate(manifest_hash)
39
39
 
40
- # An assets dir isrequired to load the assets provider
40
+ # An assets dir is required to load the assets provider
41
41
  write "app/assets/.keep", ""
42
42
  end
43
43
 
@@ -80,8 +80,8 @@ RSpec.describe Hanami::Helpers::FormHelper do
80
80
  end
81
81
 
82
82
  it "allows to specify HTML attributes" do
83
- html = form_for("/books", class: "form-horizonal")
84
- expect(html).to eq %(<form action="/books" class="form-horizonal" accept-charset="utf-8" method="POST"></form>)
83
+ html = form_for("/books", class: "form-horizontal")
84
+ expect(html).to eq %(<form action="/books" class="form-horizontal" accept-charset="utf-8" method="POST"></form>)
85
85
  end
86
86
 
87
87
  context "input name" do
@@ -8,7 +8,7 @@ RSpec.describe Hanami::Slice, :app_integration do
8
8
  end
9
9
  end
10
10
 
11
- describe ".environemnt" do
11
+ describe ".environment" do
12
12
  subject(:slice) { Hanami.app.register_slice(:main) }
13
13
 
14
14
  before do
@@ -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.rc3")
5
+ expect(Hanami::VERSION).to eq("2.1.1")
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.rc3
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-16 00:00:00.000000000 Z
11
+ date: 2024-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,30 +160,30 @@ dependencies:
160
160
  name: hanami-cli
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - '='
163
+ - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 2.1.0.rc3
165
+ version: '2.1'
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - '='
170
+ - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 2.1.0.rc3
172
+ version: '2.1'
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: hanami-utils
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 2.1.rc
179
+ version: '2.1'
180
180
  type: :runtime
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: 2.1.rc
186
+ version: '2.1'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: zeitwerk
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -451,7 +451,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
451
  - !ruby/object:Gem::Version
452
452
  version: '0'
453
453
  requirements: []
454
- rubygems_version: 3.5.6
454
+ rubygems_version: 3.5.9
455
455
  signing_key:
456
456
  specification_version: 4
457
457
  summary: The web, with simplicity