hanami 2.1.0 → 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 +4 -4
- data/CHANGELOG.md +11 -6
- data/FEATURES.md +1 -1
- data/lib/hanami/app.rb +1 -1
- data/lib/hanami/config/actions.rb +1 -1
- data/lib/hanami/config/assets.rb +1 -1
- data/lib/hanami/config/logger.rb +2 -2
- data/lib/hanami/config.rb +1 -1
- data/lib/hanami/extensions/view/context.rb +1 -1
- data/lib/hanami/extensions/view/part.rb +1 -1
- data/lib/hanami/extensions/view/slice_configured_helpers.rb +1 -1
- data/lib/hanami/helpers/assets_helper.rb +5 -5
- data/lib/hanami/helpers/form_helper/form_builder.rb +2 -2
- data/lib/hanami/middleware/public_errors_app.rb +2 -2
- data/lib/hanami/providers/rack.rb +2 -2
- data/lib/hanami/rake_tasks.rb +1 -1
- data/lib/hanami/settings.rb +3 -3
- data/lib/hanami/slice.rb +6 -6
- data/lib/hanami/version.rb +1 -1
- data/lib/hanami/web/rack_logger.rb +3 -3
- data/spec/integration/view/config/template_spec.rb +1 -1
- data/spec/integration/view/context/request_spec.rb +1 -1
- data/spec/unit/hanami/helpers/form_helper_spec.rb +2 -2
- data/spec/unit/hanami/slice_spec.rb +1 -1
- data/spec/unit/hanami/version_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 190712bdfa529ad5769aa5effd9335e436b067cd91b6a109a3aa9a4718a73507
|
4
|
+
data.tar.gz: 353ccb232425a07133e981d5d8ae6c6906f49cb48d38d7f2b55dc4e28a9c797b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4e7e1885c9b3eb494863b63f4d376739d6736764b435b83ce75e9a1bb68340681a26bea3883ed20c679e4d88bf99b3d487ae40e2e80f0fb15adb99acfa561d
|
7
|
+
data.tar.gz: 8fe1a9d8f9f7372d67ee3f7b9c6e55b0e1aa59acbaee7264028d876dd5cd7b586f147ae08cd268d67c923d5028344bf37868d190cd2d56229932db56828dcce1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
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
|
+
|
5
11
|
## v2.1.0 - 2024-02-27
|
6
12
|
|
7
13
|
### Changed
|
@@ -14,7 +20,7 @@ The web, with simplicity.
|
|
14
20
|
### Changed
|
15
21
|
|
16
22
|
- [Tim Riley] Return `nil` when setting content via `#content_for` on the app's view context. This
|
17
|
-
allows it to be used with
|
23
|
+
allows it to be used with template output tags (such as ERB's `<%=`) that capture a block for the
|
18
24
|
given content. (#1369)
|
19
25
|
|
20
26
|
### Fixed
|
@@ -52,7 +58,6 @@ The web, with simplicity.
|
|
52
58
|
- Keep `video_tag` (remove `video` alias)
|
53
59
|
- Keep `audio_tag` (remove `audio` alias)
|
54
60
|
|
55
|
-
|
56
61
|
## v2.1.0.beta2.1 - 2023-10-04
|
57
62
|
|
58
63
|
### Added
|
@@ -151,7 +156,7 @@ The web, with simplicity.
|
|
151
156
|
### Fixed
|
152
157
|
|
153
158
|
- [Luca Guidi] Ensure to properly mount Rack middleware in routing scope and slice
|
154
|
-
- [Tim Riley] Simplify and clarify usage of `Hanami::Config#
|
159
|
+
- [Tim Riley] Simplify and clarify usage of `Hanami::Config#environment`
|
155
160
|
- [Tim Riley] Improve error message for missing action class
|
156
161
|
- [Tim Riley] Expect nested slices to use parent’s namespace
|
157
162
|
|
@@ -811,7 +816,7 @@ The web, with simplicity.
|
|
811
816
|
- [Luca Guidi] Main configuration is available at `config/application.rb` instead of `config/enviroment.rb`
|
812
817
|
- [Luca Guidi] Removed `Hanami.configure` in favor of main application configuration (e.g. `Bookshelf::Application.config`)
|
813
818
|
- [Luca Guidi] Removed DSL syntax for main configuration (from `cookies max_age: 600` to `config.cookies = { max_age: 600 }`)
|
814
|
-
- [Luca Guidi] Per
|
819
|
+
- [Luca Guidi] Per environment settings must be wrapped in a block (e.g. `config.environment(:production) { |c| c.logger = {} }`)
|
815
820
|
- [Luca Guidi] Concrete applications are no longer supported (e.g. `Web::Application` in `apps/web/application.rb`)
|
816
821
|
- [Luca Guidi] Main routes must be configured at `config/routes.rb`:
|
817
822
|
|
@@ -1127,7 +1132,7 @@ end
|
|
1127
1132
|
- [Mahesh] Fix destroy action for application architecture
|
1128
1133
|
- [Karim Tarek & akhramov] Reference rendering errors in Rack env's `rack.exception` variable. This enables compatibility with exception reporting SaaS.
|
1129
1134
|
- [Luca Guidi] Detect assets dependencies changes in development (Sass/SCSS)
|
1130
|
-
- [Luca Guidi & Lucas Amorim] Make model generator not
|
1135
|
+
- [Luca Guidi & Lucas Amorim] Make model generator not dependent on the current directory name, but to the project name stored in `.hanamirc`
|
1131
1136
|
|
1132
1137
|
### Changed
|
1133
1138
|
|
@@ -1382,7 +1387,7 @@ end
|
|
1382
1387
|
- [Piotr Kurek] Allow to yield multiple configurations per application, according to the current environment
|
1383
1388
|
- [David Celis] Allow to configure Rack middleware stack (`middleware` configuration)
|
1384
1389
|
- [David Celis] Introduced `lotus console` command. It runs the REPL configured in `Gemfile` (eg. pry or ripl). Defaults to IRb.
|
1385
|
-
- [Luca Guidi] Introduced `Lotus::Environment` which holds the
|
1390
|
+
- [Luca Guidi] Introduced `Lotus::Environment` which holds the information about the current environment, and CLI arguments
|
1386
1391
|
- [Luca Guidi] Introduced `Lotus::Application.load!` to load and configure an application without requiring user defined code (controllers, views, etc.)
|
1387
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`.
|
1388
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,
|
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/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
|
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|
|
data/lib/hanami/config/assets.rb
CHANGED
data/lib/hanami/config/logger.rb
CHANGED
@@ -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,
|
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
@@ -156,7 +156,7 @@ module Hanami
|
|
156
156
|
@assets
|
157
157
|
end
|
158
158
|
|
159
|
-
# Returns the current request, if
|
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
|
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
|
@@ -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, `
|
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, `
|
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
|
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`.
|
@@ -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
|
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
|
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
|
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-
|
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
|
8
|
-
# from HTML pages kept in `public/`
|
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
|
#
|
@@ -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
|
-
#
|
24
|
-
# the Rack events globally
|
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)
|
data/lib/hanami/rake_tasks.rb
CHANGED
@@ -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
|
35
|
+
# Rake tasks, they are here only to solve this specific problem.
|
36
36
|
#
|
37
37
|
# namespace :db do
|
38
38
|
# task :migrate do
|
data/lib/hanami/settings.rb
CHANGED
@@ -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
|
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
|
-
#
|
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
|
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
|
-
#
|
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
|
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
|
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
|
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 [
|
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
|
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
|
data/lib/hanami/version.rb
CHANGED
@@ -35,8 +35,8 @@ module Hanami
|
|
35
35
|
CONTENT_LENGTH = "CONTENT_LENGTH"
|
36
36
|
private_constant :CONTENT_LENGTH
|
37
37
|
|
38
|
-
|
39
|
-
private_constant :
|
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.
|
82
|
+
logger.method(:info).parameters.any? { |(type, _)| type == :keyrest }
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -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
|
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
|
@@ -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-
|
84
|
-
expect(html).to eq %(<form action="/books" class="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
|
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.
|
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-
|
11
|
+
date: 2024-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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.
|
454
|
+
rubygems_version: 3.5.9
|
455
455
|
signing_key:
|
456
456
|
specification_version: 4
|
457
457
|
summary: The web, with simplicity
|