hanamismith 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d1969dbd817c75605a0b1e5fc6174048a8bafff8d531953106bb9c2178820cc
4
- data.tar.gz: e21bca1261f7a94bca00ee717f97d9fb088373c8aa2968af815c80d0dbeb4ea2
3
+ metadata.gz: 303ac313b793f2daf1c8d4f10c7c535cc84252ef3e7ad4ac5f4186164a42a49d
4
+ data.tar.gz: 7f03c6a382cbc6288c7251c8e0884e2930d395e5bd36027927d2bed0c679ebe3
5
5
  SHA512:
6
- metadata.gz: 5894b869af2e0f574fd36eeae155e98664561c6f89dbbd21e9f78edf63be66d6f148122e182be66256209e3e23893dc84e3661a36b5f9b8c47bbe36404785fd5
7
- data.tar.gz: 73aa3cb71e78748d458a7dde1d2b94a42d116c742ccf785dbeed54744053f0055eb4812718b5846c06bfac21ca39ac6894d313d4c63bf9cd0961bbc5bb23136b
6
+ metadata.gz: 29cf9ef5b980523ef755006094cf74b00cfb5f134cad28b1ba9cde99b1ab286710264e241d33cf8aea3f997312ad579dc14ee41ac79c3518faaf785034585a72
7
+ data.tar.gz: 0cc2ad8c022aea8271e01d4aeef3c9eec10d09ebf463d9a83a6d11dd7826349a4d7a06b50e974502dd5384918475a79ad76c1ec3b8af703fd5ef0fd3b971faff
checksums.yaml.gz.sig CHANGED
Binary file
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 = "0.27.0"
5
+ spec.version = "0.28.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/hanamismith"
@@ -17,7 +17,7 @@ module Hanamismith
17
17
  end
18
18
 
19
19
  def call
20
- add_action
20
+ private_methods.grep(/\Aadd_/).sort.each { |method| __send__ method }
21
21
  configuration
22
22
  end
23
23
 
@@ -25,13 +25,65 @@ module Hanamismith
25
25
 
26
26
  attr_reader :configuration, :builder
27
27
 
28
+ def add_configuration
29
+ path = "%project_name%/config/slices/health.rb.erb"
30
+ builder.call(configuration.merge(template_path: path)).render
31
+ end
32
+
28
33
  def add_action
29
- %w[
30
- %project_name%/slices/health/actions/show.rb.erb
31
- %project_name%/spec/slices/health/actions/show_spec.rb.erb
32
- ].each do |path|
33
- builder.call(configuration.merge(template_path: path)).render
34
- end
34
+ path = "%project_name%/slices/health/action.rb.erb"
35
+ builder.call(configuration.merge(template_path: path)).render
36
+ end
37
+
38
+ def add_view
39
+ path = "%project_name%/slices/health/view.rb.erb"
40
+ builder.call(configuration.merge(template_path: path)).render
41
+ end
42
+
43
+ def add_layout
44
+ path = "%project_name%/slices/health/templates/layouts/app.html.erb.erb"
45
+ builder.call(configuration.merge(template_path: path))
46
+ .render
47
+ .replace("<!-- title -->", "<%= content_for :title %>")
48
+ .replace("<!-- favicon -->", favicon)
49
+ .replace("<!-- yield -->", "<%= yield %>")
50
+ end
51
+
52
+ def favicon
53
+ %(<%= favicon_tag "icon.svg", title: "#{configuration.project_label}: Icon", rel: ) +
54
+ %(:icon, type: "image/svg+xml" %>)
55
+ end
56
+
57
+ def add_show_template
58
+ path = "%project_name%/slices/health/templates/show.html.erb.erb"
59
+
60
+ builder.call(configuration.merge(template_path: path))
61
+ .render
62
+ .replace(
63
+ "<!-- title -->",
64
+ %(<% content_for :title, "Health | #{configuration.project_label}" %>)
65
+ )
66
+ .replace("<!-- color -->", %(<%= color %>))
67
+ end
68
+
69
+ def add_context
70
+ path = "%project_name%/slices/health/views/context.rb.erb"
71
+ builder.call(configuration.merge(template_path: path)).render
72
+ end
73
+
74
+ def add_show_view
75
+ path = "%project_name%/slices/health/views/show.rb.erb"
76
+ builder.call(configuration.merge(template_path: path)).render
77
+ end
78
+
79
+ def add_show_action
80
+ path = "%project_name%/slices/health/actions/show.rb.erb"
81
+ builder.call(configuration.merge(template_path: path)).render
82
+ end
83
+
84
+ def add_show_action_spec
85
+ path = "%project_name%/spec/slices/health/actions/show_spec.rb.erb"
86
+ builder.call(configuration.merge(template_path: path)).render
35
87
  end
