hanamismith 1.10.0 → 1.11.0

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 (31) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +8 -6
  4. data/hanamismith.gemspec +1 -1
  5. data/lib/hanamismith/builders/bundler.rb +1 -1
  6. data/lib/hanamismith/builders/circle_ci.rb +16 -1
  7. data/lib/hanamismith/builders/environments/all.rb +2 -1
  8. data/lib/hanamismith/builders/layout.rb +34 -0
  9. data/lib/hanamismith/builders/providers/htmx.rb +20 -0
  10. data/lib/hanamismith/builders/stylesheet.rb +10 -2
  11. data/lib/hanamismith/cli/commands/build.rb +1 -0
  12. data/lib/hanamismith/templates/%project_name%/.circleci/config.yml.erb +1 -0
  13. data/lib/hanamismith/templates/%project_name%/app/assets/css/colors.css.erb +4 -0
  14. data/lib/hanamismith/templates/%project_name%/app/assets/css/defaults.css.erb +120 -0
  15. data/lib/hanamismith/templates/%project_name%/app/assets/css/{app.css.erb → layout.css.erb} +16 -17
  16. data/lib/hanamismith/templates/%project_name%/app/assets/css/settings.css.erb +7 -0
  17. data/lib/hanamismith/templates/%project_name%/app/assets/css/view_transitions.css.erb +5 -0
  18. data/lib/hanamismith/templates/%project_name%/app/assets/js/app.js.erb +8 -1
  19. data/lib/hanamismith/templates/%project_name%/app/templates/layouts/app.html.erb.erb +9 -8
  20. data/lib/hanamismith/templates/%project_name%/config/app.rb.erb +13 -1
  21. data/lib/hanamismith/templates/%project_name%/config/providers/htmx.rb.erb +5 -0
  22. data/lib/hanamismith/templates/%project_name%/config/settings.rb.erb +1 -0
  23. data/lib/hanamismith/templates/%project_name%/env.erb +4 -1
  24. data/lib/hanamismith/templates/%project_name%/lib/%project_path%/refines/actions/response.rb.erb +3 -1
  25. data/lib/hanamismith/templates/%project_name%/package.json.erb +3 -2
  26. data/lib/hanamismith/templates/%project_name%/spec/lib/%project_path%/refines/actions/response_spec.rb.erb +15 -3
  27. data.tar.gz.sig +0 -0
  28. metadata +9 -5
  29. metadata.gz.sig +0 -0
  30. data/lib/hanamismith/templates/%project_name%/config/providers/persistence.rb.erb +0 -44
  31. data/lib/hanamismith/templates/%project_name%/config/providers/yjit.rb.erb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efd67bd6ab9044a59a6c76915a9396ec247ac09c6f9812efc6f3c66b45a8e77a
4
- data.tar.gz: 0c89a3ad8ff3dfaba812f6936f28c56c975e3a9f62c74834193fbfc788677bba
3
+ metadata.gz: 99d8a44f11d0435d1a4a42b5fe9cccb713ffa2cea43da1ce7291cfaabc926b17
4
+ data.tar.gz: 0e802783aededd9c3779551d0204f8ad246615940586c3eb60262a8fc29caaf1
5
5
  SHA512:
6
- metadata.gz: 3006f6f43b69260f29f203171d266a305d5cfc114d5eb48fb940b1379f86f59df65adad2c6fb299b81f7a75b049106485c76c86801a3ed3f66030c314230bad3
7
- data.tar.gz: 55e7b3111ecae05acaac5348255d07394d42353acf0e02b07a1abaa66be25fd1ab0cb01600ccf88f1225ade6339650435cc71fd701b2f0114aba651285282d39
6
+ metadata.gz: f3d77a113ad86e3a95528667b2c5c217a3580b0a7fc4f27a899e02335c7a9a92a688fc1bed007f0ca29afcfcac434cf5c591f49565016c1b7696210357b7b4b0
7
+ data.tar.gz: 949f259fc32d8fad670a2c8d0ee627817c87348a66699298899b80d7a5347cf18f6c73157f20b78f9350852a7d36d13b4e609743ced1c6bae5bd444d035de11a
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -7,8 +7,10 @@
7
7
  :dotenv_link: link:https://github.com/bkeepers/dotenv[Dotenv]
