hanami-controller 1.3.3 → 2.0.0.alpha4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -0
  3. data/LICENSE.md +1 -1
  4. data/README.md +299 -537
  5. data/hanami-controller.gemspec +4 -3
  6. data/lib/hanami/action/application_action.rb +131 -0
  7. data/lib/hanami/action/application_configuration/content_security_policy.rb +118 -0
  8. data/lib/hanami/action/application_configuration/cookies.rb +29 -0
  9. data/lib/hanami/action/application_configuration/sessions.rb +46 -0
  10. data/lib/hanami/action/application_configuration.rb +90 -0
  11. data/lib/hanami/action/base_params.rb +2 -2
  12. data/lib/hanami/action/cache/cache_control.rb +4 -4
  13. data/lib/hanami/action/cache/conditional_get.rb +3 -1
  14. data/lib/hanami/action/cache/directives.rb +1 -1
  15. data/lib/hanami/action/cache/expires.rb +3 -3
  16. data/lib/hanami/action/cache.rb +1 -139
  17. data/lib/hanami/action/configuration.rb +428 -0
  18. data/lib/hanami/action/cookie_jar.rb +3 -3
  19. data/lib/hanami/action/cookies.rb +3 -62
  20. data/lib/hanami/action/csrf_protection.rb +214 -0
  21. data/lib/hanami/action/flash.rb +102 -207
  22. data/lib/hanami/action/glue.rb +5 -31
  23. data/lib/hanami/action/halt.rb +12 -0
  24. data/lib/hanami/action/mime.rb +78 -485
  25. data/lib/hanami/action/params.rb +2 -2
  26. data/lib/hanami/action/rack/file.rb +1 -1
  27. data/lib/hanami/action/request.rb +30 -20
  28. data/lib/hanami/action/response.rb +193 -0
  29. data/lib/hanami/action/session.rb +11 -128
  30. data/lib/hanami/action/standalone_action.rb +578 -0
  31. data/lib/hanami/action/validatable.rb +1 -1
  32. data/lib/hanami/action/view_name_inferrer.rb +46 -0
  33. data/lib/hanami/action.rb +129 -73
  34. data/lib/hanami/controller/version.rb +1 -1
  35. data/lib/hanami/controller.rb +0 -227
  36. data/lib/hanami/http/status.rb +2 -2
  37. metadata +44 -26
  38. data/lib/hanami/action/callable.rb +0 -92
  39. data/lib/hanami/action/callbacks.rb +0 -214
  40. data/lib/hanami/action/configurable.rb +0 -50
  41. data/lib/hanami/action/exposable/guard.rb +0 -104
  42. data/lib/hanami/action/exposable.rb +0 -126
  43. data/lib/hanami/action/head.rb +0 -121
  44. data/lib/hanami/action/rack/callable.rb +0 -47
  45. data/lib/hanami/action/rack/errors.rb +0 -53
  46. data/lib/hanami/action/rack.rb +0 -411
  47. data/lib/hanami/action/redirect.rb +0 -59
  48. data/lib/hanami/action/throwable.rb +0 -169
  49. data/lib/hanami/controller/configuration.rb +0 -763
  50. data/lib/hanami-controller.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bc65546cbce3a2801eb75980f6f3d43a47c46bd98c3cd1128992d650da4b457
4
- data.tar.gz: 1380fea8cc79b2a7506e872b27fc629b15c4dd43353ee83dc98fdd110d3e8cf4
3
+ metadata.gz: 5cc85e1cc9074a18b393db3a0760c7fafb1d944914f2b755bfe0e6e6c35ee6aa
4
+ data.tar.gz: ea3998a90c5f6fb27c720ef400a729a3348b56e6bc5622b8ea07e64e3c2716b2
5
5
  SHA512:
6
- metadata.gz: 075ebe574b4d001f463887d89823b2589682d772e92756be28d9e9a348b893902d620ac6a4716ea79c5c58167224539eff658544e23abdc8bdb1c1133166c50a
7
- data.tar.gz: 94a22cb0e1b2c5920fdf2252405b5d2c7e7f9daa9457be96197f0552c5141972b0af98af1c6991175e156d0df3825fe5eba7d2dc28c1f4d547bf0797535deb6c
6
+ metadata.gz: e843265e291cd6722bf6acf0acb4fb9dc5b16216da02797713b9eb60316802a697b48102c9edf8846c174d987b14c2748f2347224571b089e5b145c229d08579
7
+ data.tar.gz: 0d6cea465c65077a40b41547c323c1e54613f0743f6c20bfe54265b5d5ecea7431e43e33d9e1d01c1cdcddd22eccca0b1a7e186092d99fe2751d43d80c3aa42d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,88 @@
1
1
  # Hanami::Controller