36
88
  end
37
89
  end
@@ -25,6 +25,11 @@ module Hanamismith
25
25
 
26
26
  attr_reader :configuration, :builder
27
27
 
28
+ def add_configuration
29
+ path = "%project_name%/config/slices/home.rb.erb"
30
+ builder.call(configuration.merge(template_path: path)).render
31
+ end
32
+
28
33
  def add_action
29
34
  path = "%project_name%/slices/home/action.rb.erb"
30
35
  builder.call(configuration.merge(template_path: path)).render
@@ -52,17 +57,25 @@ module Hanamismith
52
57
  end
53
58
 
54
59
  def favicon
55
- %(<%= favicon_tag "icon.svg", title: "#{configuration.project_label}: Icon", rel: ) +
56
- %(:icon, type: "image/svg+xml" %>)
60
+ %(<%= favicon_tag app_assets["icon.svg"],\n) +
61
+ %( title: "#{configuration.project_label}: Icon",\n) +
62
+ %( rel: :icon,\n) +
63
+ %( type: "image/svg+xml" %>)
57
64
  end
58
65
 
59
66
  def manifest
60
- %(<%= tag.link title: "#{configuration.project_label}: Manifest", rel: ) +
61
- %(:manifest, href: asset_url("manifest.webmanifest") %>)
67
+ %(<%= tag.link title: "#{configuration.project_label}: Manifest",\n) +
68
+ %( rel: :manifest,\n) +
69
+ %( href: app_assets["manifest.webmanifest"] %>)
62
70
  end
63
71
 
64
72
  def stylesheet
65
- %(<%= stylesheet_tag "home/app", title: "#{configuration.project_label}: Stylesheet" %>)
73
+ %(<%= stylesheet_tag "app", title: "#{configuration.project_label}: Stylesheet" %>)
74
+ end
75
+
76
+ def add_context
77
+ path = "%project_name%/slices/home/views/context.rb.erb"
78
+ builder.call(configuration.merge(template_path: path)).render
66
79
  end
67
80
 
68
81
  def add_show_template
@@ -0,0 +1,6 @@
1
+ module Health
2
+ # The health slice configuration.
3
+ class Slice < Hanami::Slice
4
+ import keys: ["assets"], from: Hanami.app.container, as: :app
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Home
2
+ # The home slice configuration.
3
+ class Slice < Hanami::Slice
4
+ import keys: ["assets"], from: Hanami.app.container, as: :app
5
+ end
6
+ end
@@ -11,6 +11,6 @@
11
11
  "assets": "node config/assets.js"
12
12
  },
13
13
  "dependencies": {
14
- "hanami-assets": "^2.1.0-rc.2"
14
+ "hanami-assets": "github:hanami/assets-js#main"
15
15
  }
16
16
  }
@@ -0,0 +1,7 @@
1
+ # auto_register: false
2
+
3
+ module Health
4
+ # The health action.
5
+ class Action < <%= configuration.project_namespaced_class %>::Action
6
+ end
7
+ end
@@ -1,18 +1,14 @@
1
1
  module Health
2
2
  module Actions
3
3
  # The show action.
4
- class Show < <%= configuration.project_namespaced_class %>::Action
5
- using <%= configuration.project_namespaced_class %>::Refines::Actions::Response
6
-
4
+ class Show < Health::Action
7
5
  handle_exception Exception => :down
8
6
 
9
- def handle(*, response) = response.with body: body(:green), status: 200
7
+ def handle(*, response) = response.render view, color: :green
10
8
 
11
9
  private
12
10
 
13
- def down(*, response, _exception) = response.with body: body(:red), status: 503
14
-
15
- def body(color) = %(<html><body style="background-color: #{color}"></body></html>)
11
+ def down(*, response, _exception) = response.render view, color: :red, status: 503
16
12
  end
17
13
  end
