hanami 2.1.0.rc1 → 2.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ba29263713547809e78df051e0138f202d947ce6e9cf2bc9d06c5bf79438cb7
4
- data.tar.gz: 0677ae36e85bbb92ed1bdde4ae48e92ac062ccf89f6d77b86b85578fd8975a06
3
+ metadata.gz: 8a6835d72654251d1461ea2ad61c9fe56ad9b37b0ff333d23dc444e205b32ab1
4
+ data.tar.gz: 3daf6e28931aa6abf0c3579d95c8e403c1ba12bbcb5879549825e03ae8e81556
5
5
  SHA512:
6
- metadata.gz: f24d67421d88e019d3fdf1d282fd55cff3a303e59fa7195fc8b152a6b85d1990aafe1cf3c583eeb2b561cfcae4b76e4120ef9863f12cee424c8372526cfb178a
7
- data.tar.gz: 8e9ab011e12426e7d2e03ed784858309f7ca33fa8aa84d23ae84cd7d9435563998f38cb9d53322e2631c017334465cec10e0b2f65a58d8dcb0290c360dff5b1c
6
+ metadata.gz: 4b79171920231066598260223766e9abaee75806c751bcf83ca9ddaa93ef2eabef1fabc3077674cb81f25e435fa8659a04f9c272200a4ed27fa02c271ac03531
7
+ data.tar.gz: 04072a74f320abda02874ace16c616db0f3db9bb63de4d3b00746f3c1898c1dc58a143abd47915c9ef0a32b0a5eda860bd9264bccd375779d87bb101e4686dc1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  The web, with simplicity.
4
4
 