8
8
  :dotfiles_link: link:https://alchemists.io/projects/dotfiles[Dotfiles]
9
9
  :hanami_link: link:https://hanamirb.org[Hanami]
10
- :htmx_link: link:https://alchemists.io/projects/htmx[HTMX]
10
+ :htmx_gem_link: link:https://alchemists.io/projects/htmx[HTMX]
11
+ :htmx_link: link:https://htmx.org[htmx]
11
12
  :pg_link: link:https://github.com/ged/ruby-pg[pg]
13
+ :postgresql_link: link:https://www.postgresql.org[PostgreSQL]
12
14
  :puma_link: link:https://puma.io[Puma]
13
15
  :rack_link: link:https://github.com/rack/rack[Rack]
14
16
  :rom_link: link:https://rom-rb.org[ROM]
@@ -22,18 +24,18 @@ toc::[]
22
24
 
23
25
  == Features
24
26
 
25
- * Built atop {rubysmith_link} for building project skeleton.
27
+ * Built atop {rubysmith_link} for building project skeletons.
26
28
  * Uses {hanami_link} for web application development.
27
- * Uses {htmx_link} for Hypermedia REST so you can write less code and avoid bloated JavaScript stacks.
28
- * Uses {pg_link} coupled with {rom_link} for database management.
29
+ * Uses {htmx_link} (along with the {htmx_gem_link} gem) for Hypermedia REST so you can write less code and avoid bloated JavaScript stacks.
30
+ * Uses {postgresql_link} for the database, {pg_link} for the client, and {rom_link} Ruby object mapper.
29
31
  * Uses {rack_link}, specifically: link:https://github.com/rack/rack-attack[Rack::Attack], `Rack::Deflater`, and `Rack::Static`.
30
- * Uses {puma_link} as the default web server and fully configured for local and production environments.
32
+ * Uses {puma_link} for the web server including being fully configured for local and production environments.
31
33
  * Uses {capybara_link} with {cuprite_link} (driver) for full, headless, feature testing.
32
34
  * Uses {dotenv_link} for managing your environment configurations.
33
35
  * Provides support for Continuous Integration systems like link:https://circleci.com[Circle CI] (default) and link:https://docs.github.com/en/actions[GitHub Actions].
34
36
  * Provides the `/up` health check endpoint via the `Health` slice.
35
37
  * Configures link:https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md[YJIT] so you can deploy with YJIT disabled (i.e. `RUBYOPT=--yjit-disable --yjit-exec-mem-size=192`) and let the application enable upon boot.
36
- * Disables link:https://github.com/ruby/irb[IRB] console autocomplete when used in production-like environments. You can re-enable IRB autocomplete by setting `IRB_USE_AUTOCOMPLETE=true` before launching your console in non development or test environments.
38
+ * Ensures link:https://github.com/ruby/irb[IRB] console autocomplete is disabled when used in production-like environments. You can re-enable IRB autocomplete by setting `IRB_USE_AUTOCOMPLETE=true` before launching your console in non development or test environments.
37
39
 
38
40
  == Screenshots/Screencasts
39
41
 
data/hanamismith.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "hanamismith"
5
- spec.version = "1.10.0"
5
+ spec.version = "1.11.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/hanamismith"
@@ -52,7 +52,7 @@ module Hanamismith
52
52
  gem "dry-validation", "~> 1.10"
53
53
  gem "htmx", "~> 2.1"
54
54
  gem "overmind", "~> 2.5"
55
- gem "puma", "~> 6.6"
55
+ gem "puma", "~> 7.0"
56
56
  gem "rack-attack", "~> 6.7"
57
57
  CONTENT
58
58
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "refinements/struct"
4
+ require "securerandom"
4
5
 
5
6
  module Hanamismith
6
7
  module Builders
@@ -8,13 +9,27 @@ module Hanamismith
8
9
  class CircleCI < Rubysmith::Builders::Abstract
9
10
  using Refinements::Struct
10
11
 
12
+ def initialize(generator: SecureRandom, **)
13
+ @generator = generator
14
+ super(**)
15
+ end
16
+
11
17
  def call
12
18
  return false unless settings.build_circle_ci
13
19
 
14
20
  path = "%project_name%/.circleci/config.yml.erb"
