hanami 2.0.0.alpha8 → 2.0.0.beta1

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.
Files changed (224) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +442 -241
  3. data/FEATURES.md +30 -9
  4. data/README.md +1 -3
  5. data/hanami.gemspec +21 -11
  6. data/lib/hanami/app.rb +141 -0
  7. data/lib/hanami/assets/application_configuration.rb +10 -4
  8. data/lib/hanami/configuration/actions/content_security_policy.rb +5 -5
  9. data/lib/hanami/configuration/actions/cookies.rb +2 -2
  10. data/lib/hanami/configuration/actions.rb +10 -4
  11. data/lib/hanami/configuration/logger.rb +4 -4
  12. data/lib/hanami/configuration/router.rb +2 -6
  13. data/lib/hanami/configuration/sessions.rb +1 -1
  14. data/lib/hanami/configuration/views.rb +9 -4
  15. data/lib/hanami/configuration.rb +118 -46
  16. data/lib/hanami/constants.rb +24 -2
  17. data/lib/hanami/errors.rb +1 -1
  18. data/lib/hanami/{application → extensions}/action/slice_configured_action.rb +9 -9
  19. data/lib/hanami/extensions/action.rb +79 -0
  20. data/lib/hanami/extensions/view/context.rb +106 -0
  21. data/lib/hanami/{application → extensions}/view/slice_configured_context.rb +10 -10
  22. data/lib/hanami/{application → extensions}/view/slice_configured_view.rb +12 -6
  23. data/lib/hanami/extensions/view.rb +33 -0
  24. data/lib/hanami/extensions.rb +10 -0
  25. data/lib/hanami/providers/inflector.rb +13 -0
  26. data/lib/hanami/providers/logger.rb +13 -0
  27. data/lib/hanami/providers/rack.rb +27 -0
  28. data/lib/hanami/providers/routes.rb +33 -0
  29. data/lib/hanami/providers/settings.rb +23 -0
  30. data/lib/hanami/rake_tasks.rb +61 -0
  31. data/lib/hanami/routes.rb +51 -0
  32. data/lib/hanami/server.rb +1 -1
  33. data/lib/hanami/settings/dotenv_store.rb +58 -0
  34. data/lib/hanami/settings.rb +90 -0
  35. data/lib/hanami/setup.rb +4 -2
  36. data/lib/hanami/{application → slice}/router.rb +18 -13
  37. data/lib/hanami/slice/routes_helper.rb +37 -0
  38. data/lib/hanami/{application → slice}/routing/middleware/stack.rb +43 -5
  39. data/lib/hanami/slice/routing/resolver.rb +97 -0
  40. data/lib/hanami/{application → slice}/view_name_inferrer.rb +3 -3
  41. data/lib/hanami/slice.rb +246 -73
  42. data/lib/hanami/slice_configurable.rb +4 -17
  43. data/lib/hanami/slice_name.rb +6 -6
  44. data/lib/hanami/slice_registrar.rb +119 -0
  45. data/lib/hanami/version.rb +1 -1
  46. data/lib/hanami/web/rack_logger.rb +1 -1
  47. data/lib/hanami.rb +34 -26
  48. data/spec/integration/application_middleware_stack_spec.rb +84 -0
  49. data/spec/integration/assets/cdn_spec.rb +48 -0
  50. data/spec/integration/assets/fingerprint_spec.rb +42 -0
  51. data/spec/integration/assets/helpers_spec.rb +50 -0
  52. data/spec/integration/assets/serve_spec.rb +70 -0
  53. data/spec/integration/assets/subresource_integrity_spec.rb +54 -0
  54. data/spec/integration/body_parsers_spec.rb +50 -0
  55. data/spec/integration/cli/assets/precompile_spec.rb +147 -0
  56. data/spec/integration/cli/assets_spec.rb +14 -0
  57. data/spec/integration/cli/console_spec.rb +105 -0
  58. data/spec/integration/cli/db/apply_spec.rb +74 -0
  59. data/spec/integration/cli/db/console_spec.rb +40 -0
  60. data/spec/integration/cli/db/create_spec.rb +50 -0
  61. data/spec/integration/cli/db/drop_spec.rb +54 -0
  62. data/spec/integration/cli/db/migrate_spec.rb +108 -0
  63. data/spec/integration/cli/db/prepare_spec.rb +36 -0
  64. data/spec/integration/cli/db/rollback_spec.rb +96 -0
  65. data/spec/integration/cli/db/version_spec.rb +38 -0
  66. data/spec/integration/cli/db_spec.rb +21 -0
  67. data/spec/integration/cli/destroy/action_spec.rb +143 -0
  68. data/spec/integration/cli/destroy/app_spec.rb +118 -0
  69. data/spec/integration/cli/destroy/mailer_spec.rb +74 -0
  70. data/spec/integration/cli/destroy/migration_spec.rb +70 -0
  71. data/spec/integration/cli/destroy/model_spec.rb +113 -0
  72. data/spec/integration/cli/destroy_spec.rb +18 -0
  73. data/spec/integration/cli/generate/action_spec.rb +469 -0
  74. data/spec/integration/cli/generate/app_spec.rb +215 -0
  75. data/spec/integration/cli/generate/mailer_spec.rb +189 -0
  76. data/spec/integration/cli/generate/migration_spec.rb +72 -0
  77. data/spec/integration/cli/generate/model_spec.rb +290 -0
  78. data/spec/integration/cli/generate/secret_spec.rb +56 -0
  79. data/spec/integration/cli/generate_spec.rb +19 -0
  80. data/spec/integration/cli/new/database_spec.rb +235 -0
  81. data/spec/integration/cli/new/hanami_head_spec.rb +27 -0
  82. data/spec/integration/cli/new/template_spec.rb +118 -0
  83. data/spec/integration/cli/new/test_spec.rb +274 -0
  84. data/spec/integration/cli/new_spec.rb +970 -0
  85. data/spec/integration/cli/plugins_spec.rb +39 -0
  86. data/spec/integration/cli/routes_spec.rb +49 -0
  87. data/spec/integration/cli/server_spec.rb +626 -0
  88. data/spec/integration/cli/version_spec.rb +85 -0
  89. data/spec/integration/early_hints_spec.rb +35 -0
  90. data/spec/integration/handle_exceptions_spec.rb +244 -0
  91. data/spec/integration/head_spec.rb +89 -0
  92. data/spec/integration/http_headers_spec.rb +29 -0
  93. data/spec/integration/mailer_spec.rb +32 -0
  94. data/spec/integration/middleware_spec.rb +81 -0
  95. data/spec/integration/mount_applications_spec.rb +88 -0
  96. data/spec/integration/project_initializers_spec.rb +40 -0
  97. data/spec/integration/rackup_spec.rb +35 -0
  98. data/spec/integration/rake/with_minitest_spec.rb +67 -0
  99. data/spec/integration/rake/with_rspec_spec.rb +69 -0
  100. data/spec/integration/routing_helpers_spec.rb +61 -0
  101. data/spec/integration/security/content_security_policy_spec.rb +46 -0
  102. data/spec/integration/security/csrf_protection_spec.rb +42 -0
  103. data/spec/integration/security/force_ssl_spec.rb +29 -0
  104. data/spec/integration/security/x_content_type_options_spec.rb +46 -0
  105. data/spec/integration/security/x_frame_options_spec.rb +46 -0
  106. data/spec/integration/security/x_xss_protection_spec.rb +46 -0
  107. data/spec/integration/send_file_spec.rb +51 -0
  108. data/spec/integration/sessions_spec.rb +247 -0
  109. data/spec/integration/static_middleware_spec.rb +21 -0
  110. data/spec/integration/streaming_spec.rb +41 -0
  111. data/spec/integration/unsafe_send_file_spec.rb +52 -0
  112. data/spec/isolation/hanami/application/already_configured_spec.rb +19 -0
  113. data/spec/isolation/hanami/application/inherit_anonymous_class_spec.rb +10 -0
  114. data/spec/isolation/hanami/application/inherit_concrete_class_spec.rb +14 -0
  115. data/spec/isolation/hanami/application/not_configured_spec.rb +9 -0
  116. data/spec/isolation/hanami/application/routes/configured_spec.rb +44 -0
  117. data/spec/isolation/hanami/application/routes/not_configured_spec.rb +16 -0
  118. data/spec/isolation/hanami/boot/success_spec.rb +50 -0
  119. data/spec/new_integration/action/configuration_spec.rb +26 -0
  120. data/spec/new_integration/action/cookies_spec.rb +58 -0
  121. data/spec/new_integration/action/csrf_protection_spec.rb +54 -0
  122. data/spec/new_integration/action/routes_spec.rb +73 -0
  123. data/spec/new_integration/action/sessions_spec.rb +50 -0
  124. data/spec/new_integration/action/view_integration_spec.rb +165 -0
  125. data/spec/new_integration/action/view_rendering/automatic_rendering_spec.rb +247 -0
  126. data/spec/new_integration/action/view_rendering/paired_view_inference_spec.rb +115 -0
  127. data/spec/new_integration/action/view_rendering_spec.rb +107 -0
  128. data/spec/new_integration/code_loading/loading_from_app_spec.rb +152 -0
  129. data/spec/new_integration/code_loading/loading_from_slice_spec.rb +165 -0
  130. data/spec/new_integration/container/application_routes_helper_spec.rb +48 -0
  131. data/spec/new_integration/container/auto_injection_spec.rb +53 -0
  132. data/spec/new_integration/container/auto_registration_spec.rb +86 -0
  133. data/spec/new_integration/container/autoloader_spec.rb +80 -0
  134. data/spec/new_integration/container/imports_spec.rb +253 -0
  135. data/spec/new_integration/container/prepare_container_spec.rb +123 -0
  136. data/spec/new_integration/container/shutdown_spec.rb +91 -0
  137. data/spec/new_integration/container/standard_bootable_components_spec.rb +124 -0
  138. data/spec/new_integration/rack_app/middleware_spec.rb +215 -0
  139. data/spec/new_integration/rack_app/non_booted_rack_app_spec.rb +105 -0
  140. data/spec/new_integration/rack_app/rack_app_spec.rb +524 -0
  141. data/spec/new_integration/settings_spec.rb +115 -0
  142. data/spec/new_integration/slices/external_slice_spec.rb +92 -0
  143. data/spec/new_integration/slices/slice_configuration_spec.rb +40 -0
  144. data/spec/new_integration/slices/slice_routing_spec.rb +226 -0
  145. data/spec/new_integration/slices/slice_settings_spec.rb +141 -0
  146. data/spec/new_integration/slices_spec.rb +101 -0
  147. data/spec/new_integration/view/configuration_spec.rb +49 -0
  148. data/spec/new_integration/view/context/assets_spec.rb +67 -0
  149. data/spec/new_integration/view/context/inflector_spec.rb +48 -0
  150. data/spec/new_integration/view/context/request_spec.rb +61 -0
  151. data/spec/new_integration/view/context/routes_spec.rb +86 -0
  152. data/spec/new_integration/view/context/settings_spec.rb +50 -0
  153. data/spec/new_integration/view/inflector_spec.rb +57 -0
  154. data/spec/new_integration/view/part_namespace_spec.rb +96 -0
  155. data/spec/new_integration/view/path_spec.rb +56 -0
  156. data/spec/new_integration/view/template_spec.rb +68 -0
  157. data/spec/new_integration/view/views_spec.rb +103 -0
  158. data/spec/spec_helper.rb +16 -0
  159. data/spec/support/app_integration.rb +91 -0
  160. data/spec/support/coverage.rb +1 -0
  161. data/spec/support/fixtures/hanami-plugin/Gemfile +8 -0
  162. data/spec/support/fixtures/hanami-plugin/README.md +35 -0
  163. data/spec/support/fixtures/hanami-plugin/Rakefile +4 -0
  164. data/spec/support/fixtures/hanami-plugin/bin/console +15 -0
  165. data/spec/support/fixtures/hanami-plugin/bin/setup +8 -0
  166. data/spec/support/fixtures/hanami-plugin/hanami-plugin.gemspec +28 -0
  167. data/spec/support/fixtures/hanami-plugin/lib/hanami/plugin/cli.rb +19 -0
  168. data/spec/support/fixtures/hanami-plugin/lib/hanami/plugin/version.rb +7 -0
  169. data/spec/support/fixtures/hanami-plugin/lib/hanami/plugin.rb +8 -0
  170. data/spec/support/rspec.rb +27 -0
  171. data/spec/support/shared_examples/cli/generate/app.rb +494 -0
  172. data/spec/support/shared_examples/cli/generate/migration.rb +32 -0
  173. data/spec/support/shared_examples/cli/generate/model.rb +81 -0
  174. data/spec/support/shared_examples/cli/new.rb +97 -0
  175. data/spec/unit/hanami/configuration/actions/content_security_policy_spec.rb +102 -0
  176. data/spec/unit/hanami/configuration/actions/cookies_spec.rb +46 -0
  177. data/spec/unit/hanami/configuration/actions/csrf_protection_spec.rb +57 -0
  178. data/spec/unit/hanami/configuration/actions/default_values_spec.rb +52 -0
  179. data/spec/unit/hanami/configuration/actions/sessions_spec.rb +50 -0
  180. data/spec/unit/hanami/configuration/actions_spec.rb +78 -0
  181. data/spec/unit/hanami/configuration/base_url_spec.rb +25 -0
  182. data/spec/unit/hanami/configuration/inflector_spec.rb +35 -0
  183. data/spec/unit/hanami/configuration/logger_spec.rb +203 -0
  184. data/spec/unit/hanami/configuration/views_spec.rb +120 -0
  185. data/spec/unit/hanami/configuration_spec.rb +43 -0
  186. data/spec/unit/hanami/env_spec.rb +54 -0
  187. data/spec/unit/hanami/routes_spec.rb +25 -0
  188. data/spec/unit/hanami/settings/dotenv_store_spec.rb +119 -0
  189. data/spec/unit/hanami/settings_spec.rb +56 -0
  190. data/spec/unit/hanami/slice_configurable_spec.rb +104 -0
  191. data/spec/unit/hanami/slice_name_spec.rb +47 -0
  192. data/spec/unit/hanami/slice_spec.rb +17 -0
  193. data/spec/unit/hanami/version_spec.rb +7 -0
  194. data/spec/unit/hanami/web/rack_logger_spec.rb +78 -0
  195. metadata +353 -57
  196. data/lib/hanami/application/action.rb +0 -72
  197. data/lib/hanami/application/container/providers/inflector.rb +0 -7
  198. data/lib/hanami/application/container/providers/logger.rb +0 -7
  199. data/lib/hanami/application/container/providers/rack_logger.rb +0 -15
  200. data/lib/hanami/application/container/providers/rack_monitor.rb +0 -12
  201. data/lib/hanami/application/container/providers/routes_helper.rb +0 -9
  202. data/lib/hanami/application/container/providers/settings.rb +0 -7
  203. data/lib/hanami/application/routes.rb +0 -55
  204. data/lib/hanami/application/routes_helper.rb +0 -34
  205. data/lib/hanami/application/routing/resolver/node.rb +0 -50
  206. data/lib/hanami/application/routing/resolver/trie.rb +0 -59
  207. data/lib/hanami/application/routing/resolver.rb +0 -87
  208. data/lib/hanami/application/routing/router.rb +0 -36
  209. data/lib/hanami/application/settings/dotenv_store.rb +0 -60
  210. data/lib/hanami/application/settings.rb +0 -93
  211. data/lib/hanami/application/slice_registrar.rb +0 -106
  212. data/lib/hanami/application/view/context.rb +0 -95
  213. data/lib/hanami/application/view.rb +0 -24
  214. data/lib/hanami/application.rb +0 -273
  215. data/lib/hanami/cli/application/cli.rb +0 -40
  216. data/lib/hanami/cli/application/command.rb +0 -47
  217. data/lib/hanami/cli/application/commands/console.rb +0 -81
  218. data/lib/hanami/cli/application/commands.rb +0 -16
  219. data/lib/hanami/cli/base_command.rb +0 -48
  220. data/lib/hanami/cli/commands/command.rb +0 -171
  221. data/lib/hanami/cli/commands/server.rb +0 -88
  222. data/lib/hanami/cli/commands.rb +0 -65
  223. data/lib/hanami/configuration/middleware.rb +0 -20
  224. data/lib/hanami/configuration/source_dirs.rb +0 -42