5
+ ## Changed
6
+
7
+ - [Tim Riley] Enable `config.render_detailed_errors` in development mode only by default. (#1365)
8
+ - [Tim Riley] Remove current_path from context (#1362)
9
+
5
10
  ## v2.1.0.rc1 - 2023-11-01
6
11
 
7
12
  ### Added
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.beta"
42
- spec.add_dependency "hanami-utils", "~> 2.1.beta"
41
+ spec.add_dependency "hanami-cli", "~> 2.1.rc"
42
+ spec.add_dependency "hanami-utils", "~> 2.1.rc"
43
43
  spec.add_dependency "zeitwerk", "~> 2.6"
44
44
 
45
45
  spec.add_development_dependency "rspec", "~> 3.8"
@@ -88,20 +88,19 @@ module Hanami
88
88
  # @since 2.1.0
89
89
  setting :method_override, default: true
90
90
 
91
- # The following settings are for view and assets integration with actions, and are NOT
92
- # publicly released as of 2.0.0. We'll make full documentation available when these become
93
- # public in a subsequent release.
94
-
95
91
  # @!attribute [rw] name_inference_base
96
92
  # @api private
93
+ # @since 2.1.0
97
94
  setting :name_inference_base, default: "actions"
98
95
 
99
96
  # @!attribute [rw] view_name_inferrer
100
97
  # @api private
98
+ # @since 2.1.0
101
99
  setting :view_name_inferrer, default: Slice::ViewNameInferrer
102
100
 
103
101
  # @!attribute [rw] view_name_inference_base
104
102
  # @api private
103
+ # @since 2.1.0
105
104
  setting :view_name_inference_base, default: "views"
106
105
 
107
106
  # @api private
@@ -9,7 +9,7 @@ module Hanami
9
9
  #
10
10
  # This exposes all the settings from the standalone `Hanami::Assets` class, pre-configured with
11
11
  # sensible defaults for actions within a full Hanami app. It also provides additional settings
12
- # for further integration of actions with other full stack app components.
12
+ # for further integration of assets with other full stack app components.
13
13
  #
14
14
  # @since 2.1.0
15
15
  # @api public
@@ -7,16 +7,22 @@ module Hanami
7
7
  class Config
8
8
  # Hanami views config
9
9
  #
10
- # This is NOT RELEASED as of 2.0.0.
10
+ # This exposes all the settings from the standalone `Hanami::View` class, pre-configured with
11
+ # sensible defaults for actions within a full Hanami app. It also provides additional settings
12
+ # for further integration of views with other full stack app components.
11
13
  #
12
- # @api private
14
+ # @since 2.1.0
15
+ # @api public
13
16
  class Views
14
17
  include Dry::Configurable
15
18
 
19
+ # @api private
20
+ # @since 2.1.0
16
21
  attr_reader :base_config
17
22
  protected :base_config
18
23
 
19
24
  # @api private
25
+ # @since 2.1.0
20
26
  def initialize(*)
21
27
  super
22
28
 
@@ -26,6 +32,7 @@ module Hanami
26
32
  end
27
33
 
28
34
  # @api private
35
+ # @since 2.1.0
29
36
  def initialize_copy(source)
30
37
  super
31
38
  @base_config = source.base_config.dup
@@ -33,6 +40,7 @@ module Hanami
33
40
  private :initialize_copy
34
41
 
35
42
  # @api private
43
+ # @since 2.1.0
36
44
  def finalize!
37
45
  return self if frozen?
38
46
 
data/lib/hanami/config.rb CHANGED
@@ -251,16 +251,30 @@ module Hanami
251
251
 
252
252
  # Returns the app's views config, or a null config if hanami-view is not bundled.
253
253
  #
254
- # This is NOT RELEASED as of 2.0.0.
254
+ # @example When hanami-view is bundled
255
+ # config.views.paths # => [...]
255
256
  #
256
- # @api private
257
+ # @example When hanami-view is not bundled
258
+ # config.views.paths # => NoMethodError
259
+ #
260
+ # @return [Hanami::Config::Views, Hanami::Config::NullConfig]
261
+ #
262
+ # @api public
263
+ # @since 2.1.0
257
264
  attr_reader :views
258
265
 
259
- # Returns the app's assets config.
266
+ # Returns the app's views config, or a null config if hanami-view is not bundled.
260
267
  #
261
- # This is NOT RELEASED as of 2.0.0.
268
+ # @example When hanami-view is bundled
269
+ # config.views.paths # => [...]
262
270
  #
263
- # @api private
271
+ # @example When hanami-view is not bundled
272
+ # config.views.paths # => NoMethodError
273
+ #
274
+ # @return [Hanami::Config::Assets, Hanami::Config::NullConfig]
275
+ #
276
+ # @api public
277
+ # @since 2.1.0
264
278
  attr_reader :assets
265
279
 
266
280
  # @api private
@@ -272,7 +286,7 @@ module Hanami
272
286
  # Apply default values that are only knowable at initialize-time (vs require-time)
273
287
  self.root = Dir.pwd
274
288
  self.render_errors = (env == :production)
275
- self.render_detailed_errors = (env != :production)
289
+ self.render_detailed_errors = (env == :development)
276
290
  load_from_env
277
291
 
278
292
  @logger = Config::Logger.new(env: env, app_name: app_name)
@@ -296,13 +310,8 @@ module Hanami
296
310
  @assets = load_dependent_config("hanami-assets") {
297
311
  require_relative "config/assets"
298
312
 
299
- public_dir = root.join("public")
300
-
301
313
  Hanami::Config::Assets.new(
302
- # TODO: check if `sources` are still needed
303
- sources: root.join("app", "assets"),
304
- destination: public_dir.join("assets"),
305
- manifest_path: public_dir.join("assets.json")
314
+ manifest_path: root.join("public", "assets.json")
306
315
  )
307
316
  }
308
317
 
@@ -7,15 +7,15 @@ module Hanami
7
7
  module View
8
8
  # View context for views in Hanami apps.
9
9
  #
10
- # This is NOT RELEASED as of 2.0.0.
11
- #
12
- # @api private
10
+ # @api public
11
+ # @since 2.1.0
13
12
  module Context
14
13
  class << self
15
14
  # Returns a context class for the given slice. If a context class is not defined, defines
16
15
  # a class named `Views::Context` within the slice's namespace.
17
16
  #
18
17
  # @api private
18
+ # @since 2.1.0
19
19
  def context_class(slice)
20
20
  views_namespace = views_namespace(slice)
21
21
 
@@ -30,6 +30,8 @@ module Hanami
30
30
 
31
31
  private
32
32
 
33
+ # @api private
34
+ # @since 2.1.0
33
35
  def context_superclass(slice)
34
36
  return Hanami::View::Context if Hanami.app.equal?(slice)
35
37
 
@@ -44,8 +46,10 @@ module Hanami
44
46
  end
45
47
  end
46
48
 
47
- # TODO: this could be moved into the top-level Extensions::View
49
+ # @api private
50
+ # @since 2.1.0
48
51
  def views_namespace(slice)
52
+ # TODO: this could be moved into the top-level Extensions::View
49
53
  if slice.namespace.const_defined?(:Views)
50
54
  slice.namespace.const_get(:Views)
51
55
  else
@@ -54,6 +58,8 @@ module Hanami
54
58
  end
55
59
  end
56
60
 
61
+ # @api private
62
+ # @since 2.1.0
57
63
  module ClassExtension
58
64
  def self.included(context_class)
59
65
  super
@@ -63,18 +69,39 @@ module Hanami
63
69
  context_class.prepend(InstanceMethods)
64
70
  end
65
71
 
72
+ # @api private
73
+ # @since 2.1.0
66
74
  module ClassMethods
75
+ # @api private
76
+ # @since 2.1.0
67
77
  def configure_for_slice(slice)
68
78
  extend SliceConfiguredContext.new(slice)
69
79
  end
70
80
  end
71
81
 
82
+ # @api public
83
+ # @since 2.1.0
72
84
  module InstanceMethods
85
+ # Returns the app's inflector.
86
+ #
87
+ # @return [Dry::Inflector] the inflector
88
+ #
89
+ # @api public
90
+ # @since 2.1.0
73
91
  attr_reader :inflector
74
92
 
93
+ # Returns the app's settings.
94
+ #
95
+ # @return [Hanami::Settings] the settings
96
+ #
97
+ # @api public
98
+ # @since 2.1.0
75
99
  attr_reader :settings
76
100
 
77
101
  # @see SliceConfiguredContext#define_new
102
+ #
103
+ # @api private
104
+ # @since 2.1.0
78
105
  def initialize( # rubocop:disable Metrics/ParameterLists
79
106
  inflector: nil,
80
107
  settings: nil,
@@ -94,6 +121,8 @@ module Hanami
94
121
  super(**args)
95
122
  end
96
123
 
124
+ # @api private
125
+ # @since 2.1.0
97
126
  def initialize_copy(source)
98
127
  # The standard implementation of initialize_copy will make shallow copies of all
99
128
  # instance variables from the source. This is fine for most of our ivars.
@@ -104,6 +133,14 @@ module Hanami
104
133
  @content_for = source.instance_variable_get(:@content_for).dup
105
134
  end
106
135
 
136
+ # Returns the app's assets.
137
+ #
138
+ # @return [Hanami::Assets] the assets
139
+ #
140
+ # @raise [Hanami::ComponentLoadError] if the hanami-assets gem is not bundled
141
+ #
142
+ # @api public
143
+ # @since 2.1.0
107
144
  def assets
108
145
  unless @assets
109
146
  raise Hanami::ComponentLoadError, "the hanami-assets gem is required to access assets"
@@ -112,6 +149,14 @@ module Hanami
112
149
  @assets
113
150
  end
114
151
 
152
+ # Returns the current request, if the view is rendered from within an action.
153
+ #
154
+ # @return [Hanami::Action::Request] the request
155
+ #
156
+ # @raise [Hanami::ComponentLoadError] if the view is not rendered from within a request
157
+ #
158
+ # @api public
159
+ # @since 2.1.0
115
160
  def request
116
161
  unless @request
117
162
  raise Hanami::ComponentLoadError, "only views rendered from Hanami::Action instances have a request"
@@ -120,6 +165,15 @@ module Hanami
120
165
  @request
121
166
  end
122
167
 
168
+ # Returns the app's routes helper.
169
+ #
170
+ # @return [Hanami::Slice::RoutesHelper] the routes helper
171
+ #
172
+ # @raise [Hanami::ComponentLoadError] if the hanami-router gem is not bundled or routes
173
+ # are not defined
174
+ #
175
+ # @api public
176
+ # @since 2.1.0
123
177
  def routes
124
178
  unless @routes
125
179
  raise Hanami::ComponentLoadError, "the hanami-router gem is required to access routes"
@@ -128,6 +182,32 @@ module Hanami
128
182
  @routes
129
183
  end
130
184
 
185
+ # @overload content_for(key, value = nil, &block)
186
+ # Stores a string or block of template markup for later use.
187
+ #
188
+ # @param key [Symbol] the content key, for later retrieval
189
+ # @param value [String, nil] the content, if no block is given
190
+ #
191
+ # @return [String] the content
192
+ #
193
+ # @example
194
+ # content_for(:page_title, "Hello world")
195
+ #
196
+ # @example In a template
197
+ # <% content_for :page_title do %>
198
+ # <h1>Hello world</h1>
199
+ # <% end %>
200
+ #
201
+ # @overload content_for(key)
202
+ # Returns the previously stored content for the given key.
203
+ #
204
+ # @param key [Symbol] the content key
205
+ #
206
+ # @return [String, nil] the content, or nil if no content previously stored with the
207
+ # key
208
+ #
209
+ # @api public
210
+ # @since 2.1.0
131
211
  def content_for(key, value = nil)
132
212
  if block_given?
133
213
  @content_for[key] = yield
@@ -138,18 +218,41 @@ module Hanami
138
218
  end
139
219
  end
140
220
 
141
- def current_path
142
- request.fullpath
143
- end
144
-
221
+ # Returns the current request's CSRF token.
222
+ #
223
+ # @return [String] the token
224
+ #
225
+ # @raise [Hanami::ComponentLoadError] if the view is not rendered from within a request
226
+ # @raise [Hanami::Action::MissingSessionError] if sessions are not enabled
227
+ #
228
+ # @api public
229
+ # @since 2.1.0
145
230
  def csrf_token
146
231
  request.session[Hanami::Action::CSRFProtection::CSRF_TOKEN]
147
232
  end
148
233
 
234
+ # Returns the session for the current request.
235
+ #
236
+ # @return [Rack::Session::Abstract::SessionHash] the session hash
237
+ #
238
+ # @raise [Hanami::ComponentLoadError] if the view is not rendered from within a request
239
+ # @raise [Hanami::Action::MissingSessionError] if sessions are not enabled
240
+ #
241
+ # @api public
242
+ # @since 2.1.0
149
243
  def session
150
244
  request.session
151
245
  end
152
246
 
247
+ # Returns the flash hash for the current request.
248
+ #
249
+ # @return []
250
+ #
251
+ # @raise [Hanami::ComponentLoadError] if the view is not rendered from within a request
252
+ # @raise [Hanami::Action::MissingSessionError] if sessions are not enabled
253
+ #
254
+ # @api public
255
+ # @since 2.1.0
153
256
  def flash
154
257
  request.flash
155
258
  end
@@ -3,9 +3,11 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
- # @api private
6
+ # @api public
7
7
  # @since 2.1.0
8
8
  module Part
9
+ # @api private
10
+ # @since 2.1.0
9
11
  def self.included(part_class)
10
12
  super
11
13
 
@@ -13,7 +15,11 @@ module Hanami
13
15
  part_class.extend(ClassMethods)
14
16
  end
15
17
 
18
+ # @api private
19
+ # @since 2.1.0
16
20
  module ClassMethods
21
+ # @api private
22
+ # @since 2.1.0
17
23
  def configure_for_slice(slice)
18
24
  extend SliceConfiguredPart.new(slice)
19
25
 
@@ -28,7 +34,7 @@ module Hanami
28
34
  #
29
35
  # Use this when you need to access helpers inside your part classes.
30
36
  #
31
- # @return PartHelpers
37
+ # @return [Object] the helpers object
32
38
  #
33
39
  # @api public
34
40
  # @since 2.1.0
@@ -50,10 +56,16 @@ module Hanami
50
56
 
51
57
  include StandardHelpers
52
58
 
59
+ # @api private
60
+ # @since 2.1.0
53
61
  def self.configure_for_slice(slice)
54
62
  extend SliceConfiguredHelpers.new(slice)
55
63
  end
56
64
 
65
+ # Returns the context for the current view rendering.
66
+ #
67
+ # @return [Hanami::View::Context] the context
68
+ #
57
69
  # @api public
58
70
  # @since 2.1.0
59
71
  attr_reader :_context
@@ -4,7 +4,10 @@ module Hanami
4
4
  module Extensions
5
5
  module View
6
6
  # @api private
7
+ # @since 2.1.0
7
8
  module Scope
9
+ # @api private
10
+ # @since 2.1.0
8
11
  def self.included(scope_class)
9
12
  super
10
13
 
@@ -13,7 +16,11 @@ module Hanami
13
16
  scope_class.extend(ClassMethods)
14
17
  end
15
18
 
19
+ # @api private
20
+ # @since 2.1.0
16
21
  module ClassMethods
22
+ # @api private
23
+ # @since 2.1.0
17
24
  def configure_for_slice(slice)
18
25
  extend SliceConfiguredHelpers.new(slice)
19
26
  end
@@ -3,35 +3,39 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
- # Provides slice-specific configuration and behavior for any view context class
7
- # defined within a slice's module namespace.
6
+ # Provides slice-specific configuration and behavior for any view context class defined within
7
+ # a slice's module namespace.
8
8
  #
9
- # @api private
10
- # @since 2.0.0
9
+ # @api public
10
+ # @since 2.1.0
11
11
  class SliceConfiguredContext < Module
12
12
  attr_reader :slice
13
13
 
14
+ # @api private
15
+ # @since 2.1.0
14
16
  def initialize(slice)
15
17
  super()
16
18
  @slice = slice
17
19
  end
18
20
 
21
+ # @api private
22
+ # @since 2.1.0
19
23
  def extended(_context_class)
20
24
  define_new
21
25
  end
22
26
 
27
+ # @api public
28
+ # @since 2.1.0
23
29
  def inspect
24
30
  "#<#{self.class.name}[#{slice.name}]>"
25
31
  end
26
32
 
27
33
  private
28
34
 
29
- # Defines a {.new} method on the context class that resolves key components from
30
- # the app container and provides them to {#initialize} as injected
31
- # dependencies.
35
+ # Defines a {.new} method on the context class that resolves key components from the app
36
+ # container and provides them to {#initialize} as injected dependencies.
32
37
  #
33
38
  # This includes the following app components:
34
- #
35
39
  # - the configured inflector as `inflector`
36
40
  # - "settings" from the app container as `settings`
37
41
  # - "routes" from the app container as `routes`
@@ -3,19 +3,30 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
- # @api private
6
+ # Provides slice-specific helper methods any view object requiring access to helpers.
7
+ #
8
+ # @api public
9
+ # @since 2.1.0
7
10
  class SliceConfiguredHelpers < Module
8
11
  attr_reader :slice
9
12
 
13
+ # @api private
14
+ # @since 2.1.0
10
15
  def initialize(slice)
11
16
  super()
12
17
  @slice = slice
13
18
  end
14
19
 
20
+ # @api private
21
+ # @since 2.1.0
15
22
  def extended(klass)
16
23
  include_helpers(klass)
17
24
  end
18
25
 
26
+ # @return [String]
27
+ #
28
+ # @api public
29
+ # @since 2.1.0
19
30
  def inspect
20
31
  "#<#{self.class.name}[#{slice.name}]>"
21
32
  end
@@ -6,7 +6,7 @@ module Hanami
6
6
  # Provides slice-specific configuration and behavior for any view part class defined within a
7
7
  # slice's module namespace.
8
8
  #
9
- # @api private
9
+ # @api public
10
10
  # @since 2.1.0
11
11
  class SliceConfiguredPart < Module
12
12
  attr_reader :slice
@@ -24,7 +24,9 @@ module Hanami
24
24
  define_new
25
25
  end
26
26
 
27
- # @api private
27
+ # @return [String]
28
+ #
29
+ # @api public
28
30
  # @since 2.1.0
29
31
  def inspect
30
32
  "#<#{self.class.name}[#{slice.name}]>"
@@ -49,9 +51,6 @@ module Hanami
49
51
  # # Useful when unit testing parts
50
52
  # part = MyApp::Views::Parts::Post.new(value: hello_world_post)
51
53
  # part.title_tag # => "<h1>Hello world</h1>"
52
- #
53
- # @api private
54
- # @since 2.1.0
55
54
  def define_new
56
55
  slice = self.slice
57
56
 
@@ -3,11 +3,11 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
- # Provides slice-specific configuration and behavior for any view class defined
7
- # within a slice's module namespace.
6
+ # Provides slice-specific configuration and behavior for any view class defined within a
7
+ # slice's module namespace.
8
8
  #
9
- # @api private
10
- # @since 2.0.0
9
+ # @api public
10
+ # @since 2.1.0
11
11
  class SliceConfiguredView < Module
12
12
  TEMPLATES_DIR = "templates"
13
13
  VIEWS_DIR = "views"
@@ -16,17 +16,25 @@ module Hanami
16
16
 
17
17
  attr_reader :slice
18
18
 
19
+ # @api private
20
+ # @since 2.1.0
19
21
  def initialize(slice)
20
22
  super()
21
23
  @slice = slice
22
24
  end
23
25
 
26
+ # @api private
27
+ # @since 2.1.0
24
28
  def extended(view_class)
25
29
  load_app_view
26
30
  configure_view(view_class)
27
31
  define_inherited
28
32
  end
29
33
 
34
+ # @return [String]
35
+ #
36
+ # @api public
37
+ # @since 2.1.0
30
38
  def inspect
31
39
  "#<#{self.class.name}[#{slice.name}]>"
32
40
  end
@@ -3,6 +3,10 @@
3
3
  module Hanami
4
4
  module Extensions
5
5
  module View
6
+ # Module including the standard library of Hanami helpers
7
+ #
8
+ # @api public
9
+ # @since 2.1.0
6
10
  module StandardHelpers
7
11
  include Hanami::View::Helpers::EscapeHelper
8
12
  include Hanami::View::Helpers::NumberFormattingHelper
@@ -7,13 +7,13 @@ module Hanami
7
7
  module Extensions
8
8
  # Integrated behavior for `Hanami::View` classes within Hanami apps.
9
9
  #
10
- # This is NOT RELEASED as of 2.0.0.
11
- #
12
10
  # @see Hanami::View
13
11
  #
14
- # @api private
12
+ # @api public
13
+ # @since 2.1.0
15
14
  module View
16
15
  # @api private
16
+ # @since 2.1.0
17
17
  def self.included(view_class)
18
18
  super
19
19
 
@@ -22,8 +22,10 @@ module Hanami
22
22
  end
23
23
 
24
24
  # @api private
25
+ # @since 2.1.0
25
26
  module ClassMethods
26
27
  # @api private
28
+ # @since 2.1.0
27
29
  def configure_for_slice(slice)
28
30
  extend SliceConfiguredView.new(slice)
29
31
  end
@@ -99,58 +99,58 @@ module Hanami
99
99
  #
100
100
  # @example Single Asset
101
101
  #
102
- # <%= js "application" %>
102
+ # <%= javascript_tag "application" %>
103
103
  #
104
104
  # # <script src="/assets/application.js" type="text/javascript"></script>
105
105
  #
106
106
  # @example Multiple Assets
107
107
  #
108
- # <%= js "application", "dashboard" %>
108
+ # <%= javascript_tag "application", "dashboard" %>
109
109
  #
110
110
  # # <script src="/assets/application.js" type="text/javascript"></script>
111
111
  # # <script src="/assets/dashboard.js" type="text/javascript"></script>
112
112
  #
113
113
  # @example Asynchronous Execution
114
114
  #
115
- # <%= js "application", async: true %>
115
+ # <%= javascript_tag "application", async: true %>
116
116
  #
117
117
  # # <script src="/assets/application.js" type="text/javascript" async="async"></script>
118
118
  #
119
119
  # @example Subresource Integrity
120
120
  #
121
- # <%= js "application" %>
121
+ # <%= javascript_tag "application" %>
122
122
  #
123
123
  # # <script src="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js"
124
124
  # # type="text/javascript" integrity="sha384-oqVu...Y8wC" crossorigin="anonymous"></script>
125
125
  #
126
126
  # @example Subresource Integrity for 3rd Party Scripts
127
127
  #
128
- # <%= js "https://example.com/assets/example.js", integrity: "sha384-oqVu...Y8wC" %>
128
+ # <%= javascript_tag "https://example.com/assets/example.js", integrity: "sha384-oqVu...Y8wC" %>
129
129
  #
130
130
  # # <script src="https://example.com/assets/example.js" type="text/javascript"
131
131
  # # integrity="sha384-oqVu...Y8wC" crossorigin="anonymous"></script>
132
132
  #
133
133
  # @example Deferred Execution
134
134
  #
135
- # <%= js "application", defer: true %>
135
+ # <%= javascript_tag "application", defer: true %>
136
136
  #
137
137
  # # <script src="/assets/application.js" type="text/javascript" defer="defer"></script>
138
138
  #
139
139
  # @example Absolute URL
140
140
  #
141
- # <%= js "https://code.jquery.com/jquery-2.1.4.min.js" %>
141
+ # <%= javascript_tag "https://code.jquery.com/jquery-2.1.4.min.js" %>
142
142
  #
143
143
  # # <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script>
144
144
  #
145
145
  # @example Fingerprint Mode
146
146
  #
147
- # <%= js "application" %>
147
+ # <%= javascript_tag "application" %>
148
148
  #
149
149
  # # <script src="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js" type="text/javascript"></script>
150
150
  #
151
151
  # @example CDN Mode
152
152
  #
153
- # <%= js "application" %>
153
+ # <%= javascript_tag "application" %>
154
154
  #
155
155
  # # <script src="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.js"
156
156
  # # type="text/javascript"></script>
@@ -203,47 +203,47 @@ module Hanami
203
203
  #
204
204
  # @example Single Asset
205
205
  #
206
- # <%= css "application" %>
206
+ # <%= stylesheet_tag "application" %>
207
207
  #
208
208
  # # <link href="/assets/application.css" type="text/css" rel="stylesheet">
209
209
  #
210
210
  # @example Multiple Assets
211
211
  #
212
- # <%= css "application", "dashboard" %>
212
+ # <%= stylesheet_tag "application", "dashboard" %>
213
213
  #
214
214
  # # <link href="/assets/application.css" type="text/css" rel="stylesheet">
215
215
  # # <link href="/assets/dashboard.css" type="text/css" rel="stylesheet">
216
216
  #
217
217
  # @example Subresource Integrity
218
218
  #
219
- # <%= css "application" %>
219
+ # <%= stylesheet_tag "application" %>
220
220
  #
221
221
  # # <link href="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css"
222
222
  # # type="text/css" integrity="sha384-oqVu...Y8wC" crossorigin="anonymous"></script>
223
223
  #
224
224
  # @example Subresource Integrity for 3rd Party Assets
225
225
  #
226
- # <%= css "https://example.com/assets/example.css", integrity: "sha384-oqVu...Y8wC" %>
226
+ # <%= stylesheet_tag "https://example.com/assets/example.css", integrity: "sha384-oqVu...Y8wC" %>
227
227
  #
228
228
  # # <link href="https://example.com/assets/example.css"
229
229
  # # type="text/css" rel="stylesheet" integrity="sha384-oqVu...Y8wC" crossorigin="anonymous"></script>
230
230
  #
231
231
  # @example Absolute URL
232
232
  #
233
- # <%= css "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" %>
233
+ # <%= stylesheet_tag "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" %>
234
234
  #
235
235
  # # <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
236
236
  # # type="text/css" rel="stylesheet">
237
237
  #
238
238
  # @example Fingerprint Mode
239
239
  #
240
- # <%= css "application" %>
240
+ # <%= stylesheet_tag "application" %>
241
241
  #
242
242
  # # <link href="/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css" type="text/css" rel="stylesheet">
243
243
  #
244
244
  # @example CDN Mode
245
245
  #
246
- # <%= css "application" %>
246
+ # <%= stylesheet_tag "application" %>
247
247
  #
248
248
  # # <link href="https://assets.bookshelf.org/assets/application-28a6b886de2372ee3922fcaf3f78f2d8.css"
249
249
  # # type="text/css" rel="stylesheet">
@@ -297,37 +297,37 @@ module Hanami
297
297
  #
298
298
  # @example Basic Usage
299
299
  #
300
- # <%= image "logo.png" %>
300
+ # <%= image_tag "logo.png" %>
301
301
  #
302
302
  # # <img src="/assets/logo.png" alt="Logo">
303
303
  #
304
304
  # @example Custom alt Attribute
305
305
  #
306
- # <%= image "logo.png", alt: "Application Logo" %>
306
+ # <%= image_tag "logo.png", alt: "Application Logo" %>
307
307
  #
308
308
  # # <img src="/assets/logo.png" alt="Application Logo">
309
309
  #
310
310
  # @example Custom HTML Attributes
311
311
  #
312
- # <%= image "logo.png", id: "logo", class: "image" %>
312
+ # <%= image_tag "logo.png", id: "logo", class: "image" %>
313
313
  #
314
314
  # # <img src="/assets/logo.png" alt="Logo" id="logo" class="image">
315
315
  #
316
316
  # @example Absolute URL
317
317
  #
318
- # <%= image "https://example-cdn.com/images/logo.png" %>
318
+ # <%= image_tag "https://example-cdn.com/images/logo.png" %>
319
319
  #
320
320
  # # <img src="https://example-cdn.com/images/logo.png" alt="Logo">
321
321
  #
322
322
  # @example Fingerprint Mode
323
323
  #
324
- # <%= image "logo.png" %>
324
+ # <%= image_tag "logo.png" %>
325
325
  #
326
326
  # # <img src="/assets/logo-28a6b886de2372ee3922fcaf3f78f2d8.png" alt="Logo">
327
327
  #
328
328
  # @example CDN Mode
329
329
  #
330
- # <%= image "logo.png" %>
330
+ # <%= image_tag "logo.png" %>
331
331
  #
332
332
  # # <img src="https://assets.bookshelf.org/assets/logo-28a6b886de2372ee3922fcaf3f78f2d8.png" alt="Logo">
333
333
  def image_tag(source, options = {})
@@ -368,31 +368,31 @@ module Hanami
368
368
  #
369
369
  # @example Basic Usage
370
370
  #
371
- # <%= favicon %>
371
+ # <%= favicon_tag %>
372
372
  #
373
373
  # # <link href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon">
374
374
  #
375
375
  # @example Custom Path
376
376
  #
377
- # <%= favicon "fav.ico" %>
377
+ # <%= favicon_tag "fav.ico" %>
378
378
  #
379
379
  # # <link href="/assets/fav.ico" rel="shortcut icon" type="image/x-icon">
380
380
  #
381
381
  # @example Custom HTML Attributes
382
382
  #
383
- # <%= favicon "favicon.ico", id: "fav" %>
383
+ # <%= favicon_tag "favicon.ico", id: "fav" %>
384
384
  #
385
385
  # # <link id: "fav" href="/assets/favicon.ico" rel="shortcut icon" type="image/x-icon">
386
386
  #
387
387
  # @example Fingerprint Mode
388
388
  #
389
- # <%= favicon %>
389
+ # <%= favicon_tag %>
390
390
  #
391
391
  # # <link href="/assets/favicon-28a6b886de2372ee3922fcaf3f78f2d8.ico" rel="shortcut icon" type="image/x-icon">
392
392
  #
393
393
  # @example CDN Mode
394
394
  #
395
- # <%= favicon %>
395
+ # <%= favicon_tag %>
396
396
  #
397
397
  # # <link href="https://assets.bookshelf.org/assets/favicon-28a6b886de2372ee3922fcaf3f78f2d8.ico"
398
398
  # rel="shortcut icon" type="image/x-icon">
@@ -442,19 +442,19 @@ module Hanami
442
442
  #
443
443
  # @example Basic Usage
444
444
  #
445
- # <%= video "movie.mp4" %>
445
+ # <%= video_tag "movie.mp4" %>
446
446
  #
447
447
  # # <video src="/assets/movie.mp4"></video>
448
448
  #
449
449
  # @example Absolute URL
450
450
  #
451
- # <%= video "https://example-cdn.com/assets/movie.mp4" %>
451
+ # <%= video_tag "https://example-cdn.com/assets/movie.mp4" %>
452
452
  #
453
453
  # # <video src="https://example-cdn.com/assets/movie.mp4"></video>
454
454
  #
455
455
  # @example Custom HTML Attributes
456
456
  #
457
- # <%= video("movie.mp4", autoplay: true, controls: true) %>
457
+ # <%= video_tag("movie.mp4", autoplay: true, controls: true) %>
458
458
  #
459
459
  # # <video src="/assets/movie.mp4" autoplay="autoplay" controls="controls"></video>
460
460
  #
@@ -485,25 +485,25 @@ module Hanami
485
485
  #
486
486
  # @example Without Any Argument
487
487
  #
488
- # <%= video %>
488
+ # <%= video_tag %>
489
489
  #
490
490
  # # ArgumentError
491
491
  #
492
492
  # @example Without src And Without Block
493
493
  #
494
- # <%= video(content: true) %>
494
+ # <%= video_tag(content: true) %>
495
495
  #
496
496
  # # ArgumentError
497
497
  #
498
498
  # @example Fingerprint Mode
499
499
  #
500
- # <%= video "movie.mp4" %>
500
+ # <%= video_tag "movie.mp4" %>
501
501
  #
502
502
  # # <video src="/assets/movie-28a6b886de2372ee3922fcaf3f78f2d8.mp4"></video>
503
503
  #
504
504
  # @example CDN Mode
505
505
  #
506
- # <%= video "movie.mp4" %>
506
+ # <%= video_tag "movie.mp4" %>
507
507
  #
508
508
  # # <video src="https://assets.bookshelf.org/assets/movie-28a6b886de2372ee3922fcaf3f78f2d8.mp4"></video>
509
509
  def video_tag(source = nil, options = {}, &blk)
@@ -544,19 +544,19 @@ module Hanami
544
544
  #
545
545
  # @example Basic Usage
546
546
  #
547
- # <%= audio "song.ogg" %>
547
+ # <%= audio_tag "song.ogg" %>
548
548
  #
549
549
  # # <audio src="/assets/song.ogg"></audio>
550
550
  #
551
551
  # @example Absolute URL
552
552
  #
553
- # <%= audio "https://example-cdn.com/assets/song.ogg" %>
553
+ # <%= audio_tag "https://example-cdn.com/assets/song.ogg" %>
554
554
  #
555
555
  # # <audio src="https://example-cdn.com/assets/song.ogg"></audio>
556
556
  #
557
557
  # @example Custom HTML Attributes
558
558
  #
559
- # <%= audio("song.ogg", autoplay: true, controls: true) %>
559
+ # <%= audio_tag("song.ogg", autoplay: true, controls: true) %>
560
560
  #
561
561
  # # <audio src="/assets/song.ogg" autoplay="autoplay" controls="controls"></audio>
562
562
  #
@@ -587,25 +587,25 @@ module Hanami
587
587
  #
588
588
  # @example Without Any Argument
589
589
  #
590
- # <%= audio %>
590
+ # <%= audio_tag %>
591
591
  #
592
592
  # # ArgumentError
593
593
  #
594
594
  # @example Without src And Without Block
595
595
  #
596
- # <%= audio(controls: true) %>
596
+ # <%= audio_tag(controls: true) %>
597
597
  #
598
598
  # # ArgumentError
599
599
  #
600
600
  # @example Fingerprint Mode
601
601
  #
602
- # <%= audio "song.ogg" %>
602
+ # <%= audio_tag "song.ogg" %>
603
603
  #
604
604
  # # <audio src="/assets/song-28a6b886de2372ee3922fcaf3f78f2d8.ogg"></audio>
605
605
  #
606
606
  # @example CDN Mode
607
607
  #
608
- # <%= audio "song.ogg" %>
608
+ # <%= audio_tag "song.ogg" %>
609
609
  #
610
610
  # # <audio src="https://assets.bookshelf.org/assets/song-28a6b886de2372ee3922fcaf3f78f2d8.ogg"></audio>
611
611
  def audio_tag(source = nil, options = {}, &blk)
@@ -7,7 +7,7 @@ module Hanami
7
7
  # @api private
8
8
  module Version
9
9
  # @api public
10
- VERSION = "2.1.0.rc1"
10
+ VERSION = "2.1.0.rc2"
11
11
 
12
12
  # @since 0.9.0
13
13
  # @api private
@@ -15,7 +15,7 @@ RSpec.describe Hanami::Config, "#render_detailed_errors" do
15
15
 
16
16
  context "test mode" do
17
17
  let(:env) { :test }
18
- it { is_expected.to be true }
18
+ it { is_expected.to be false }
19
19
  end
20
20
 
21
21
  context "production mode" 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.rc1")
5
+ expect(Hanami::VERSION).to eq("2.1.0.rc2")
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.rc1
4
+ version: 2.1.0.rc2
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-11-01 00:00:00.000000000 Z
11
+ date: 2023-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -162,28 +162,28 @@ dependencies:
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 2.1.beta
165
+ version: 2.1.rc
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.beta
172
+ version: 2.1.rc
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.beta
179
+ version: 2.1.rc
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.beta
186
+ version: 2.1.rc
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: zeitwerk
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -450,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
450
  - !ruby/object:Gem::Version
451
451
  version: 1.3.1
452
452
  requirements: []
453
- rubygems_version: 3.4.13
453
+ rubygems_version: 3.4.21
454
454
  signing_key:
455
455
  specification_version: 4
456
456
  summary: The web, with simplicity