15
- builder.call(settings.with(template_path: path)).render.replace(/\n\n\Z/, "\n")
21
+
22
+ builder.call(settings.with(template_path: path))
23
+ .render
24
+ .replace("<app_secret>", generator.hex(30))
25
+ .replace(/\n\n\Z/, "\n")
26
+
16
27
  true
17
28
  end
29
+
30
+ private
31
+
32
+ attr_reader :generator
18
33
  end
19
34
  end
20
35
  end
@@ -18,7 +18,8 @@ module Hanamismith
18
18
  def call
19
19
  builder.call(settings.with(template_path: "%project_name%/env.erb"))
20
20
  .render
21
- .replace("<password>", generator.hex(15))
21
+ .replace("<app_secret>", generator.hex(40))
22
+ .replace("<pg_password>", generator.hex(15))
22
23
  .rename(".env")
23
24
 
24
25
  true
@@ -13,16 +13,30 @@ module Hanamismith
13
13
  builder.call(settings.with(template_path: path))
14
14
  .render
15
15
  .replace("<!-- title -->", "<%= content_for :title %>")
16
+ .replace("<!-- favicon -->", favicon)
16
17
  .replace("<!-- icon -->", icon)
18
+ .replace("<!-- apple_icon -->", apple_icon)
17
19
  .replace("<!-- manifest -->", manifest)
18
20
  .replace("<!-- stylesheet -->", stylesheet)
21
+ .replace("<!-- javascript -->", javascript)
19
22
  .replace("<!-- yield -->", "<%= yield %>")
23
+ .replace("<!-- flash:alert -->", flash(:alert))
24
+ .replace("<!-- flash:notice -->", flash(:notice))
20
25
 
21
26
  true
22
27
  end
23
28
 
24
29
  private
25
30
 
31
+ def favicon
32
+ uri = "https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
33
+
34
+ %(<%= tag.link title: "#{settings.project_label}: Favicon",\n) +
35
+ %( rel: :icon,\n) +
36
+ %( href: "#{uri}",\n) +
37
+ %( sizes: "32x32" %>)
38
+ end
39
+
26
40
  def icon
27
41
  %(<%= tag.link title: "#{settings.project_label}: Icon",\n) +
28
42
  %( rel: :icon,\n) +
@@ -30,6 +44,24 @@ module Hanamismith
30
44
  %( type: "image/svg+xml" %>)
31
45
  end
32
46
 