18
14
  end
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="en">
4
+ <head>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
6
+
7
+ <title><!-- title --></title>
8
+
9
+ <meta charset="utf-8">
10
+ <meta name="description" content="A Hanamismith skeleton application.">
11
+ <meta name="author" content="Hanamismith">
12
+ <meta name="apple-mobile-web-app-capable" content="yes">
13
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
+
15
+ <link title="<%= configuration.project_label %>: Favorite Icon"
16
+ rel="icon"
17
+ href="https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
18
+ sizes="32x32">
19
+ <!-- favicon -->
20
+ <link title="<%= configuration.project_label %>: Apple Icon"
21
+ rel="apple-touch-icon"
22
+ href="https://alchemists.io/images/projects/hanamismith/icons/apple.png"
23
+ type="image/png">
24
+ </head>
25
+
26
+ <body>
27
+ <!-- yield -->
28
+ </body>
29
+ </html>
@@ -0,0 +1,4 @@
1
+ <!-- title -->
2
+
3
+ <main style="background-color: <!-- color -->; height: 100vh;">
4
+ </main>
@@ -0,0 +1,7 @@
1
+ # auto_register: false
2
+
3
+ module Heath
4
+ # The health view.
5
+ class View < <%= configuration.project_namespaced_class %>::View
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # auto_register: false
2
+
3
+ module Health
4
+ module Views
5
+ # Defines custom context.
6
+ class Context < Hanami::View::Context
7
+ include Deps[app_assets: "app.assets"]
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Health
2
+ module Views
3
+ # Renders show view.
4
+ class Show < Health::View
5
+ expose :color
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ # auto_register: false
2
+
3
+ module Home
4
+ module Views
5
+ # Defines custom context.
6
+ class Context < Hanami::View::Context
7
+ include Deps[app_assets: "app.assets"]
8
+ end
9
+ end
10
+ end
@@ -4,10 +4,9 @@ RSpec.describe Health::Actions::Show do
4
4
  subject(:action) { described_class.new }
5
5
 
6
6
  describe "#call" do
7
- it "answers 200 OK status with green background" do
8
- expect(action.call({})).to have_attributes(
9
- body: [%(<html><body style="background-color: green"></body></html>)],
10
- status: 200
7
+ it "answers green background" do
8
+ expect(action.call({}).body.first).to include(
9
+ %(<main style="background-color: green; height: 100vh;">\n</main>)
11
10
  )
12
11
  end
13
12
  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: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-01-28 00:00:00.000000000 Z
38
+ date: 2024-02-17 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -295,12 +295,20 @@ files:
295
295
  - lib/hanamismith/templates/%project_name%/config/puma.rb.erb
296
296
  - lib/hanamismith/templates/%project_name%/config/routes.rb.erb
297
297
  - lib/hanamismith/templates/%project_name%/config/settings.rb.erb
298
+ - lib/hanamismith/templates/%project_name%/config/slices/health.rb.erb
299
+ - lib/hanamismith/templates/%project_name%/config/slices/home.rb.erb
298
300
  - lib/hanamismith/templates/%project_name%/env.development.erb
299
301
  - lib/hanamismith/templates/%project_name%/env.test.erb
300
302
  - lib/hanamismith/templates/%project_name%/lib/%project_path%/refines/actions/response.rb.erb
301
303
  - lib/hanamismith/templates/%project_name%/lib/%project_path%/types.rb.erb
302
304
  - lib/hanamismith/templates/%project_name%/package.json.erb
305
+ - lib/hanamismith/templates/%project_name%/slices/health/action.rb.erb
303
306
  - lib/hanamismith/templates/%project_name%/slices/health/actions/show.rb.erb
307
+ - lib/hanamismith/templates/%project_name%/slices/health/templates/layouts/app.html.erb.erb
308
+ - lib/hanamismith/templates/%project_name%/slices/health/templates/show.html.erb.erb
309
+ - lib/hanamismith/templates/%project_name%/slices/health/view.rb.erb
310
+ - lib/hanamismith/templates/%project_name%/slices/health/views/context.rb.erb
311
+ - lib/hanamismith/templates/%project_name%/slices/health/views/show.rb.erb
304
312
  - lib/hanamismith/templates/%project_name%/slices/home/action.rb.erb
305
313
  - lib/hanamismith/templates/%project_name%/slices/home/actions/show.rb.erb
306
314
  - lib/hanamismith/templates/%project_name%/slices/home/assets/css/app.css.erb
@@ -309,6 +317,7 @@ files:
309
317
  - lib/hanamismith/templates/%project_name%/slices/home/templates/layouts/app.html.erb.erb
310
318
  - lib/hanamismith/templates/%project_name%/slices/home/templates/show.html.erb.erb
311
319
  - lib/hanamismith/templates/%project_name%/slices/home/view.rb.erb
320
+ - lib/hanamismith/templates/%project_name%/slices/home/views/context.rb.erb
312
321
  - lib/hanamismith/templates/%project_name%/slices/home/views/show.rb.erb
313
322
  - lib/hanamismith/templates/%project_name%/spec/hanami_helper.rb.erb
314
323
  - lib/hanamismith/templates/%project_name%/spec/lib/%project_path%/refines/actions/response_spec.rb.erb
@@ -342,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
351
  - !ruby/object:Gem::Version
343
352
  version: '0'
344
353
  requirements: []
345
- rubygems_version: 3.5.5
354
+ rubygems_version: 3.5.6
346
355
  signing_key:
347
356
  specification_version: 4
348
357
  summary: A command line interface for smithing Hanami projects.
metadata.gz.sig CHANGED
Binary file