2
2
  Complete, fast and testable actions for Rack
3
3
 
4
+ ## v2.0.0.alpha4 - 2021-12-07
5
+ ### Added
6
+ - [Luca Guidi] Manage Content Security Policy (CSP) defaults and new API via `Hanami::Action::ApplicationConfiguration#content_security_policy`
7
+ - [Tim Riley & Marc Busqué] Provide access to routes inside all application actions via `Hanami::Action::ApplicationAction#routes`
8
+
9
+ ## v2.0.0.alpha3 - 2021-11-09
10
+ ### Added
11
+ - [Luca Guidi] Automatically include session behavior in `Hanami::Action` when sessions are enabled via Hanami application config
12
+ - [Sean Collins] Pass exposures from action to view
13
+
14
+ ### Changed
15
+ - [Tim Riley] (Internal) Updated settings to use updated `setting` API in dry-configurable 0.13.0
16
+ - [Sean Collins] Move automatic view rendering from `handle` to `finish`
17
+
18
+ ## v2.0.0.alpha2 - 2021-05-04
19
+ ### Added
20
+ - [Luca Guidi] Official support for Ruby: MRI 3.0
21
+ - [Tim Riley] Introduced `Hanami::Action::ApplicationAction`
22
+ - [Tim Riley] Introduced `Hanami::Action::Configuration`
23
+ - [Tim Riley] Introduced `Hanami::Action::ApplicationConfiguration`
24
+ - [Tim Riley] Auto-inject a paired view into any `Hanami::Action::ApplicationAction` instance
25
+ - [Tim Riley] Auto-render `Hanami::Action::ApplicationAction` subclasses that don't implement `#handle`
26
+ - [Tim Riley] Enable CSRF protection automatically when HTTP sessions are enabled
27
+
28
+ ### Fixed
29
+ - [Luca Guidi] Ensure `Hanami::Action::Response#renderable?` to return `false` when body is set
30
+ - [Andrew Croome] Ensure `Hanami::Action.accept` to use Rack `CONTENT_TYPE` for the _before callback_ check
31
+
32
+ ### Changed
33
+ - [Luca Guidi] Drop support for Ruby: MRI 2.5.
34
+ - [Tim Riley] Removed `Hanami::Action.handle_exception` in favor of `Hanami::Action.config.handle_exception`
35
+ - [Tim Riley] Rewritten `Hanami::Action::Flash`, based on Roda's `FlashHash`
36
+
37
+ ## v2.0.0.alpha1 - 2019-01-30
38
+ ### Added
39
+ - [Luca Guidi] `Hanami::Action::Request#session` to access the HTTP session as it was originally sent
40
+ - [Luca Guidi] `Hanami::Action::Request#cookies` to access the HTTP cookies as they were originally sent
41
+ - [Luca Guidi & Tim Riley] Allow to build a deep inheritance chain for actions
42
+
43
+ ### Changed
44
+ - [Luca Guidi] Drop support for Ruby: MRI 2.3, and 2.4.
45
+ - [Luca Guidi] `Hanami::Action` is a superclass
46
+ - [Luca Guidi] `Hanami::Action#initialize` requires a `configuration:` keyword argument
47
+ - [Luca Guidi] `Hanami::Action#initialize` returns a frozen action instance
48
+ - [Tim Riley] `Hanami::Action` subclasses must implement `#handle` instead of `#call`
49
+ - [Luca Guidi] `Hanami::Action#handle` accepts `Hanami::Action::Request` and `Hanami::Action::Response`
50
+ - [Luca Guidi] `Hanami::Action#handle` returns `Hanami::Action::Response`
51
+ - [Luca Guidi] Removed `Hanami::Controller.configure`, `.configuration`, `.duplicate`, and `.load!`
52
+ - [Luca Guidi] Removed `Hanami::Action.use` to mount Rack middleware at the action level
53
+ - [Luca Guidi] `Hanami::Controller::Configuration` changed syntax from DSL style to setters (eg. `Hanami::Controller::Configuration.new { |c| c.default_request_format = :html }`)
54
+ - [Luca Guidi] `Hanami::Controller::Configuration#initialize` returns a frozen configuration instance
55
+ - [Luca Guidi] Removed `Hanami::Controller::Configuration#prepare`
56
+ - [Luca Guidi] Removed `Hanami::Action.configuration`
57
+ - [Luca Guidi] Removed `Hanami::Action.configuration.handle_exceptions`
58
+ - [Luca Guidi] Removed `Hanami::Action.configuration.default_request_format` in favor of `#default_request_format`
59
+ - [Luca Guidi] Removed `Hanami::Action.configuration.default_charset` in favor of `#default_charset`
60
+ - [Luca Guidi] Removed `Hanami::Action.configuration.format` to register a MIME Type for a single action. Please use the configuration.
61
+ - [Luca Guidi] Removed `Hanami::Action.expose` in favor of `Hanami::Action::Response#[]=` and `#[]`
62
+ - [Luca Guidi] Removed `Hanami::Action#status=` in favor of `Hanami::Action::Response#status=`
63
+ - [Luca Guidi] Removed `Hanami::Action#body=` in favor of `Hanami::Action::Response#body=`
64
+ - [Luca Guidi] Removed `Hanami::Action#headers` in favor of `Hanami::Action::Response#headers`
65
+ - [Luca Guidi] Removed `Hanami::Action#accept?` in favor of `Hanami::Action::Request#accept?`
66
+ - [Luca Guidi] Removed `Hanami::Action#format` in favor of `Hanami::Action::Response#format`
67
+ - [Luca Guidi] Introduced `Hanami::Action#format` as factory to assign response format: `res.format = format(:json)` or `res.format = format("application/json")`
68
+ - [Luca Guidi] Removed `Hanami::Action#format=` in favor of `Hanami::Action::Response#format=`
69
+ - [Gustavo Caso] `Hanami::Action.accept` now looks at request `Content-Type` header to accept/deny a request
70
+ - [Luca Guidi] Removed `Hanami::Action#request_id` in favor of `Hanami::Action::Request#id`
71
+ - [Gustavo Caso] Removed `Hanami::Action#parsed_request_body` in favor of `Hanami::Action::Request#parsed_body`
72
+ - [Luca Guidi] Removed `Hanami::Action#head?` in favor of `Hanami::Action::Request#head?`
73
+ - [Luca Guidi] Removed `Hanami::Action#status` in favor of `Hanami::Action::Response#status=` and `#body=`
74
+ - [Luca Guidi] Removed `Hanami::Action#session` in favor of `Hanami::Action::Response#session`
75
+ - [Luca Guidi] Removed `Hanami::Action#cookies` in favor of `Hanami::Action::Response#cookies`
76
+ - [Luca Guidi] Removed `Hanami::Action#flash` in favor of `Hanami::Action::Response#flash`
77
+ - [Luca Guidi] Removed `Hanami::Action#redirect_to` in favor of `Hanami::Action::Response#redirect_to`
78
+ - [Luca Guidi] Removed `Hanami::Action#cache_control`, `#expires`, and `#fresh` in favor of `Hanami::Action::Response#cache_control`, `#expires`, and `#fresh`, respectively
79
+ - [Luca Guidi] Removed `Hanami::Action#send_file` and `#unsafe_send_file` in favor of `Hanami::Action::Response#send_file` and `#unsafe_send_file`, respectively
80
+ - [Luca Guidi] Removed `Hanami::Action#errors`
81
+ - [Gustavo Caso] Removed body cleanup for `HEAD` requests
82
+ - [Luca Guidi] `Hanami::Action` callback hooks now accept `Hanami::Action::Request` and `Hanami::Action::Response` arguments
83
+ - [Luca Guidi] When an exception is raised, it won't be caught, unless it's handled
84
+ - [Luca Guidi] `Hanami::Action` exception handlers now accept `Hanami::Action::Request`, `Hanami::Action::Response`, and exception arguments
85
+
4
86
  ## v1.3.3 - 2020-01-14
5
87
  ### Added
6
88
  - [Luca Guidi] Official support for Ruby: MRI 2.7
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2014-2017 Luca Guidi
1
+ Copyright © 2014-2021 Luca Guidi
2
2
 
3
3
  MIT License
4
4