47
+ def apple_icon
48
+ uri = "https://alchemists.io/images/projects/hanamismith/icons/apple.png"
49
+
50
+ %(<%= tag.link title: "#{settings.project_label}: Apple Icon",\n) +
51
+ %( rel: "apple-touch-icon",\n) +
52
+ %( href: "#{uri}",\n) +
53
+ %( type: "image/png" %>)
54
+ end
55
+
56
+ # :reek:UtilityFunction
57
+ def flash kind
58
+ %(<% if flash[:#{kind}] %>\n) +
59
+ %( <div class="site-#{kind}">\n) +
60
+ %( <p><%= flash[:#{kind}] %></p>\n) +
61
+ %( </div>\n) +
62
+ %( <% end %>\n)
63
+ end
64
+
33
65
  def manifest
34
66
  %(<%= tag.link title: "#{settings.project_label}: Manifest",\n) +
35
67
  %( rel: :manifest,\n) +
@@ -40,6 +72,8 @@ module Hanamismith
40
72
  %(<%= tag.link title: "#{settings.project_label}: Stylesheet", rel: :stylesheet, ) +
41
73
  %(href: app_assets["app.css"] %>)
42
74
  end
75
+
76
+ def javascript = %(<%= tag.script src: app_assets["app.js"], type: "text/javascript" %>)
43
77
  end
44
78
  end
45
79
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/struct"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ module Providers
8
+ # Builds project skeleton for HTMX provider.
9
+ class HTMX < Rubysmith::Builders::Abstract
10
+ using Refinements::Struct
11
+
12
+ def call
13
+ path = "%project_name%/config/providers/htmx.rb.erb"
14
+ builder.call(settings.with(template_path: path)).render
15
+ true
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -9,8 +9,16 @@ module Hanamismith
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- path = "%project_name%/app/assets/css/app.css.erb"
13
- builder.call(settings.with(template_path: path)).render
12
+ %w[
13
+ %project_name%/app/assets/css/settings.css.erb
14
+ %project_name%/app/assets/css/colors.css.erb
15
+ %project_name%/app/assets/css/view_transitions.css.erb
16
+ %project_name%/app/assets/css/defaults.css.erb
17
+ %project_name%/app/assets/css/layout.css.erb
18
+ ].each do |path|
19
+ builder.call(settings.with(template_path: path)).render
20
+ end
21
+
14
22
  true
15
23
  end
16
24
  end
@@ -13,6 +13,7 @@ module Hanamismith
13
13
  BUILDERS = [
14
14
  Rubysmith::Builders::Init,
15
15
  Builders::Core,
16
+ Builders::Providers::HTMX,
16
17
  Builders::Refinement,
17
18
  Builders::Icon,
18
19
  Builders::Stylesheet,
@@ -5,6 +5,7 @@ jobs:
5
5
  docker:
6
6
  - image: bkuhlmann/alpine-ruby:latest
7
7
  environment:
8
+ APP_SECRET: <app_secret>
8
9
  HANAMI_ENV: test
9
10
  DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
10
11
  - image: postgres:latest
@@ -0,0 +1,4 @@
1
+ :root {
2
+ --color-black: hsl(0, 0%, 0%);
3
+ --color-white: hsl(0, 0%, 100%);
4
+ }
@@ -0,0 +1,120 @@
1
+ *, *::after, *::before {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ @media (prefers-reduced-motion: no-preference) {
6
+ :where(html) {
7
+ interpolate-size: allow-keywords;
8
+ }
9
+ }
10
+
11
+ :where(html) {
12
+ accent-color: var(--color-white);
13
+ background-color: var(--color-black);
14
+ font-family: var(--site-font-family);
15
+ height: 100%;
16
+ line-height: 1.5;
17
+ overscroll-behavior: none;
18
+ scrollbar-color: var(--color-white) var(--site-red);
19
+ scrollbar-gutter: stable;
20
+ text-size-adjust: none;
21
+ -moz-text-size-adjust: none;
22
+ -webkit-font-smoothing: antialiased;
23
+ -webkit-text-size-adjust: none;
24
+
25
+ ::selection {
26
+ background-color: var(--color-white);
27
+ color: var(--color-black);
28
+ }
29
+ }
30
+
31
+ :where(audio, iframe, img, svg, video) {
32
+ max-block-size: 100%;
33
+ max-inline-size: 100%;
34
+ }
35
+
36
+ :where(button, input, select, textarea) {
37
+ font: inherit;
38
+ }
39
+
40
+ :where(a) {
41
+ color: var(--color-white);
42
+ text-decoration: none;
43
+
44
+ &:hover {
45
+ text-decoration: underline;
46
+ text-underline-position: under;
47
+ }
48
+ }
49
+
50
+ :where(abbr[title]) {
51
+ cursor: help;
52
+ text-decoration-line: underline;
53
+ text-decoration-style: dotted;
54
+ }
55
+
56
+ :where(code) {
57
+ background-color: var(--color-black);
58
+ border-radius: 0.3rem;
59
+ color: var(--color-white);
60
+ font-size: 0.95rem;
61
+ padding: 0.1rem 0.3rem;
62
+ }
63
+
64
+ :where(h1, h2, h3, h4, h5, h6, p) {
65
+ overflow-wrap: break-word;
66
+ }
67
+
68
+ :where(h1, h2, h3, h4, h5, h6) {
69
+ text-wrap: balance;
70
+ }
71
+
72
+ :where(h1, h2) {
73
+ font-weight: 400;
74
+ font-size: 2.75em;
75
+ }
76
+
77
+ :where(img) {
78
+ display: block;
79
+ height: auto;
80
+ max-width: 100%;
81
+ object-fit: cover;
82
+ }
83
+
84
+ :where(kbd) {
85
+ background-color: var(--color-white);
86
+ border-radius: 0.2rem;
87
+ border: 0.1rem solid var(--color-white);
88
+ color: var(--color-black);
89
+ font-size: 0.85em;
90
+ font-weight: 600;
91
+ line-height: 1rem;
92
+ padding: 0.1rem 0.3rem;
93
+ white-space: nowrap;
94
+ }
95
+
96
+ :where(label):has(+:where(textarea, input, select)) {
97
+ display: block;
98
+ }
99
+
100
+ :where(p) {
101
+ text-wrap: pretty;
102
+ }
103
+
104
+ :where(pre:not([class^=language])) {
105
+ background-color: var(--color-black);
106
+ color: var(--color-white);
107
+ padding: 0.5rem 1rem;
108
+ font-size: 0.9rem;
109
+ white-space: pre-wrap;
110
+ }
111
+
112
+ :where(pre) {
113
+ border-radius: 0.5rem;
114
+ font-weight: 400;
115
+ padding: 0.5rem;
116
+ }
117
+
118
+ :where(textarea:not([rows])) {
119
+ min-block-size: 6em;
120
+ }
@@ -1,21 +1,4 @@
1
- @media (prefers-reduced-motion: no-preference) {
2
- @view-transition {
3
- navigation: auto;
4
- }
5
- }
6
-
7
- html {
8
- height: 100%;
9
- }
10
-
11
1
  .site-page {
12
- --color-pink: hsl(306, 81%, 77%);
13
- --color-red: hsl(11, 86%, 46%);
14
- --color-rose: hsl(338, 27%, 88%);
15
- --color-white: hsl(0, 0%, 100%);
16
- --color-black: hsl(0, 0%, 0%);
17
- --font-family: Verdana;
18
-
19
2
  background-color: var(--color-black);
20
3
  background-image: linear-gradient(
21
4
  0deg,
@@ -99,3 +82,19 @@ html {
99
82
  }
100
83
  }
101
84
  }
85
+
86
+ .site-alert, .site-notice {
87
+ border-radius: 0.5rem;
88
+ font-weight: 600;
89
+ padding: 0 1rem;
90
+ }
91
+
92
+ .site-alert {
93
+ background-color: var(--site-red);
94
+ color: var(--site-white);
95
+ }
96
+
97
+ .site-notice {
98
+ background-color: var(--site-blue);
99
+ color: var(--site-white);
100
+ }
@@ -0,0 +1,7 @@
1
+ :root {
2
+ --site-font-family: Verdana, system-ui, sans-serif;
3
+ --site-z-index-hidden: -10;
4
+ --site-z-index-tooltip: 10;
5
+ --site-z-index-navigation: 20;
6
+ --site-z-index-modal: 100;
7
+ }
@@ -0,0 +1,5 @@
1
+ @media (prefers-reduced-motion: no-preference) {
2
+ @view-transition {
3
+ navigation: auto;
4
+ }
5
+ }
@@ -1 +1,8 @@
1
- import "../css/app.css";
1
+ import "../css/settings.css";
2
+ import "../css/colors.css";
3
+ import "../css/view_transitions.css";
4
+ import "../css/defaults.css";
5
+ import "../css/layout.css";
6
+
7
+ import htmx from "htmx.org";
8
+ window.htmx = htmx;
@@ -13,21 +13,22 @@
13
13
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
  <meta name="view-transition" content="same-origin">
15
15
 
16
- <link title="<%= settings.project_label %>: Favicon"
17
- rel="icon"
18
- href="https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
19
- sizes="32x32">
16
+ <!-- favicon -->
17
+
20
18
  <!-- icon -->
21
- <link title="<%= settings.project_label %>: Apple Icon"
22
- rel="apple-touch-icon"
23
- href="https://alchemists.io/images/projects/hanamismith/icons/apple.png"
24
- type="image/png">
19
+
20
+ <!-- apple_icon -->
21
+
25
22
  <!-- manifest -->
26
23
 
27
24
  <!-- stylesheet -->
25
+
26
+ <!-- javascript -->
28
27
  </head>
29
28
 
30
29
  <body class="site-page">
30
+ <!-- flash:alert -->
31
+ <!-- flash:notice -->
31
32
  <!-- yield -->
32
33
  </body>
33
34
  </html>
@@ -3,7 +3,10 @@ require "hanami"
3
3
  <% namespace do %>
4
4
  # The application base configuration.
5
5
  class App < Hanami::App
6
+ # :nocov:
6
7
  RubyVM::YJIT.enable
8
+ # :nocov:
9
+
7
10
  Dry::Schema.load_extensions :monads
8
11
  Dry::Validation.load_extensions :monads
9
12
 
@@ -15,9 +18,18 @@ require "hanami"
15
18
 
16
19
  config.actions.content_security_policy.then do |csp|
17
20
  csp[:manifest_src] = "'self'"
18
- csp[:script_src] += " 'unsafe-eval' 'unsafe-inline' https://unpkg.com/"
21
+ csp[:script_src] += " 'unsafe-eval' 'unsafe-inline'"
19
22
  end
20
23
 
24
+ # rubocop:todo Layout/FirstArrayElementLineBreak
25
+ config.actions.sessions = :cookie,
26
+ {
27
+ key: "<%= settings.project_name %>.session",
28
+ secret: settings.app_secret,
29
+ expire_after: 3_600 # 1 hour.
30
+ }
31
+ # rubocop:enable Layout/FirstArrayElementLineBreak
32
+
21
33
  environment :development do
22
34
  # :nocov:
23
35
  config.logger.options[:colorize] = true
@@ -0,0 +1,5 @@
1
+ Hanami.app.register_provider :htmx do
2
+ prepare { require "htmx" }
3
+
4
+ start { register :htmx, HTMX }
5
+ end
@@ -1,5 +1,6 @@
1
1
  <% namespace do %>
2
2
  # The application base settings.
3
3
  class Settings < Hanami::Settings
4
+ setting :app_secret, constructor: Types::String.constrained(filled: true)
4
5
  end
5
6
  <% end %>
@@ -1,3 +1,6 @@
1
+ APP_SECRET=<app_secret>
2
+
1
3
  PG_DATABASE=<%= settings.project_name %>
2
- PG_PASSWORD=<password>
4
+ PG_PASSWORD=<pg_password>
5
+ PG_PORT=5432
3
6
  PG_USER=<%= settings.project_name %>
@@ -4,9 +4,11 @@
4
4
  # Modifies and enhances default Hanami action response behavior.
5
5
  module Response
6
6
  refine Hanami::Action::Response do
7
- def with body:, status:
7
+ def with body:, format: nil, status: 200
8
8
  @body = [body]
9
9
  @status = status
10
+
11
+ self.format = format if format
10
12
  self
11
13
  end
12
14
  end
@@ -6,8 +6,9 @@
6
6
  "license": "<%= settings.license_label_version %>",
7
7
  "private": true,
8
8
  "type": "module",
9
- "keywords": ["ruby", "hanami"],
9
+ "keywords": ["hanami", "htmx", "ruby"],
10
10
  "dependencies": {
11
- "hanami-assets": "^2.2.0"
11
+ "hanami-assets": "^2.2.0",
12
+ "htmx.org": "^2.0.7"
12
13
  }
13
14
  }
@@ -3,16 +3,28 @@ require "hanami_helper"
3
3
  RSpec.describe <%= settings.project_namespaced_class %>::Refines::Actions::Response do
4
4
  using described_class
5
5
 
6
- subject(:response) { Hanami::Action::Response.new request:, config: {} }
6
+ subject :response do
7
+ config = Class.new(Hanami::Action).config.tap { it.format :json }
8
+ Hanami::Action::Response.new request:, config:
9
+ end
7
10
 
8
11
  let :request do
9
12
  Rack::MockRequest.env_for("/").then { |env| Hanami::Action::Request.new env:, params: {} }
10
13
  end
11
14
 
12
15
  describe "#with" do
13
- it "answers response with given body and status" do
14
- expect(response.with(body: "Danger!", status: 400)).to have_attributes(
16
+ it "answers response with required body and status" do
17
+ expect(response.with(body: "A test.")).to have_attributes(
18
+ body: ["A test."],
19
+ format: nil,
20
+ status: 200
21
+ )
22
+ end
23
+
24
+ it "answers response with body, format, and status" do
25
+ expect(response.with(body: "Danger!", format: :json, status: 400)).to have_attributes(
15
26
  body: ["Danger!"],
27
+ format: :json,
16
28
  status: 400
17
29
  )
18
30
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanamismith
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -251,6 +251,7 @@ files:
251
251
  - lib/hanamismith/builders/javascript.rb
252
252
  - lib/hanamismith/builders/layout.rb
253
253
  - lib/hanamismith/builders/node.rb
254
+ - lib/hanamismith/builders/providers/htmx.rb
254
255
  - lib/hanamismith/builders/puma/configuration.rb
255
256
  - lib/hanamismith/builders/puma/procfile.rb
256
257
  - lib/hanamismith/builders/pwa.rb
@@ -279,7 +280,11 @@ files:
279
280
  - lib/hanamismith/templates/%project_name%/Procfile.dev.erb
280
281
  - lib/hanamismith/templates/%project_name%/Procfile.erb
281
282
  - lib/hanamismith/templates/%project_name%/app/action.rb.erb
282
- - lib/hanamismith/templates/%project_name%/app/assets/css/app.css.erb
283
+ - lib/hanamismith/templates/%project_name%/app/assets/css/colors.css.erb
284
+ - lib/hanamismith/templates/%project_name%/app/assets/css/defaults.css.erb
285
+ - lib/hanamismith/templates/%project_name%/app/assets/css/layout.css.erb
286
+ - lib/hanamismith/templates/%project_name%/app/assets/css/settings.css.erb
287
+ - lib/hanamismith/templates/%project_name%/app/assets/css/view_transitions.css.erb
283
288
  - lib/hanamismith/templates/%project_name%/app/assets/images/icon.svg.erb
284
289
  - lib/hanamismith/templates/%project_name%/app/assets/js/app.js.erb
285
290
  - lib/hanamismith/templates/%project_name%/app/assets/pwa/manifest.webmanifest.erb
@@ -294,8 +299,7 @@ files:
294
299
  - lib/hanamismith/templates/%project_name%/config/app.rb.erb
295
300
  - lib/hanamismith/templates/%project_name%/config/assets.js.erb
296
301
  - lib/hanamismith/templates/%project_name%/config/initializers/rack_attack.rb.erb
297
- - lib/hanamismith/templates/%project_name%/config/providers/persistence.rb.erb
298
- - lib/hanamismith/templates/%project_name%/config/providers/yjit.rb.erb
302
+ - lib/hanamismith/templates/%project_name%/config/providers/htmx.rb.erb
299
303
  - lib/hanamismith/templates/%project_name%/config/puma.rb.erb
300
304
  - lib/hanamismith/templates/%project_name%/config/routes.rb.erb
301
305
  - lib/hanamismith/templates/%project_name%/config/settings.rb.erb
@@ -353,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
357
  - !ruby/object:Gem::Version
354
358
  version: '0'
355
359
  requirements: []
356
- rubygems_version: 3.7.1
360
+ rubygems_version: 3.7.2
357
361
  specification_version: 4
358
362
  summary: A command line interface for smithing Hanami projects.
359
363
  test_files: []
metadata.gz.sig CHANGED
Binary file
@@ -1,44 +0,0 @@
1
- # :nocov:
2
- # rubocop:todo Metrics/BlockLength
3
- Hanami.app.register_provider :persistence, namespace: true do
4
- prepare do
5
- require "rom-changeset"
6
- require "rom/core"
7
- require "rom/sql"
8
-
9
- Sequel::Database.extension :constant_sql_override, :pg_enum
10
- Sequel.database_timezone = :utc
11
- Sequel.application_timezone = :local
12
-
13
- configuration = ROM::Configuration.new :sql, target["settings"].database_url
14
-
15
- configuration.plugin :sql, relations: :instrumentation do |plugin_config|
16
- plugin_config.notifications = target["notifications"]
17
- end
18
-
19
- configuration.plugin :sql, relations: :auto_restrictions
20
-
21
- database = configuration.gateways[:default].connection
22
- database.set_constant_sql Sequel::CURRENT_TIMESTAMP, "(CURRENT_TIMESTAMP AT TIME ZONE 'UTC')"
23
-
24
- register "config", configuration
25
- register "db", database
26
-
27
- Sequel::Migrator.is_current? database, Hanami.app.root.join("db/migrate")
28
- rescue NoMethodError, Sequel::Migrator::Error => error
29
- message = error.message
30
- Hanami.logger.error message unless error.is_a?(NoMethodError) && message.include?("migration")
31
- end
32
-
33
- start do
34
- configuration = target["persistence.config"]
35
-
36
- configuration.auto_registration(
37
- target.root.join("lib/<%= settings.project_path %>/persistence"),
38
- namespace: "<%= settings.project_namespaced_class %>::Persistence"
39
- )
40
-
41
- register "rom", ROM.container(configuration)
42
- end
43
- end
44
- # rubocop:enable Metrics/BlockLength
@@ -1,3 +0,0 @@
1
- Hanami.app.register_provider :yjit do
2
- start { RubyVM::YJIT.enable }
3
- end