data/CHANGELOG.md CHANGED
@@ -1,154 +1,224 @@
1
1
  # Hanami
2
+
2
3
  The web, with simplicity.
3
4
 
4
- ## v2.0.0.alpha8 - 2020-05-19
5
+ ## v2.0.0.beta1 - 2022-07-20
6
+
7
+ ### Added
8
+
9
+ - [Luca Guidi] Added support for `hanami` CLI [#1096]
10
+ - [Luca Guidi] Added support for Rake tasks for compatibility with Ruby hosting services (`db:migrate` and `assets:precompile`) [#1096]
11
+ - [Tim Riley] Add `app/` as source dir for application container [#1174]
12
+ - [Piotr Solnica] Allow Rack middleware to be inserted before/after a specific router middleware [#1176]
13
+
14
+ ```ruby
15
+ # config/routes.rb:
16
+
17
+ module TestApp
18
+ class Routes < Hanami::Routes
19
+ slice :admin, at: "/admin" do
20
+ use TestApp::Middlewares::AppendOne
21
+ use TestApp::Middlewares::Prepare, before: TestApp::Middlewares::AppendOne
22
+ use TestApp::Middlewares::AppendTwo, after: TestApp::Middlewares::AppendOne
23
+ end
24
+ end
25
+ end
26
+ ```
27
+
28
+ ### Fixed
29
+
30
+ - [Tim Riley] Fallback to `RACK_ENV` if `HANAMI_ENV` isn't set [#1168]
31
+ - [Tim Riley] Print error friendly messages when a soft dependency isn't installed [#1166]
32
+ - [Piotr Solnica] Ensure to handle properly Rack middleware that accept a block
33
+
34
+ ```ruby
35
+ # config/app.rb:
36
+
37
+ module TestApp
38
+ class App < Hanami::App
39
+ config.middleware.use(TestApp::TestMiddleware) do |env|
40
+ env["tested"] = "yes"
41
+ end
42
+ end
43
+ end
44
+ ```
45
+
46
+ - [Tim Riley] Ensure to correctly activate session middleware [#1179]
47
+ - [Tim Riley] Avoid redundant auto-registrations for `lib/` files [#1184]
48
+
49
+ ### Changed
50
+
51
+ - [Luca Guidi] Make `app/` the core of Hanami 2 apps
52
+ - [Luca Guidi] `Hanami::Application` -> `Hanami::App`
53
+ - [Luca Guidi] `Hanami.application` -> `Hanami.app`
54
+ - [Luca Guidi] `config/application.rb` -> `config/app.rb`
55
+ - [Luca Guidi] Remove `::Application::` namespace in public API class names (e.g. `Hanami::Application::Routes` -> `Hanami::Routes`) [#1172]
56
+ - [Tim Riley] Removed `Hanami::Configuration#settings_path`, `#settings_class_name` [#1175]
57
+ - [Tim Riley] Removed `Hanami::Configuration::Router#routes_path`, and `#routes_class_name` [#1175]
58
+ - [Tim Riley] Make `Hanami::App` to inherit from `Hanami::Slice` [#1162]
59
+
60
+ ## v2.0.0.alpha8 - 2022-05-19
61
+
62
+ ### Added
5
63
 
6
- ## Added
7
64
  - [Tim Riley] Introduced `Hanami::Application::Action` as base class for actions that integrate with Hanami applications. Base action classes in Hanami applications should now inherit from this.
8
65
  - [Tim Riley] Introduced `Hanami::Application::View` and `Hanami::Application::View::Context` as base classes for views and view contexts that integrate with Hanami applications. Base view classes in Hanami applications should now inherit from these.
9
66
  - [Tim Riley] Introduced `Hanami::Application.application_name`, which returns an `Hanami::SliceName` instance, with methods for representing the application name in various formats.
10
67
 
11
- ## Fixed
68
+ ### Fixed
69
+
12
70
  - [Andrew Croome] When a request is halted, do not attempt to automatically render any view paired with an `Hanami::Application::Action`
13
71
 
14
- ## Changed
72
+ ### Changed
73
+
15
74
  - [Tim Riley] `Hanami::Application.namespace_name`, `.namespace_path` have been removed. These can now be accessed from the `.application_name`.
16
75
  - [Tim Riley] `Hanami::Slice.slice_name` now returns an `Hanami::SliceName` instance instead of a Symbol
17
76
  - [Tim Riley] `Hanami::Slice.namespace_path` has been removed. This can now be accessed from the `.slice_name`.
18
77
 
19
- ## v2.0.0.alpha7.1 - 2020-03-09
78
+ ## v2.0.0.alpha7.1 - 2022-03-09
79
+
80
+ ### Fixed
20
81
 
21
- ## Fixed
22
82
  - [Tim Riley] Fixed error creating slice classes when the enclosing module did not already exist
23
83
 
24
- ## v2.0.0.alpha7 - 2020-03-08
84
+ ## v2.0.0.alpha7 - 2022-03-08
85
+
86
+ ### Added
25
87
 
26
- ## Added
27
88
  - [Tim Riley] Introduced `Hanami::ApplicationLoadError` and `Hanami::SliceLoadError` exceptions to represent errors encountered during application and slice loading.
28
89
  - [Tim Riley] `Hanami::Slice.shutdown` can be used to stop all the providers in a slice
29
90
 
30
- ## Changed
91
+ ### Changed
92
+
31
93
  - [Tim Riley] Slices are now represented as concrete classes (such as `Main::Slice`) inheriting from `Hanami::Slice`, as opposed to _instances_ of `Hanami::Slice`. You may create your own definitions for these slices in `config/slices/[slice_name].rb`, which you can then use for customising per-slice config and behavior, e.g.
32
94
 
33
- ```ruby
34
- # config/slices/main.rb:
95
+ ```ruby
96
+ # config/slices/main.rb:
35
97
 
36
- module Main
37
- class Slice < Hanami::Slice
38
- # slice config here
39
- end
98
+ module Main
99
+ class Slice < Hanami::Slice
100
+ # slice config here
40
101
  end
41
- ```
102
+ end
103
+ ```
104
+
42
105
  - [Tim Riley] Application-level `config.slice(slice_name, &block)` setting has been removed in favour of slice configuration within concrete slice class definitions
43
106
  - [Tim Riley] You can configure your slice imports inside your slice classes, e.g.
44
107
 
45
- ```ruby
46
- # config/slices/main.rb:
108
+ ```ruby
109
+ # config/slices/main.rb:
47
110
 
48
- module Main
49
- class Slice < Hanami::Slice
50
- # Import all exported components from "search" slice
51
- import from: :search
52
- end
111
+ module Main
112
+ class Slice < Hanami::Slice
113
+ # Import all exported components from "search" slice
114
+ import from: :search
53
115
  end
54
- ```
116
+ end
117
+ ```
118
+
55
119
  - [Tim Riley] You can configure your slice exports inside your slice classes, e.g.
56
120
 
57
- ```ruby
58
- # config/slices/search.rb:
121
+ ```ruby
122
+ # config/slices/search.rb:
59
123
 
60
- module Search
61
- class Slice < Hanami::Slice
62
- # Export the "index_entity" component only
63
- export ["index_entity"]
64
- end
124
+ module Search
125
+ class Slice < Hanami::Slice
126
+ # Export the "index_entity" component only
127
+ export ["index_entity"]
65
128
  end
66
- ```
129
+ end
130
+ ```
131
+
67
132
  - [Tim Riley] For advanced cases, you can configure your slice's container via a `prepare_container` block:
68
133
 
69
- ```ruby
70
- # config/slices/search.rb:
134
+ ```ruby
135
+ # config/slices/search.rb:
71
136
 
72
- module Search
73
- class Slice < Hanami::Slice
74
- prepare_container do |container|
75
- # `container` object is available here, with
76
- # slice-specific configuration already applied
77
- end
137
+ module Search
138
+ class Slice < Hanami::Slice
139
+ prepare_container do |container|
140
+ # `container` object is available here, with
141
+ # slice-specific configuration already applied
78
142
  end
79
143
  end
80
- ```
144
+ end
145
+ ```
146
+
81
147
  - [Tim Riley] `Hanami::Application.shutdown` will now also shutdown all registered slices
82
148
 
83
149
  ## v2.0.0.alpha6 - 2022-02-10
150
+
84
151
  ### Added
152
+
85
153
  - [Luca Guidi] Official support for Ruby: MRI 3.1
86
154
  - [Tim Riley] Introduce partial Slice imports and exports. It allows to selectively export a functionality from a slice and import into another.
87
155
 
88
- Import from `search` slice, uses `search` as the imported key namespace:
156
+ Import from `search` slice, uses `search` as the imported key namespace:
89
157
 
90
- ```ruby
91
- # config/application.rb
158
+ ```ruby
159
+ # config/application.rb
92
160
 
93
- module MyApp
94
- class Application < Hanami::Application
95
- config.slice(:admin) do
96
- import(from: :search)
97
- end
161
+ module MyApp
162
+ class Application < Hanami::Application
163
+ config.slice(:admin) do
164
+ import(from: :search)
98
165
  end
99
166
  end
100
- ```
167
+ end
168
+ ```
101
169
 
102
- Import from `search` slice with custom namespace:
170
+ Import from `search` slice with custom namespace:
103
171
 
104
- ```ruby
105
- # config/application.rb
172
+ ```ruby
173
+ # config/application.rb
106
174
 
107
- module MyApp
108
- class Application < Hanami::Application
109
- config.slice(:admin) do
110
- import(from: :search, as: :search_engine)
111
- end
175
+ module MyApp
176
+ class Application < Hanami::Application
177
+ config.slice(:admin) do
178
+ import(from: :search, as: :search_engine)
112
179
  end
113
180
  end
114
- ```
181
+ end
182
+ ```
115
183
 
116
- Import specific keys from `search` slice
184
+ Import specific keys from `search` slice
117
185
 
118
- ```ruby
119
- # config/application.rb
186
+ ```ruby
187
+ # config/application.rb
120
188
 
121
- module MyApp
122
- class Application < Hanami::Application
123
- config.slice(:admin) do
124
- import(keys: ["run_query"], from: :search)
125
- end
189
+ module MyApp
190
+ class Application < Hanami::Application
191
+ config.slice(:admin) do
192
+ import(keys: ["run_query"], from: :search)
126
193
  end
127
194
  end
128
- ```
195
+ end
196
+ ```
129
197
 
130
- Export only specific keys from `search` slice, and import them in `admin`
198
+ Export only specific keys from `search` slice, and import them in `admin`
131
199
 
132
- ```ruby
133
- # config/application.rb
200
+ ```ruby
201
+ # config/application.rb
134
202
 
135
- module MyApp
136
- class Application < Hanami::Application
137
- config.slice(:admin) do
138
- import(from: :search)
139
- end
203
+ module MyApp
204
+ class Application < Hanami::Application
205
+ config.slice(:admin) do
206
+ import(from: :search)
207
+ end
140
208
 
141
- config.slice(:search) do
142
- container.config.exports = %w[run_query index_item]
143
- end
209
+ config.slice(:search) do
210
+ container.config.exports = %w[run_query index_item]
144
211
  end
145
212
  end
146
- ```
213
+ end
214
+ ```
147
215
 
148
216
  ### Fixed
217
+
149
218
  - [Luca Guidi] Ensure request logger to respect logger formatter option.
150
219
 
151
220
  ### Changed
221
+
152
222
  - [Luca Guidi] Drop support for Ruby: MRI 2.6 and 2.7.
153
223
  - [Tim Riley] `Hanami.init` => `Hanami.prepare` and `hanami/init` => `hanami/prepare`
154
224
  - [Tim Riley] `Hanami.register_bootable` => `Hanami.register_provider`
@@ -158,263 +228,280 @@ The web, with simplicity.
158
228
  - [Tim Riley] `Hanami::Slice#start_bootable` => `Hanami::Slice#start`
159
229
 
160
230
  ## v2.0.0.alpha5 - 2022-01-12
231
+
161
232
  ### Changed
233
+
162
234
  - [Luca Guidi] Sensible default configuration for application logger, with per-environment defaults:
163
235
 
164
- The defaults are:
236
+ The defaults are:
165
237
 
166
- - In **production**, log for level `info`, send logs to `$stdout` in JSON format without colours
167
- - In **development**, log for level `debug`, send logs to `$stdout` in single-line format with colours
168
- - In **test**, log for level `debug`, send logs to `log/test.log` in single-line format without colours
238
+ - In **production**, log for level `info`, send logs to `$stdout` in JSON format without colours
239
+ - In **development**, log for level `debug`, send logs to `$stdout` in single-line format with colours
240
+ - In **test**, log for level `debug`, send logs to `log/test.log` in single-line format without colours
169
241
 
170
- To configure the logger:
242
+ To configure the logger:
171
243
 
172
- ```ruby
173
- module MyApp
174
- class Application < Hanami::Application
175
- config.logger.level = :info
244
+ ```ruby
245
+ module MyApp
246
+ class Application < Hanami::Application
247
+ config.logger.level = :info
176
248
 
177
- config.logger.stream = $stdout
178
- config.logger.stream = "/path/to/file"
179
- config.logger.stream = StringIO.new
249
+ config.logger.stream = $stdout
250
+ config.logger.stream = "/path/to/file"
251
+ config.logger.stream = StringIO.new
180
252
 
181
- config.logger.format = :json
182
- config.logger.format = MyCustomFormatter.new
253
+ config.logger.format = :json
254
+ config.logger.format = MyCustomFormatter.new
183
255
 
184
- config.logger.color = false # disable coloring
185
- config.logger.color = MyCustomColorizer.new
256
+ config.logger.color = false # disable coloring
257
+ config.logger.color = MyCustomColorizer.new
186
258
 
187
- config.logger.filters << "secret" # add
188
- config.logger.filters += ["yet", "another"] # add
189
- config.logger.filters = ["foo"] # replace
259
+ config.logger.filters << "secret" # add
260
+ config.logger.filters += ["yet", "another"] # add
261
+ config.logger.filters = ["foo"] # replace
190
262
 
191
- # See https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html
192
- config.logger.options = ["daily"] # time based log rotation
193
- config.logger.options = [0, 1048576] # size based log rotation
194
- end
263
+ # See https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html
264
+ config.logger.options = ["daily"] # time based log rotation
265
+ config.logger.options = [0, 1048576] # size based log rotation
195
266
  end
196
- ```
267
+ end
268
+ ```
197
269
 
198
- To configure the logger for specific environments:
270
+ To configure the logger for specific environments:
199
271
 
200
- ```ruby
201
- module MyApp
202
- class Application < Hanami::Application
203
- config.environment(:staging) do
204
- config.logger.level = :info
205
- end
272
+ ```ruby
273
+ module MyApp
274
+ class Application < Hanami::Application
275
+ config.environment(:staging) do
276
+ config.logger.level = :info
206
277
  end
207
278
  end
208
- ```
279
+ end
280
+ ```
209
281
 
210
- To assign a custom replacement logger object:
282
+ To assign a custom replacement logger object:
211
283
 
212
- ```ruby
213
- module MyApp
214
- class Application < Hanami::Application
215
- config.logger = MyCustomLogger.new
216
- end
284
+ ```ruby
285
+ module MyApp
286
+ class Application < Hanami::Application
287
+ config.logger = MyCustomLogger.new
217
288
  end
218
- ```
289
+ end
290
+ ```
291
+
219
292
  - [Tim Riley] Comprehensive `config.source_dirs` setting
220
293
 
221
- This replaces the previous `component_dir_paths` setting, and contains two nested settings:
294
+ This replaces the previous `component_dir_paths` setting, and contains two nested settings:
222
295
 
223
- - `config.source_dirs.component_dirs` (backed by `Dry::System::Config::ComponentDirs`), for directories of source files intended to be registered as components
224
- - `config.source_dirs.autoload_paths`, for directories of source files not intended for registration as components, but still to be made accessible by the autoloader
296
+ - `config.source_dirs.component_dirs` (backed by `Dry::System::Config::ComponentDirs`), for directories of source files intended to be registered as components
297
+ - `config.source_dirs.autoload_paths`, for directories of source files not intended for registration as components, but still to be made accessible by the autoloader
225
298
 
226
- To add and configure your own additional component dirs:
299
+ To add and configure your own additional component dirs:
227
300
 
228
- ```ruby
229
- module MyApp
230
- class Application < Hanami::Application
231
- # Adding a simple component dir
232
- config.source_dirs.component_dirs.add "serializers"
301
+ ```ruby
302
+ module MyApp
303
+ class Application < Hanami::Application
304
+ # Adding a simple component dir
305
+ config.source_dirs.component_dirs.add "serializers"
233
306
 
234
- # Adding a component dir with custom configuration
235
- config.source_dirs.component_dirs.add "serializers" do |dir|
236
- dir.auto_register = proc { |component|
237
- !component.identifier.start_with?("structs")
238
- }
239
- end
307
+ # Adding a component dir with custom configuration
308
+ config.source_dirs.component_dirs.add "serializers" do |dir|
309
+ dir.auto_register = proc { |component|
310
+ !component.identifier.start_with?("structs")
311
+ }
240
312
  end
241
313
  end
242
- ```
314
+ end
315
+ ```
243
316
 
244
- To customize the configuration of the default component dirs ("lib", "actions", "repositories", "views"):
317
+ To customize the configuration of the default component dirs ("lib", "actions", "repositories", "views"):
245
318
 
246
- ```ruby
247
- module MyApp
248
- class Application < Hanami::Application
249
- # Customising a default component dir
250
- config.source_dirs.component_dirs.dir("lib").auto_register = proc { |component|
251
- !component.identifier.start_with?("structs")
252
- }
319
+ ```ruby
320
+ module MyApp
321
+ class Application < Hanami::Application
322
+ # Customising a default component dir
323
+ config.source_dirs.component_dirs.dir("lib").auto_register = proc { |component|
324
+ !component.identifier.start_with?("structs")
325
+ }
253
326
 
254
- # Setting default config to apply to all component dirs
255
- config.source_dirs.component_dirs.auto_register = proc { |component|
256
- !component.identifier.start_with?("entities")
257
- }
327
+ # Setting default config to apply to all component dirs
328
+ config.source_dirs.component_dirs.auto_register = proc { |component|
329
+ !component.identifier.start_with?("entities")
330
+ }
258
331
 
259
- # Removing a default component dir
260
- config.source_dirs.component_dirs.delete("views")
261
- end
332
+ # Removing a default component dir
333
+ config.source_dirs.component_dirs.delete("views")
262
334
  end
263
- ```
335
+ end
336
+ ```
264
337
 
265
- To configure the autoload paths (defaulting to `["entities"]`):
338
+ To configure the autoload paths (defaulting to `["entities"]`):
266
339
 
267
- ```ruby
268
- module MyApp
269
- class Application < Hanami::Application
270
- # Adding your own autoload paths
271
- config.source_dirs.autoload_paths << "structs"
340
+ ```ruby
341
+ module MyApp
342
+ class Application < Hanami::Application
343
+ # Adding your own autoload paths
344
+ config.source_dirs.autoload_paths << "structs"
272
345
 
273
- # Or providing a full replacement
274
- config.source_dirs.autoload_paths = ["structs"]
275
- end
346
+ # Or providing a full replacement
347
+ config.source_dirs.autoload_paths = ["structs"]
276
348
  end
277
- ```
349
+ end
350
+ ```
351
+
278
352
  - [Tim Riley] Application router is lazy loaded (not requiring application to be fully booted) and now available via `Hanami.rack_app` or `Hanami.application.rack_app`, instead of the previous `Hanami.app` (which required the app to be booted first).
279
353
 
280
354
  ## v2.0.0.alpha4 - 2021-12-07
355
+
281
356
  ### Added
357
+
282
358
  - [Luca Guidi] Manage Content Security Policy (CSP) with "zero-defaults" policy. New API to change CSP values and to disable the feature.
283
- ```ruby
284
- # Read a CSP value
285
359
 
286
- module MyApp
287
- class Application < Hanami::Application
288
- config.actions.content_security_policy[:base_uri] # => "'self'"
289
- end
360
+ ```ruby
361
+ # Read a CSP value
362
+
363
+ module MyApp
364
+ class Application < Hanami::Application
365
+ config.actions.content_security_policy[:base_uri] # => "'self'"
290
366
  end
291
- ```
367
+ end
368
+ ```
292
369
 
293
- ```ruby
294
- # Override a default CSP value
370
+ ```ruby
371
+ # Override a default CSP value
295
372
 
296
- module MyApp
297
- class Application < Hanami::Application
298
- # This line will generate the following CSP fragment
299
- # plugin-types ;
300
- config.actions.content_security_policy[:plugin_types] = nil
301
- end
373
+ module MyApp
374
+ class Application < Hanami::Application
375
+ # This line will generate the following CSP fragment
376
+ # plugin-types ;
377
+ config.actions.content_security_policy[:plugin_types] = nil
302
378
  end
303
- ```
379
+ end
380
+ ```
304
381
 
305
- ```ruby
306
- # Append to a default CSP value
382
+ ```ruby
383
+ # Append to a default CSP value
307
384
 
308
- module MyApp
309
- class Application < Hanami::Application
310
- # This line will generate the following CSP fragment
311
- # script-src 'self' https://my.cdn.test;
312
- config.actions.content_security_policy[:script_src] += " https://my.cdn.test"
313
- end
385
+ module MyApp
386
+ class Application < Hanami::Application
387
+ # This line will generate the following CSP fragment
388
+ # script-src 'self' https://my.cdn.test;
389
+ config.actions.content_security_policy[:script_src] += " https://my.cdn.test"
314
390
  end
315
- ```
391
+ end
392
+ ```
316
393
 
317
- ```ruby
318
- # Add a custom CSP key. Useful when CSP standard evolves.
394
+ ```ruby
395
+ # Add a custom CSP key. Useful when CSP standard evolves.
319
396
 
320
- module MyApp
321
- class Application < Hanami::Application
322
- # This line will generate the following CSP fragment
323
- # my-custom-setting 'self';
324
- config.actions.content_security_policy[:my-custom-setting] = "'self'"
325
- end
397
+ module MyApp
398
+ class Application < Hanami::Application
399
+ # This line will generate the following CSP fragment
400
+ # my-custom-setting 'self';
401
+ config.actions.content_security_policy['my-custom-setting'] = "'self'"
326
402
  end
327
- ```
403
+ end
404
+ ```
328
405
 
329
- ```ruby
330
- # Delete a CSP key.
406
+ ```ruby
407
+ # Delete a CSP key.
331
408
 
332
- module MyApp
333
- class Application < Hanami::Application
334
- config.actions.content_security_policy.delete(:object_src)
335
- end
409
+ module MyApp
410
+ class Application < Hanami::Application
411
+ config.actions.content_security_policy.delete(:object_src)
336
412
  end
337
- ```
413
+ end
414
+ ```
338
415
 
339
- ```ruby
340
- # Disable CSP feature.
416
+ ```ruby
417
+ # Disable CSP feature.
341
418
 
342
- module MyApp
343
- class Application < Hanami::Application
344
- config.actions.content_security_policy = false
345
- end
419
+ module MyApp
420
+ class Application < Hanami::Application
421
+ config.actions.content_security_policy = false
346
422
  end
347
- ```
423
+ end
424
+ ```
348
425
 
349
426
  ## v2.0.0.alpha3 - 2021-11-09
427
+
350
428
  ### Added
429
+
351
430
  - [Luca Guidi] Added `Hanami.shutdown` to stop all bootable components in the application container
352
431
  - [Tim Riley] Added `component_dir_paths` application setting to allow for components to be loaded from additional directories inside each slice directory. To begin with, this defaults to `%w[actions repositories views]`. Components inside these directories are expected to be namespaced to match the directory name; e.g. given a `main` slice, `slices/main/actions/home.rb` is expected to define `Main::Actions::Home`, and will be registered in the slice container as `"actions.home"`.
353
432
 
354
433
  ### Changed
434
+
355
435
  - [Tim Riley] A slice's classes can now be defined directly inside `slices/[slice_name]/lib/`; e.g. given a `main` slice, `slices/main/lib/example.rb` is expected to define `Main::Example`, and will be registered in the slice container as `"example"`
356
436
  - [Tim Riley] The root `lib/` directory is no longer configured as a component dir, and classes inside `lib/[app_namespace]/` will no longer be auto-registered into the container. If you need to share components, create them in their own slices as appropriate, and import those slices into the other slices that require them.
357
437
  - [Tim Riley] `lib/[app_namespace]/` is configured for autoloading, and `lib/` is added to `$LOAD_PATH` to support explicit requires for source files outside `lib/[app_namespace]/`.
358
438
  - [Tim Riley] (Internal) Ported `Hanami::Configuration` and related classes to use dry-configurable
359
439
  - [Tim Riley] Application inflector can be entirely replaced, if required, via `Hanami::Configuration#inflector=`. Custom inflection rules can still be provided to the default inflector via `Hanami::Configuration#inflections`.
360
440
  - [Marc Busqué] App settings are defined within a concrete class rather than an anonymous block, to allow for users to leverage the typical behavior of Ruby classes, such as for defining their own types module to use for coercing setting values. This class also relies on dry-configurable for its settings implementation, so the standard dry-configurable `setting` API is available, such as the `constructor:` and `default:` options.
361
- ```ruby
362
- # frozen_string_literal: true
363
441
 
364
- require "dry/types"
365
- require "hanami/application/settings"
442
+ ```ruby
443
+ # frozen_string_literal: true
366
444
 
367
- module TestApp
368
- class Settings < Hanami::Application::Settings
369
- # Example usage of a types module (previously not possible inside the anonymous block)
370
- Types = Dry.Types()
445
+ require "dry/types"
446
+ require "hanami/application/settings"
371
447
 
372
- setting :session_secret, constructor: Types::String.constrained(min_size: 20)
448
+ module TestApp
449
+ class Settings < Hanami::Application::Settings
450
+ # Example usage of a types module (previously not possible inside the anonymous block)
451
+ Types = Dry.Types()
373
452
 
374
- setting :some_bool, constructor: Types::Params::Bool, default: false
375
- end
453
+ setting :session_secret, constructor: Types::String.constrained(min_size: 20)
454
+
455
+ setting :some_bool, constructor: Types::Params::Bool, default: false
376
456
  end
377
- ```
457
+ end
458
+ ```
459
+
378
460
  - [Marc Busqué] Application `settings_loader` and `settings_loader_options` have been replaced with `settings_store`, which is an updated abstraction for providing setting values to work with the new `Hanami::Application::Settings` implementation noted above (see `Application::Settings::DotenvStore` for the default store, which provides the same behavior as previously)
379
461
  - [Marc Busqué] Routes are defined within a concrete class rather than an anonymous block, to provide consistency with the settings (noted above), as well a place for additional behavior (in future releases):
380
- ```ruby
381
- # frozen_string_literal: true
382
462
 
383
- require "hanami/application/routes"
463
+ ```ruby
464
+ # frozen_string_literal: true
465
+
466
+ require "hanami/application/routes"
384
467
 
385
- module MyApp
386
- class Routes < Hanami::Application::Routes
387
- define do
388
- slice :main, at: "/" do
389
- root to: "home.show"
390
- end
468
+ module MyApp
469
+ class Routes < Hanami::Application::Routes
470
+ define do
471
+ slice :main, at: "/" do
472
+ root to: "home.show"
391
473
  end
392
474
  end
393
475
  end
394
- ```
476
+ end
477
+ ```
395
478
 
396
479
  ## v2.0.0.alpha2 - 2021-05-04
480
+
397
481
  ### Added
482
+
398
483
  - [Luca Guidi] Official support for Ruby: MRI 3.0
399
484
  - [Tim Riley] Code autoloading via Zeitwerk
400
485
  - [Tim Riley] `Hanami::Application` subclasses generate and configure a `Dry::System::Container`, accessible via `.container` and `AppNamespace::Container`, with several common container methods available directly via the application subclass (e.g. `Bookshelf::Application["foo"]` or `Hanami.application["foo"]`)
401
486
  - [Tim Riley] Introduced `Hanami::Application.register_bootable` to register custom components
402
487
  - [Tim Riley] Introduced `Hanami::Application.keys` to get the list of resolved components
403
488
  - [Tim Riley] Dynamically create an auto-injection mixin (e.g. `Bookshelf::Deps`)
404
- ```ruby
405
- # frozen_string_literal: true
406
489
 
407
- module Bookshelf
408
- class CreateThing
409
- include Deps[service_client: "some_service.client"]
490
+ ```ruby
491
+ # frozen_string_literal: true
410
492
 
411
- def call(attrs)
412
- # Validate attrs, etc.
413
- service_client.create(attrs)
414
- end
493
+ module Bookshelf
494
+ class CreateThing
495
+ include Deps[service_client: "some_service.client"]
496
+
497
+ def call(attrs)
498
+ # Validate attrs, etc.
499
+ service_client.create(attrs)
415
500
  end
416
501
  end
417
- ```
502
+ end
503
+ ```
504
+
418
505
  - [Tim Riley] Introduced application settings. They are accessible via `Hanami.application.settings` in `config/settings.rb`
419
506
  - [Tim Riley] Introduced application slices to organise high-level application concerns. Slices are generated based on subdirectories of `slices/`, and map onto corresponding ruby module namespaces, e.g. `slices/main` -> `Main`, with the slice instance itself being `Main::Slice` (as well as being accessible via `Hanami.application.slices[:main]`)
420
507
  - [Tim Riley] Each slice generates and configures has its own `Dry::System::Container`, accessible via the slice instance (e.g. `Main::Slice.container`) as well as via its own constant (e.g. `Main::Container`)
@@ -422,13 +509,16 @@ The web, with simplicity.
422
509
  - [Tim Riley] Allow slice containers to be imported by other slice containers
423
510
 
424
511
  ### Changed
512
+
425
513
  - [Luca Guidi] Drop support for Ruby: MRI 2.5
426
514
  - [Tim Riley] Removed `config.cookies` in favor of `config.actions.cookies`
427
515
  - [Tim Riley] Removed `config.sessions` in favor of `config.actions.sessions`
428
516
  - [Tim Riley] Removed `config.security` settings
429
517
 
430
518
  ## v2.0.0.alpha1 - 2019-01-30
519
+
431
520
  ### Added
521
+
432
522
  - [Luca Guidi] Implemented from scratch `hanami version`
433
523
  - [Luca Guidi] Implemented from scratch `hanami server`
434
524
  - [Luca Guidi] Main configuration is opinionated: when a setting is not specified in generated code, it uses a framework default.
@@ -451,6 +541,7 @@ The web, with simplicity.
451
541
  (e.g. `config.security.content_security_policy[:plugin_types] = nil` to override the settings)
452
542
 
453
543
  ### Changed
544
+
454
545
  - [Luca Guidi] Drop support for Ruby: MRI 2.3, and 2.4.
455
546
  - [Luca Guidi] `Hanami::Application` must be used as superclass for main application under `config/application.rb` (e.g. `Bookshelf::Application`)
456
547
  - [Luca Guidi] Main configuration is available at `config/application.rb` instead of `config/enviroment.rb`
@@ -459,6 +550,7 @@ The web, with simplicity.
459
550
  - [Luca Guidi] Per enviroment settings must be wrapped in a block (e.g. `config.enviroment(:production) { |c| c.logger = {} }`)
460
551
  - [Luca Guidi] Concrete applications are no longer supported (e.g. `Web::Application` in `apps/web/application.rb`)
461
552
  - [Luca Guidi] Main routes must be configured at `config/routes.rb`:
553
+
462
554
  ```ruby
463
555
  # frozen_string_literal: true
464
556
 
@@ -472,113 +564,153 @@ Hanami.application.routes do
472
564
  end
473
565
  end
474
566
  ```
567
+
475
568
  - [Luca Guidi] Per application routes are no longer supported (e.g. `apps/web/config/routes.rb`)
476
569
  - [Luca Guidi] Removed `shotgun` and code reloading from the core. Code reloading is implemented by `hanami-reloader` gem.
477
570
  - [Luca Guidi] Removed support for `.hanamirc`
478
571
 
479
572
  ## v1.3.4 - 2021-05-02
573
+
480
574
  ### Fixed
575
+
481
576
  - [Slava Kardakov] Fix generated `config.ru` `require_relative` statement
482
577
  - [Armin] Fix `Hanami::CommonLogger` elapsed time compatibility with `rack` 2.1.0+
483
578
  - [Adam Daniels] Fix generated tests compatibility with `minitest` 6.0+
484
579
 
485
580
  ## v1.3.3 - 2019-09-20
581
+
486
582
  ### Added
583
+
487
584
  - [Gray Manley] Standardize file loading for `.env` files (see: https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use)
488
585
 
489
586
  ### Fixed
587
+
490
588
  - [Alfonso Uceda & Luca Guidi] Ensure to use `:host` option when mounting an application in main router (e.g. `mount Beta::Application.new, at: "/", host: "beta.hanami.test"`)
491
589
 
492
590
  ## v1.3.2 - 2019-07-26
591
+
493
592
  ### Added
593
+
494
594
  - [Luca Guidi] Support both `hanami-validations` 1 and 2
495
595
 
496
596
  ### Fixed
597
+
497
598
  - [Wisnu Adi Nurcahyo] Ensure `hanami generate` syntax for Welcome page is compatible with ZSH
498
599
  - [Luca Guidi] Don't let `hanami` to crash when called without `bundle exec`
499
600
 
500
601
  ## v1.3.1 - 2019-01-18
602
+
501
603
  ### Added
604
+
502
605
  - [Luca Guidi] Official support for Ruby: MRI 2.6
503
606
  - [Luca Guidi] Support `bundler` 2.0+
504
607
 
505
608
  ### Fixed
609
+
506
610
  - [Aidan Coyle] Remove from app generator support for deprecated `force_ssl` setting
507
611
  - [Alessandro Caporrini] Remove from app generator support for deprecated `body_parsers` setting
508
612
  - [Daphne Rouw & Sean Collins] Make app generator to work when code in `config/environment.rb` uses double quotes
509
613
 
510
614
  ## v1.3.0 - 2018-10-24
615
+
511
616
  ### Added
617
+
512
618
  - [Luca Guidi] Automatically log body payload from body parsers
513
619
 
514
620
  ### Fixed
621
+
515
622
  - [Luca Guidi] Generate correct syntax for layout unit tests
516
623
  - [Vladislav Yashin] Fix concatenation of `Pathname` and `String` in `Hanami::CommonLogger`
517
624
 
518
625
  ## v1.3.0.beta1 - 2018-08-08
626
+
519
627
  ### Added
628
+
520
629
  - [Sean Collins] Generate new projects with RSpec as default testing framework
521
630
  - [Alfonso Uceda] Generate actions/views/mailers with nested module/class definition
522
631
 
523
632
  ### Fixed
633
+
524
634
  - [Anton Davydov] Make possible to pass extra settings for custom logger instances (eg. `logger SemanticLogger.new, :foo, :bar`)
525
635
  - [graywolf] Ensure `hanami generate app` to work without `require_relative` entries in `config/environment.rb`
526
636
  - [Makoto Tajitsu & Luca Guidi] Fixed regression for `hanami new .` that used to generate a broken project
527
637
 
528
638
  ### Fixed
639
+
529
640
  - [John Downey] Don't use thread unsafe `Dir.chdir` to serve static assets
530
641
 
531
642
  ## v1.2.0 - 2018-04-11
532
643
 
533
644
  ## v1.2.0.rc2 - 2018-04-06
645
+
534
646
  ### Fixed
647
+
535
648
  - [Kelsey Judson] Ensure to not reload code under `lib/` when `shotgun` isn't bundled
536
649
 
537
650
  ## v1.2.0.rc1 - 2018-03-30
538
651
 
539
652
  ## v1.2.0.beta2 - 2018-03-23
653
+
540
654
  ### Fixed
655
+
541
656
  - [Luca Guidi] Raise meaningful error message when trying to access `session` or `flash` with disabled sessions
542
657
  - [Pistos] Print stack trace to standard output when a CLI command raises an error
543
658
 
544
659
  ## v1.2.0.beta1 - 2018-02-28
660
+
545
661
  ### Added
662
+
546
663
  - [Luca Guidi] HTTP/2 Early Hints
547
664
 
548
665
  ### Fixed
666
+
549
667
  - [Alfonso Uceda] Render custom template if an exception is raised from a view or template
550
668
 
551
669
  ## v1.1.1 - 2018-02-27
670
+
552
671
  ### Added
672
+
553
673
  - [Luca Guidi] Official support for Ruby MRI 2.5+
554
674
 
555
675
  ### Fixed
676
+
556
677
  - [Alfonso Uceda] Fixed regression for mailer generator: when using options like `--from` and `--to` the generated Ruby code isn't valid as it was missing string quotes.
557
678
  - [Luca Guidi] Generate tests for views including `:format` in `exposures`. This fixes view unit tests when the associated template renders a partial.
558
679
 
559
680
  ## v1.1.0 - 2017-10-25
681
+
560
682
  ### Fixed
683
+
561
684
  - [Luca Guidi] Ensure `hanami db rollback` steps to be a positive integer
562
685
 
563
686
  ## v1.1.0.rc1 - 2017-10-16
687
+
564
688
  ### Added
689
+
565
690
  - [Yuji Ueki] Generate RSpec tests with `:type` metadata (eg `type: :action`)
566
691
  - [Kirill] Add `--relation` option for `hanami generate model` (eg `bundle exec hanami generate model user --relation=accounts`)
567
692
 
568
693
  ## v1.1.0.beta3 - 2017-10-04
694
+
569
695
  ### Fixed
696
+
570
697
  - [Luca Guidi] Don't require `:plugins` group when running `hanami new`
571
698
 
572
699
  ## v1.1.0.beta2 - 2017-10-03
700
+
573
701
  ### Added
702
+
574
703
  - [Luca Guidi] Introduce `:plugins` group for `Gemfile` in order enable Hanami plugin gems
575
704
  - [Alfonso Uceda] CLI: `hanami db rollback` to revert one or more migrations at once
576
705
 
577
706
  ### Fixed
707
+
578
708
  - [Gabriel Gizotti] Fix generate/destroy for nested actions
579
709
 
580
710
  ## v1.1.0.beta1 - 2017-08-11
711
+
581
712
  ### Added
713
+
582
714
  - [Ben Johnson] Allow to use custom logger as `Hanami.logger` (eg. `Hanami.configure { logger Timber::Logger.new($stdout) }`)
583
715
  - [akhramov] Generate spec file for application layout when generating a new app
584
716
  - [Anton Davydov] Generate `README.md` file for new projects
@@ -587,23 +719,29 @@ end
587
719
  - [Marion Duprey & Gabriel Gizotti] Filter sensitive data in logs
588
720
 
589
721
  ### Fixed
722
+
590
723
  - [jarosluv] Ensure to remove the correct migration file when executing `hanami db destroy model`
591
724
  - [sovetnik] Fix require path for Minitest spec helper
592
725
 
593
726
  ## v1.0.0 - 2017-04-06
594
727
 
595
728
  ## v1.0.0.rc1 - 2017-03-31
729
+
596
730
  ### Added
731
+
597
732
  - [Luca Guidi] Allow `logger` setting in `config/environment.rb` to accept arbitrary arguments to make `Hanami::Logger` to be compatible with Ruby's `Logger`. (eg. `logger 'daily', level: :info`)
598
733
 
599
734
  ### Fixed
735
+
600
736
  - [Luca Guidi] Ensure code reloading don't misconfigure mailer settings (regression from v1.0.0.beta3)
601
737
  - [Luca Guidi] Ensure database disconnection to happen in the same thread of `Hanami.boot`
602
738
  - [Luca Guidi] Ensure `mailer` block in `config/environment.rb` to be evaluated multiple times, according to the current Hanami environment
603
739
  - [Luca Guidi] Ensure a Hanami project to require only once the code under `lib/`
604
740
 
605
741
  ## v1.0.0.beta3 - 2017-03-17
742
+
606
743
  ### Fixed
744
+
607
745
  - [Luca Guidi] Try to disconnect from database at the boot time. This is useful to prune stale connection during production deploys.
608
746
  - [Tobias Sandelius] Don't mount `Hanami::CommonLogger` middleware if logging is disabled for the project.
609
747
  - [Anton Davydov] Don't configure mailers, if it's mailing is disabled for the project.
@@ -611,12 +749,15 @@ end
611
749
  - [Jimmy Börjesson] Make `apps/web/application.rb` code to wrap around the 80th column
612
750
 
613
751
  ### Changed
752
+
614
753
  - [Luca Guidi] Removed deprecated `ApplicationConfiguration#default_format`. Use `#default_request_format` instead.
615
754
 
616
755
  ## v1.0.0.beta2 - 2017-03-02
617
756
 
618
757
  ## v1.0.0.beta1 - 2017-02-14
758
+
619
759
  ### Added
760
+
620
761
  - [Luca Guidi] Official support for Ruby: MRI 2.4
621
762
  - [yjukaku] CLI: `hanami generate model` now also generates a migration
622
763
  - [Luca Guidi] Generate `config/boot.rb` for new Hanami projects.
@@ -625,6 +766,7 @@ end
625
766
  - [Luca Guidi] Introduced `environment` for env specific settings in `config/environment.rb`
626
767
 
627
768
  ### Fixed
769
+
628
770
  - [Marcello Rocha] Fix Hanami::Mailer loading
629
771
  - [Kai Kuchenbecker] Serve only existing assets with `Hanami::Static`
630
772
  - [Gabriel Gizotti] Ensure inline ENV vars to not be overwritten by `.env.*` files
@@ -635,6 +777,7 @@ end
635
777
  - [Victor Franco] Fixed CLI subcommands help output
636
778
 
637
779
  ### Changed
780
+
638
781
  - [Ozawa Sakuro] Don't include `bundler` as a dependency `Gemfile` for new Hanami projects
639
782
  - [Luca Guidi] Make compatible with Rack 2.0 only
640
783
  - [Luca Guidi] Removed `logger` settings from Hanami applications
@@ -642,23 +785,31 @@ end
642
785
  - [Luca Guidi] Changed mailer syntax in `config/environment.rb`
643
786
 
644
787
  ## v0.9.2 - 2016-12-19
788
+
645
789
  ## Added
790
+
646
791
  - [The Crab] Mark unit tests/specs as pending for generated actions and views
647
792
 
648
793
  ### Fixed
794
+
649
795
  - [Luca Guidi] Rake task `:environment` no longer depends on the removed `:preload` task
650
796
  - [Luca Guidi] Ensure force SSL to use the default port, or the configured one
651
797
  - [Luca Guidi] Boot the project when other it's started without `hanami server` (eg. `puma` or `rackup`)
652
798
 
653
799
  ## v0.9.1 - 2016-11-18
800
+
654
801
  ### Fixed
802
+
655
803
  - [Luca Guidi] Ensure JSON body parser to not eval untrusted input
656
804
 
657
805
  ## v0.9.0 - 2016-11-15
806
+
658
807
  ### Added
808
+
659
809
  - [Christophe Philemotte] Introduced `hanami secret` to generate and print a new sessions secret
660
810
 
661
811
  ### Fixed
812
+
662
813
  - [Bruz Marzolf] Skip project code preloading when code reloading is enabled
663
814
  - [Bruz Marzolf] Ensure to generate project in current directory when running `hanami new .`
664
815
  - [Pascal Betz] Fix constant lookup within the project namespace
@@ -667,6 +818,7 @@ end
667
818
  - [Luca Guidi] Fix duplicated Rack middleware in single Hanami application stacks
668
819
 
669
820
  ### Changed
821
+
670
822
  - [Luca Guidi] Official support for Ruby MRI 2.3+
671
823
  - [Luca Guidi] Removed support for "application" architecture
672
824
  - [Luca Guidi] Removed `Hanami::Container.new` in favor of `Hanami.app`
@@ -678,7 +830,9 @@ end
678
830
  - [Luca Guidi & Sean Collins] Renamed assets configuration `digest` into `fingerprint`
679
831
 
680
832
  ## v0.8.0 - 2016-07-22
833
+
681
834
  ### Added
835
+
682
836
  - [Luca Guidi] Generate new projects with Subresurce Integrity enabled in production (security).
683
837
  - [Luca Guidi] Include `X-XSS-Protection: 1; mode=block` in default response headers (security).
684
838
  - [Luca Guidi] Include `X-Content-Type-Options: nosniff` in default response headers (security).
@@ -692,6 +846,7 @@ end
692
846
  - [Sean Collins] Add `--version` and `-v` for `hanami version` CLI
693
847
 
694
848
  ### Fixed
849
+
695
850
  - [Josh Bodah] Ensure consistent CLI messages
696
851
  - [Andrey Morskov] Ensure consistent user experience and messages for generators
697
852
  - [Luca Guidi] Fixed generators for camel case project names
@@ -711,7 +866,9 @@ end
711
866
  - [Luca Guidi & Lucas Amorim] Make model generator not dependendent on the current directory name, but to the project name stored in `.hanamirc`
712
867
 
713
868
  ### Changed
869
+
714
870
  – [Luca Guidi] Drop support for Ruby 2.0 and 2.1
871
+
715
872
  - [Trung Lê] Database env var is now `DATABASE_URL` (without the project name prefix like `BOOKSHELF_DATABASE_URL`
716
873
  - [Trung Lê] `lib/config/mapping.rb` is no longer generated for new projects and no longer loaded.
717
874
  - [Anton Davydov] New generated projects will depend (in their `Gemfile`) on `hanami` tiny version (`~> 0.8'`) instead of patch version (`0.8.0`)
@@ -723,24 +880,34 @@ end
723
880
  - [Luca Guidi] Allow views to render any HTTP status code. In actions use `halt(422)` for default status page or `self.status = 422` for view rendering.
724
881
 
725
882
  ## v0.7.3 - 2016-05-23
883
+
726
884
  ### Fixed
885
+
727
886
  - [Pascal Betz] Use `Shotgun::Static` to serve static files in development mode and avoid to reload the env
728
887
 
729
888
  ## v0.7.2 - 2016-02-09
889
+
730
890
  ### Fixed
891
+
731
892
  - [Alfonso Uceda Pompa] Fixed routing issue when static assets server tried to hijack paths that are matching directories in public directory
732
893
 
733
894
  ## v0.7.1 - 2016-02-05
895
+
734
896
  ### Fixed
897
+
735
898
  - [Anton Davydov] Fixed routing issue when static assets server tried to hijack requests belonging to dynamic endpoints
736
899
  - [Anatolii Didukh] Ensure to fallback to default engine for `hanami console`
737
900
 
738
901
  ## v0.7.0 - 2016-01-22
902
+
739
903
  ### Changed
904
+
740
905
  - [Luca Guidi] Renamed the project
741
906
 
742
907
  ## v0.6.1 - 2016-01-19
908
+
743
909
  ### Fixed
910
+
744
911
  - [Anton Davydov] Show the current app name in Welcome page (eg. `/admin` shows instructions on how to generate an action for `Admin` app)
745
912
  - [Anton Davydov] Fix project creation when name contains dashes (eg. `"awesome-project" => "AwesomeProject"`)
746
913
  - [Anton Davydov] Ensure to add assets related entries to `.gitignore` when a project is generated with the `--database` flag
@@ -749,7 +916,9 @@ end
749
916
  - [Serg Ikonnikov & Trung Lê] Ensure console to use the bundled engine
750
917
 
751
918
  ## v0.6.0 - 2016-01-12
919
+
752
920
  ### Added
921
+
753
922
  - [Luca Guidi] Introduced configurable assets compressors
754
923
  - [Luca Guidi] Introduced "CDN mode" in order to serve static assets via Content Distribution Networks
755
924
  - [Luca Guidi] Introduced "Digest mode" in production in order to generate and serve assets with checksum suffix
@@ -768,6 +937,7 @@ end
768
937
  - [Gonzalo Rodríguez-Baltanás Díaz] Generate new applications with default favicon
769
938
 
770
939
  ### Fixed
940
+
771
941
  - [Neil Matatall] Use "secure compare" for CSRF tokens in order to prevent timing attacks
772
942
  - [Bernardo Farah] Fix support for chunked response body (via `Rack::Chunked::Body`)
773
943
  - [Lucas Allan Amorim] Add `bundler` as a runtime dependency
@@ -784,6 +954,7 @@ end
784
954
  - [Alfonso Uceda Pompa] Convert dasherized names into underscored names when generating projects (eg. `awesome-project` to `awesome_project`)
785
955
 
786
956
  ### Changed
957
+
787
958
  - [Sean Collins] Welcome page shows current year in copyright notes
788
959
  - [Luca Guidi] Add `/public/assets*` to `.gitignore` of new projects
789
960
  - [Luca Guidi] Removed support for `default_format` in favor of `default_request_format`
@@ -792,7 +963,9 @@ end
792
963
  - [Luca Guidi] `assets` configuration in `apps/web/application.rb` now accepts a block to configure sources and other settings
793
964
 
794
965
  ## v0.5.0 - 2015-09-30
966
+
795
967
  ### Added
968
+
796
969
  - [Ines Coelho & Rosa Faria] Introduced mailers support
797
970
  - [Theo Felippe] Added configuration entries: `#default_request_format` and `default_response_format`
798
971
  - [Rodrigo Panachi] Introduced `logger` configuration for applications, to be used like this: `Web::Logger.debug`
@@ -800,6 +973,7 @@ end
800
973
  - [Pascal Betz] Introduced `--method` CLI argument for action generator as a way to specify the HTTP verb
801
974
 
802
975
  ### Fixed
976
+
803
977
  - [Luca Guidi] Handle conflicts between directories with the same name while serving static assets
804
978
  - [Derk-Jan Karrenbeld] Include default value `font-src: self` for CSP HTTP header
805
979
  - [Cam Huynh] Make CLI arguments immutable for `Lotus::Environment`
@@ -807,13 +981,17 @@ end
807
981
  - [Alfonso Uceda Pompa] Print error message and exit when no name is provided to model generator
808
982
 
809
983
  ### Changed
984
+
810
985
  - [Theo Felippe] Deprecated `#default_format` in favor of: `#default_request_format`
811
986
 
812
987
  ## v0.4.1 - 2015-07-10
988
+
813
989
  ### Added
990
+
814
991
  - [Trung Lê] Alias `--database` as `--db` for `lotus new`
815
992
 
816
993
  ### Fixed
994
+
817
995
  - [Alfonso Uceda Pompa] Ensure to load correctly apps in `lotus console`
818
996
  - [Alfonso Uceda Pompa] Ensure to not duplicate prefix for Container mounted apps (eg `/admin/admin/dashboard`)
819
997
  - [Alfonso Uceda Pompa] Ensure generator for "application" architecture to generate session secret
@@ -822,7 +1000,9 @@ end
822
1000
  - [Luca Guidi] Ensure to prepend sessions middleware, so other Rack components can have access to HTTP session
823
1001
 
824
1002
  ## v0.4.0 - 2015-06-23
1003
+
825
1004
  ### Added
1005
+
826
1006
  - [Luca Guidi] Database migrations and new CLI commands for database operations
827
1007
  - [Luca Guidi] Cross Site Request Forgery (CSRF) protection
828
1008
  - [Hiếu Nguyễn & Luca Guidi] Application Architecture
@@ -831,23 +1011,28 @@ end
831
1011
  - [Luca Guidi] Added `rendered` "let" variable for new generated tests for views
832
1012
 
833
1013
  ### Fixed
1014
+
834
1015
  - [Alfonso Uceda Pompa] Fix generated routes for Container applications mounted on a path different from `/`.
835
1016
  - [Luca Guidi] Reading `.lotusrc` pollutes `ENV` with unwanted variables.
836
1017
  - [Alfonso Uceda Pompa] Added sqlite extension to SQLite/SQLite3 database URL.
837
1018
 
838
1019
  ### Changed
1020
+
839
1021
  - [Luca Guidi] `.env`, `.env.development` and `.env.test` are generated and expected to be placed at the root of the project.
840
1022
  - [Luca Guidi] Remove database mapping from generated apps.
841
1023
  - [Trung Lê & Luca Guidi] Remove default generated from new apps.
842
1024
  - [Luca Guidi] New projects should depend on `lotus-model ~> 0.4`
843
1025
 
844
1026
  ## v0.3.2 - 2015-05-22
1027
+
845
1028
  ### Added
1029
+
846
1030
  - [Alfonso Uceda Pompa] Automatic secure cookies if the current connection is using HTTPS.
847
1031
  - [Alfonso Uceda Pompa] Routing helpers for actions (via `#routes`).
848
1032
  - [My Mai] Introduced `Lotus.root`. It returns the top level directory of the project.
849
1033
 
850
1034
  ### Fixed
1035
+
851
1036
  - [Ngọc Nguyễn] Model generator should use new RSpec syntax.
852
1037
  - [Ngọc Nguyễn] Model generator must respect file name conventions for Ruby.
853
1038
  - [Ngọc Nguyễn] Action generator must respect file name conventions for Ruby.
@@ -855,17 +1040,22 @@ end
855
1040
  - [Luca Guidi] Container generator for RSpec let the application to be preloaded (discard `config.before(:suite)`)
856
1041
 
857
1042
  ## v0.3.1 - 2015-05-15
1043
+
858
1044
  ### Added
1045
+
859
1046
  - [Hiếu Nguyễn] Introduced application generator (eg. `bundle exec lotus generate app admin` creates `apps/admin`).
860
1047
  - [Ngọc Nguyễn] Introduced model generator (eg. `bundle exec lotus generate model user` creates entity, repository and test files).
861
1048
  - [Ngọc Nguyễn] Introduced `Lotus.env`, `Lotus.env?` for current environment introspection (eg. `Lotus.env?(:test)` or `Lotus.env?(:staging, :production)`)
862
1049
  - [Miguel Molina] Skip view creation when an action is generated via `--skip-view` CLI arg.
863
1050
 
864
1051
  ### Fixed
1052
+
865
1053
  - [Luca Guidi] Ensure routes to be loaded for unit tests
866
1054
 
867
1055
  ## v0.3.0 - 2015-03-23
1056
+
868
1057
  ### Added
1058
+
869
1059
  - [Luca Guidi] Introduced action generator. Eg. `bundle exec lotus generate action web dashboard#index`
870
1060
  - [Alfonso Uceda Pompa] Allow to specify default cookies options in application configuration. Eg. `cookies true, { domain: 'lotusrb.org' }`
871
1061
  - [Tom Kadwill] Include `Lotus::Helpers` in views.
@@ -877,12 +1067,16 @@ end
877
1067
  - [Luca Guidi] Dynamic finders for relative and absolute routes. It implements method missing: `Web::Routes.home_path` will resolve to `Web::Routes.path(:home)`.
878
1068
 
879
1069
  ### Changed
1070
+
880
1071
  – [Alfonso Uceda Pompa] Cookies will send `HttpOnly` by default. This is for security reasons.
1072
+
881
1073
  - [Jan Lelis] Enable `templates` configuration for new generated apps
882
1074
  - [Mark Connell] Change SQLite file extension from `.db` to `.sqlite3`
883
1075
 
884
1076
  ## v0.2.1 - 2015-02-06
1077
+
885
1078
  ### Added
1079
+
886
1080
  - [Huy Đỗ] Introduced `Lotus::Logger`
887
1081
  - [Jimmy Zhang] `lotus new` accepts a `--path` argument
888
1082
  - [Jimmy Zhang] Project generator for the current directory (`lotus new .`). This is useful to provide a web deliverable for existing Ruby gems.
@@ -890,6 +1084,7 @@ end
890
1084
  - [Hiếu Nguyễn] RSpec support for project generator: `--test=rspec` or `--test=minitest` (default)
891
1085
 
892
1086
  ### Fixed
1087
+
893
1088
  - [Luca Guidi] `lotus version` to previx `v` (eg `v0.2.1`)
894
1089
  - [Rob Yurkowski] Ensure project name doesn't contain special or forbidden characters
895
1090
  - [Luca Guidi] Ensure all the applications are loaded in console
@@ -897,7 +1092,9 @@ end
897
1092
  - [Hiếu Nguyễn] Fixed `lotus new` to print usage when project name isn't provided
898
1093
 
899
1094
  ## v0.2.0 - 2014-06-23
1095
+
900
1096
  ### Added
1097
+
901
1098
  - [Luca Guidi] Introduced `lotus new` as a command to generate projects. It supports "container" architecture for now.
902
1099
  - [Luca Guidi] Show a welcome page when one mounted Lotus application doesn't have routes
903
1100
  - [Luca Guidi] Introduced `Lotus::Application.preload!` to preload all the Lotus applications in a given Ruby process. (Bulk `Lotus::Application.load!`)
@@ -927,13 +1124,17 @@ end
927
1124
  - [Luca Guidi] Official support for MRI 2.1 and 2.2
928
1125
 
929
1126
  ### Changed
1127
+
930
1128
  - [Alfonso Uceda Pompa] Changed semantic of `assets` configuration. Now it's only used to set the sources for the assets. Static serving assets has now a new configuration: `serve_assets`.
931
1129
 
932
1130
  ### Fixed
1131
+
933
1132
  - [Luca Guidi] Ensure `HEAD` requests return empty body
934
1133
 
935
1134
  ## v0.1.0 - 2014-06-23
1135
+
936
1136
  ### Added
1137
+
937
1138
  - [Luca Guidi] Allow to run multiple Lotus applications in the same Ruby process (framework duplication)
938
1139
  - [Luca Guidi] Introduced `Lotus::Routes` as factory to generate application URLs
939
1140
  - [Luca Guidi] Allow to configure scheme, host and port (`scheme`, `host` and `port` configuration)