hanamismith 0.22.1 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +2 -2
- data/hanamismith.gemspec +1 -2
- data/lib/hanamismith/builders/asset.rb +29 -0
- data/lib/hanamismith/builders/bundler.rb +13 -0
- data/lib/hanamismith/builders/git/ignore.rb +29 -0
- data/lib/hanamismith/builders/icon.rb +1 -1
- data/lib/hanamismith/builders/javascript.rb +29 -0
- data/lib/hanamismith/builders/{rack.rb → node.rb} +4 -3
- data/lib/hanamismith/builders/pwa.rb +1 -1
- data/lib/hanamismith/builders/rack/attack.rb +42 -0
- data/lib/hanamismith/builders/rack/configuration.rb +30 -0
- data/lib/hanamismith/builders/rack/deflater.rb +32 -0
- data/lib/hanamismith/builders/setup.rb +1 -0
- data/lib/hanamismith/builders/slices/home.rb +17 -0
- data/lib/hanamismith/builders/stylesheet.rb +1 -1
- data/lib/hanamismith/cli/commands/build.rb +9 -3
- data/lib/hanamismith/extensions/npm.rb +43 -0
- data/lib/hanamismith/templates/%project_name%/Procfile.dev.erb +2 -1
- data/lib/hanamismith/templates/%project_name%/Procfile.erb +1 -0
- data/lib/hanamismith/templates/%project_name%/{public → app/assets/pwa}/manifest.webmanifest.erb +1 -1
- data/lib/hanamismith/templates/%project_name%/config/app.rb.erb +0 -9
- data/lib/hanamismith/templates/%project_name%/config/assets.js.erb +3 -0
- data/lib/hanamismith/templates/%project_name%/config/initializers/rack_attack.rb.erb +16 -0
- data/lib/hanamismith/templates/%project_name%/config/puma.rb.erb +7 -7
- data/lib/hanamismith/templates/%project_name%/package.json.erb +16 -0
- data/lib/hanamismith/templates/%project_name%/{public/stylesheets/home.css.erb → slices/home/assets/css/app.css.erb} +18 -15
- data/lib/hanamismith/templates/%project_name%/slices/home/assets/js/app.js.erb +1 -0
- data/lib/hanamismith/templates/%project_name%/slices/home/templates/layouts/app.html.erb.erb +3 -3
- data/lib/hanamismith.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +17 -20
- metadata.gz.sig +0 -0
- /data/lib/hanamismith/templates/%project_name%/{public → app/assets/images}/icon.svg.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac116718fe8f0827a091ed6f10024328c6f6a6593b84ba109cc184716b013207
|
4
|
+
data.tar.gz: 4ae3b9a123b1119386e1afa938b3fe47bd91ac271eb128c2ec14cb518a8fe615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abbc3f774efcf10bce992ee77c78c912542b14ce4f467323391e4ecd717ce96e64956d0cf3f09a326a58fb6058288239a2853e2fb23091dc6b111041d471c48d
|
7
|
+
data.tar.gz: 97000aca93757adb0fba3435fcf8beeacd747d273af59f5105c9db1f7e58ddf5705427c881c113549dc0a1855397d209f5d460edd275a8dcfd9e55e4b7112a9f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -33,7 +33,7 @@ toc::[]
|
|
33
33
|
* Uses {hanami_link} for web application development.
|
34
34
|
* Uses {htmx_link} for Hypermedia REST APIs (i.e. HTML over the wire) so you can write less code and avoid bloated JavaScript stacks.
|
35
35
|
* Uses {pg_link} coupled with {rom_link} for database management.
|
36
|
-
* Uses {rack_link}, specifically: `Rack::Deflater
|
36
|
+
* Uses {rack_link}, specifically: `Rack::Deflater` and link:https://github.com/rack/rack-attack[Rack::Attack].
|
37
37
|
* Uses {puma_link} as the default web server and fully configured for local and production environments.
|
38
38
|
* Uses {capybara_link} with {cuprite_link} (driver) for full, headless, feature testing.
|
39
39
|
* Uses {dotenv_link} for managing your environment configurations.
|
@@ -43,7 +43,7 @@ toc::[]
|
|
43
43
|
|
44
44
|
== Screenshots/Screencasts
|
45
45
|
|
46
|
-
image:https://alchemists.io/images/projects/hanamismith/screenshots/home.png[Home,width=
|
46
|
+
image:https://alchemists.io/images/projects/hanamismith/screenshots/home.png[Home,width=695,height=706,role=focal_point]
|
47
47
|
|
48
48
|
The above is a screenshot of a _Demo_ project that was generated and run locally. For a fully working demonstration application -- as built by this gem -- check out the link:https://github.com/bkuhlmann/hemo[Hemo] project. Here's a quick screencast overview of this demonstration application in action:
|
49
49
|
|
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.
|
5
|
+
spec.version = "0.23.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/hanamismith"
|
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_dependency "dry-monads", "~> 1.6"
|
29
29
|
spec.add_dependency "dry-schema", "~> 1.13"
|
30
30
|
spec.add_dependency "etcher", "~> 0.2"
|
31
|
-
spec.add_dependency "hanami", "~> 2.0"
|
32
31
|
spec.add_dependency "htmx", "~> 0.3"
|
33
32
|
spec.add_dependency "infusible", "~> 2.2"
|
34
33
|
spec.add_dependency "refinements", "~> 11.0"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
# Builds project skeleton for assets.
|
8
|
+
class Asset
|
9
|
+
using Refinements::Structs
|
10
|
+
|
11
|
+
def self.call(...) = new(...).call
|
12
|
+
|
13
|
+
def initialize configuration, builder: Rubysmith::Builder
|
14
|
+
@configuration = configuration
|
15
|
+
@builder = builder
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
path = "%project_name%/config/assets.js.erb"
|
20
|
+
builder.call(configuration.merge(template_path: path)).render
|
21
|
+
configuration
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -5,6 +5,7 @@ require "refinements/structs"
|
|
5
5
|
module Hanamismith
|
6
6
|
module Builders
|
7
7
|
# Builds project skeleton with Gemfile configuration.
|
8
|
+
# rubocop:todo Metrics/ClassLength
|
8
9
|
class Bundler < Rubysmith::Builders::Bundler
|
9
10
|
using Refinements::Structs
|
10
11
|
|
@@ -32,6 +33,10 @@ module Hanamismith
|
|
32
33
|
"source",
|
33
34
|
%(gem "hanami", github: "hanami/hanami", branch: "main"\n)
|
34
35
|
)
|
36
|
+
.insert_after(
|
37
|
+
"source",
|
38
|
+
%(gem "hanami-assets", github: "hanami/assets", branch: "main"\n)
|
39
|
+
)
|
35
40
|
.insert_after(
|
36
41
|
"source",
|
37
42
|
%(gem "hanami-cli", github: "hanami/cli", branch: "main"\n)
|
@@ -69,8 +74,13 @@ module Hanamismith
|
|
69
74
|
.insert_after("source", %(\ngem "sequel", "~> 5.68"\n))
|
70
75
|
end
|
71
76
|
|
77
|
+
# rubocop:todo Metrics/MethodLength
|
72
78
|
def alter_groups
|
73
79
|
with_template.insert_after(/group :code_quality/, %( gem "rubocop-sequel", "~> 0.3"\n))
|
80
|
+
.insert_after(
|
81
|
+
/group :development do/,
|
82
|
+
%( gem "hanami-webconsole", github: "hanami/webconsole", branch: "main"\n)
|
83
|
+
)
|
74
84
|
.insert_after(/group :development do/, %( gem "localhost", "~> 1.1"\n))
|
75
85
|
.insert_after(/group :development do/, %( gem "rerun", "~> 0.14"\n))
|
76
86
|
.insert_after(/group :test/, %( gem "capybara", "~> 3.39"\n))
|
@@ -80,12 +90,14 @@ module Hanamismith
|
|
80
90
|
.insert_after(/group :test/, %( gem "rack-test", "~> 2.1"\n))
|
81
91
|
.insert_after(/group :test/, %( gem "rom-factory", "~> 0.11"\n))
|
82
92
|
end
|
93
|
+
# rubocop:enable Metrics/MethodLength
|
83
94
|
|
84
95
|
def append_development_group
|
85
96
|
return if configuration.markdown? || configuration.build_rake || configuration.build_yard
|
86
97
|
|
87
98
|
with_template.append <<~CONTENT
|
88
99
|
group :development do
|
100
|
+
gem "hanami-webconsole", github: "hanami/webconsole", branch: "main"
|
89
101
|
gem "localhost", "~> 1.1"
|
90
102
|
gem "rerun", "~> 0.14"
|
91
103
|
end
|
@@ -128,4 +140,5 @@ module Hanamismith
|
|
128
140
|
end
|
129
141
|
end
|
130
142
|
end
|
143
|
+
# rubocop:enable Metrics/ClassLength
|
131
144
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
module Git
|
8
|
+
# Builds project skeleton Git ignore.
|
9
|
+
class Ignore < Rubysmith::Builders::Git::Ignore
|
10
|
+
using Refinements::Structs
|
11
|
+
|
12
|
+
def call
|
13
|
+
return configuration unless configuration.build_git
|
14
|
+
|
15
|
+
super
|
16
|
+
builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
|
17
|
+
.insert_before("tmp\n", "node_modules\n")
|
18
|
+
.insert_before("tmp\n", "public\n")
|
19
|
+
|
20
|
+
configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :configuration, :builder
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
# Builds project skeleton javascript.
|
8
|
+
class Javascript
|
9
|
+
using Refinements::Structs
|
10
|
+
|
11
|
+
def self.call(...) = new(...).call
|
12
|
+
|
13
|
+
def initialize configuration, builder: Rubysmith::Builder
|
14
|
+
@configuration = configuration
|
15
|
+
@builder = builder
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
path = "%project_name%/slices/home/assets/js/app.js.erb"
|
20
|
+
builder.call(configuration.merge(template_path: path)).render
|
21
|
+
configuration
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -4,8 +4,8 @@ require "refinements/structs"
|
|
4
4
|
|
5
5
|
module Hanamismith
|
6
6
|
module Builders
|
7
|
-
# Builds project skeleton
|
8
|
-
class
|
7
|
+
# Builds project skeleton for Node.
|
8
|
+
class Node
|
9
9
|
using Refinements::Structs
|
10
10
|
|
11
11
|
def self.call(...) = new(...).call
|
@@ -16,7 +16,8 @@ module Hanamismith
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
|
19
|
+
path = "%project_name%/package.json.erb"
|
20
|
+
builder.call(configuration.merge(template_path: path)).render
|
20
21
|
configuration
|
21
22
|
end
|
22
23
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
module Rack
|
8
|
+
# Builds project skeleton.
|
9
|
+
class Attack
|
10
|
+
using Refinements::Structs
|
11
|
+
|
12
|
+
def self.call(...) = new(...).call
|
13
|
+
|
14
|
+
def initialize configuration, builder: Rubysmith::Builder
|
15
|
+
@configuration = configuration
|
16
|
+
@builder = builder
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
add_configuration
|
21
|
+
add_middleware
|
22
|
+
configuration
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :configuration, :builder
|
28
|
+
|
29
|
+
def add_configuration
|
30
|
+
template_path = "%project_name%/config/initializers/rack_attack.rb.erb"
|
31
|
+
builder.call(configuration.merge(template_path:)).render
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_middleware
|
35
|
+
builder.call(configuration.merge(template_path: "%project_name%/config/app.rb.erb"))
|
36
|
+
.insert_after(/require/, %(\nrequire_relative "initializers/rack_attack"\n))
|
37
|
+
.insert_before(/environment/, " config.middleware.use Rack::Attack\n\n")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
module Rack
|
8
|
+
# Builds project skeleton.
|
9
|
+
class Configuration
|
10
|
+
using Refinements::Structs
|
11
|
+
|
12
|
+
def self.call(...) = new(...).call
|
13
|
+
|
14
|
+
def initialize configuration, builder: Rubysmith::Builder
|
15
|
+
@configuration = configuration
|
16
|
+
@builder = builder
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
builder.call(configuration.merge(template_path: "%project_name%/config.ru.erb")).render
|
21
|
+
configuration
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Hanamismith
|
6
|
+
module Builders
|
7
|
+
module Rack
|
8
|
+
# Builds project skeleton.
|
9
|
+
class Deflater
|
10
|
+
using Refinements::Structs
|
11
|
+
|
12
|
+
def self.call(...) = new(...).call
|
13
|
+
|
14
|
+
def initialize configuration, builder: Rubysmith::Builder
|
15
|
+
@configuration = configuration
|
16
|
+
@builder = builder
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
builder.call(configuration.merge(template_path: "%project_name%/config/app.rb.erb"))
|
21
|
+
.insert_after(/Rack::Attack/, " config.middleware.use Rack::Deflater\n")
|
22
|
+
|
23
|
+
configuration
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :configuration, :builder
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -45,9 +45,26 @@ module Hanamismith
|
|
45
45
|
builder.call(configuration.merge(template_path: path))
|
46
46
|
.render
|
47
47
|
.replace("<!-- title -->", "<%= content_for :title %>")
|
48
|
+
.replace("<!-- favicon -->", favicon)
|
49
|
+
.replace("<!-- manifest -->", manifest)
|
50
|
+
.replace("<!-- stylesheet -->", stylesheet)
|
48
51
|
.replace("<!-- yield -->", "<%= yield %>")
|
49
52
|
end
|
50
53
|
|
54
|
+
def favicon
|
55
|
+
%(<%= favicon_tag "icon.svg", title: "#{configuration.project_label}: Icon", rel: ) +
|
56
|
+
%(:icon, type: "image/svg+xml" %>)
|
57
|
+
end
|
58
|
+
|
59
|
+
def manifest
|
60
|
+
%(<%= tag.link title: "#{configuration.project_label}: Manifest", rel: ) +
|
61
|
+
%(:manifest, href: asset_url("manifest.webmanifest") %>)
|
62
|
+
end
|
63
|
+
|
64
|
+
def stylesheet
|
65
|
+
%(<%= stylesheet_tag "home/app", title: "#{configuration.project_label}: Stylesheet" %>)
|
66
|
+
end
|
67
|
+
|
51
68
|
def add_show_template
|
52
69
|
path = "%project_name%/slices/home/templates/show.html.erb.erb"
|
53
70
|
|
@@ -9,7 +9,7 @@ module Hanamismith
|
|
9
9
|
class Build < Sod::Command
|
10
10
|
include Hanamismith::Import[:input, :logger]
|
11
11
|
|
12
|
-
# Order
|
12
|
+
# Order matters.
|
13
13
|
BUILDERS = [
|
14
14
|
Rubysmith::Builders::Init,
|
15
15
|
Builders::Core,
|
@@ -17,6 +17,7 @@ module Hanamismith
|
|
17
17
|
Builders::Refinement,
|
18
18
|
Builders::Icon,
|
19
19
|
Builders::Stylesheet,
|
20
|
+
Builders::Javascript,
|
20
21
|
Builders::PWA,
|
21
22
|
Builders::Slices::Home,
|
22
23
|
Builders::Slices::Health,
|
@@ -26,9 +27,11 @@ module Hanamismith
|
|
26
27
|
Rubysmith::Builders::Documentation::License,
|
27
28
|
Rubysmith::Builders::Documentation::Version,
|
28
29
|
Rubysmith::Builders::Git::Setup,
|
29
|
-
|
30
|
+
Builders::Git::Ignore,
|
30
31
|
Rubysmith::Builders::Git::Safe,
|
31
32
|
Builders::Bundler,
|
33
|
+
Builders::Node,
|
34
|
+
Builders::Asset,
|
32
35
|
Builders::Rake,
|
33
36
|
Builders::Binstub,
|
34
37
|
Builders::Console,
|
@@ -45,7 +48,9 @@ module Hanamismith
|
|
45
48
|
Builders::RSpec::Factory,
|
46
49
|
Builders::RSpec::Helper,
|
47
50
|
Builders::RSpec::Hanami,
|
48
|
-
Builders::Rack,
|
51
|
+
Builders::Rack::Configuration,
|
52
|
+
Builders::Rack::Attack,
|
53
|
+
Builders::Rack::Deflater,
|
49
54
|
Builders::Puma::Configuration,
|
50
55
|
Builders::Puma::Procfile,
|
51
56
|
Builders::Caliber,
|
@@ -53,6 +58,7 @@ module Hanamismith
|
|
53
58
|
Rubysmith::Extensions::Pragmater,
|
54
59
|
Rubysmith::Extensions::Tocer,
|
55
60
|
Rubysmith::Extensions::Rubocop,
|
61
|
+
Extensions::NPM,
|
56
62
|
Builders::Environments::Development,
|
57
63
|
Builders::Environments::Test,
|
58
64
|
Builders::Git::Commit
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/ios"
|
4
|
+
require "refinements/pathnames"
|
5
|
+
require "rubocop"
|
6
|
+
|
7
|
+
module Hanamismith
|
8
|
+
module Extensions
|
9
|
+
# Ensures NPM packages are installed if NPM is available.
|
10
|
+
class NPM
|
11
|
+
include Import[:kernel, :logger]
|
12
|
+
|
13
|
+
using Refinements::IOs
|
14
|
+
using Refinements::Pathnames
|
15
|
+
|
16
|
+
def self.call(...) = new(...).call
|
17
|
+
|
18
|
+
def initialize(configuration, **)
|
19
|
+
super(**)
|
20
|
+
@configuration = configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
def call
|
24
|
+
logger.error { "Unable to detect NPM. Install NPM and run: `npm install`." } unless run
|
25
|
+
configuration
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
attr_reader :configuration
|
31
|
+
|
32
|
+
def run
|
33
|
+
success = false
|
34
|
+
|
35
|
+
configuration.project_root.change_dir do
|
36
|
+
STDOUT.squelch { success = kernel.system "command -v npm && npm install" }
|
37
|
+
end
|
38
|
+
|
39
|
+
success
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1 +1,2 @@
|
|
1
|
-
web: rerun --dir app,config,lib,
|
1
|
+
web: rerun --dir app,config,lib,slices --pattern="**/*.{erb,rb}" -- bundle exec puma --config ./config/puma.rb
|
2
|
+
assets: bundle exec hanami assets watch
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "hanami"
|
2
|
-
require "rack/attack"
|
3
2
|
|
4
3
|
<% namespace do %>
|
5
4
|
# Defines global application configuration.
|
@@ -12,14 +11,6 @@ require "rack/attack"
|
|
12
11
|
csp[:script_src] += " 'unsafe-eval' 'unsafe-inline' https://unpkg.com/"
|
13
12
|
end
|
14
13
|
|
15
|
-
Rack::Attack.safelist("allow localhost") { |request| %w[127.0.0.1 ::1].include? request.ip }
|
16
|
-
Rack::Attack.throttle("requests by IP", limit: 100, period: 60, &:ip)
|
17
|
-
|
18
|
-
config.middleware.use Rack::Attack
|
19
|
-
config.middleware.use Rack::Deflater
|
20
|
-
config.middleware.use Rack::Static,
|
21
|
-
{root: "public", urls: %w[/icon.svg /manifest.webmanifest /stylesheets]}
|
22
|
-
|
23
14
|
environment :development do
|
24
15
|
# :nocov:
|
25
16
|
config.logger.options[:colorize] = true
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "ipaddr"
|
2
|
+
require "rack/attack"
|
3
|
+
|
4
|
+
private_subnets = [
|
5
|
+
IPAddr.new("10.0.0.0/8"),
|
6
|
+
IPAddr.new("172.16.0.0/12"),
|
7
|
+
IPAddr.new("192.168.0.0/16"),
|
8
|
+
IPAddr.new("127.0.0.1"),
|
9
|
+
IPAddr.new("::1")
|
10
|
+
]
|
11
|
+
|
12
|
+
Rack::Attack.safelist "allow private network" do |request|
|
13
|
+
private_subnets.any? { |subnet| subnet.include? request.ip }
|
14
|
+
end
|
15
|
+
|
16
|
+
Rack::Attack.throttle("requests by IP", limit: 100, period: 60, &:ip)
|
@@ -6,17 +6,17 @@ require "localhost" if development
|
|
6
6
|
Bundler.require :tools if development
|
7
7
|
Bundler.root.join("tmp").then { |path| path.mkdir unless path.exist? }
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
max_threads = ENV.fetch "HANAMI_MAX_THREADS", 5
|
10
|
+
min_threads = ENV.fetch "HANAMI_MIN_THREADS", max_threads
|
11
|
+
concurrency = ENV.fetch "HANAMI_WEB_CONCURRENCY", Concurrent.physical_processor_count
|
12
12
|
|
13
|
+
threads min_threads, max_threads
|
13
14
|
port ENV.fetch "HANAMI_PORT", 2300
|
14
15
|
environment ENV.fetch "HANAMI_ENV", "development"
|
15
|
-
workers
|
16
|
+
workers concurrency
|
16
17
|
worker_timeout 3600 if development
|
17
|
-
ssl_bind "localhost",
|
18
|
+
ssl_bind "localhost", 2443 if development
|
18
19
|
pidfile ENV.fetch "PIDFILE", "tmp/server.pid"
|
19
|
-
on_worker_boot { Hanami.shutdown }
|
20
20
|
plugin :tmp_restart
|
21
21
|
|
22
|
-
preload_app!
|
22
|
+
preload_app! && before_fork { Hanami.shutdown } if concurrency.to_i.positive?
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "<%= configuration.project_name %>",
|
3
|
+
"description": "",
|
4
|
+
"version": "<%= configuration.project_version %>",
|
5
|
+
"author": "<%= configuration.author_name %>",
|
6
|
+
"license": "<%= configuration.license_label_version %>",
|
7
|
+
"private": true,
|
8
|
+
"type": "module",
|
9
|
+
"keywords": ["ruby", "hanami"],
|
10
|
+
"scripts": {
|
11
|
+
"assets": "node config/assets.js"
|
12
|
+
},
|
13
|
+
"dependencies": {
|
14
|
+
"hanami-assets": "^2.1.0-rc.2"
|
15
|
+
}
|
16
|
+
}
|
@@ -10,27 +10,30 @@ html {
|
|
10
10
|
--font-family: Verdana;
|
11
11
|
|
12
12
|
background-color: var(--color-white);
|
13
|
-
background-image:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
background-image: linear-gradient(
|
14
|
+
0deg,
|
15
|
+
hsl(351deg 100% 95%) 0%,
|
16
|
+
hsl(352deg 100% 96%) 16%,
|
17
|
+
hsl(352deg 100% 98%) 24%,
|
18
|
+
hsl(352deg 100% 99%) 30%,
|
19
|
+
hsl(300deg 100% 100%) 35%,
|
20
|
+
hsl(300deg 100% 100%) 40%,
|
21
|
+
hsl(300deg 100% 100%) 45%,
|
22
|
+
hsl(0deg 0% 100%) 50%,
|
23
|
+
hsl(300deg 100% 100%) 55%,
|
24
|
+
hsl(300deg 100% 100%) 60%,
|
25
|
+
hsl(300deg 100% 100%) 65%,
|
26
|
+
hsl(300deg 100% 100%) 70%,
|
27
|
+
hsl(300deg 100% 100%) 76%,
|
28
|
+
hsl(300deg 100% 100%) 84%,
|
29
|
+
hsl(0deg 0% 100%) 100%
|
30
|
+
);
|
24
31
|
display: flex;
|
25
32
|
flex-direction: column;
|
26
33
|
font-family: var(--font-family);
|
27
34
|
justify-content: space-between;
|
28
35
|
min-height: 97vh;
|
29
36
|
|
30
|
-
.link {
|
31
|
-
color: var(--color-white);
|
32
|
-
}
|
33
|
-
|
34
37
|
.navigation {
|
35
38
|
align-items: center;
|
36
39
|
display: flex;
|
@@ -0,0 +1 @@
|
|
1
|
+
import "../css/app.css";
|
data/lib/hanamismith/templates/%project_name%/slices/home/templates/layouts/app.html.erb.erb
CHANGED
@@ -16,13 +16,13 @@
|
|
16
16
|
rel="icon"
|
17
17
|
href="https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
|
18
18
|
sizes="32x32">
|
19
|
-
|
19
|
+
<!-- favicon -->
|
20
20
|
<link title="<%= configuration.project_label %>: Apple Icon"
|
21
21
|
rel="apple-touch-icon"
|
22
22
|
href="https://alchemists.io/images/projects/hanamismith/icons/apple.png"
|
23
23
|
type="image/png">
|
24
|
-
|
25
|
-
|
24
|
+
<!-- manifest -->
|
25
|
+
<!-- stylesheet -->
|
26
26
|
</head>
|
27
27
|
|
28
28
|
<body class="home-page">
|
data/lib/hanamismith.rb
CHANGED
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.
|
4
|
+
version: 0.23.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: 2023-
|
38
|
+
date: 2023-12-02 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: cogger
|
@@ -107,20 +107,6 @@ dependencies:
|
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0.2'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: hanami
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - "~>"
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '2.0'
|
117
|
-
type: :runtime
|
118
|
-
prerelease: false
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '2.0'
|
124
110
|
- !ruby/object:Gem::Dependency
|
125
111
|
name: htmx
|
126
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +234,7 @@ files:
|
|
248
234
|
- exe/hanamismith
|
249
235
|
- hanamismith.gemspec
|
250
236
|
- lib/hanamismith.rb
|
237
|
+
- lib/hanamismith/builders/asset.rb
|
251
238
|
- lib/hanamismith/builders/binstub.rb
|
252
239
|
- lib/hanamismith/builders/bundler.rb
|
253
240
|
- lib/hanamismith/builders/caliber.rb
|
@@ -259,13 +246,18 @@ files:
|
|
259
246
|
- lib/hanamismith/builders/environments/development.rb
|
260
247
|
- lib/hanamismith/builders/environments/test.rb
|
261
248
|
- lib/hanamismith/builders/git/commit.rb
|
249
|
+
- lib/hanamismith/builders/git/ignore.rb
|
262
250
|
- lib/hanamismith/builders/guard.rb
|
263
251
|
- lib/hanamismith/builders/icon.rb
|
252
|
+
- lib/hanamismith/builders/javascript.rb
|
253
|
+
- lib/hanamismith/builders/node.rb
|
264
254
|
- lib/hanamismith/builders/providers/persistence.rb
|
265
255
|
- lib/hanamismith/builders/puma/configuration.rb
|
266
256
|
- lib/hanamismith/builders/puma/procfile.rb
|
267
257
|
- lib/hanamismith/builders/pwa.rb
|
268
|
-
- lib/hanamismith/builders/rack.rb
|
258
|
+
- lib/hanamismith/builders/rack/attack.rb
|
259
|
+
- lib/hanamismith/builders/rack/configuration.rb
|
260
|
+
- lib/hanamismith/builders/rack/deflater.rb
|
269
261
|
- lib/hanamismith/builders/rake.rb
|
270
262
|
- lib/hanamismith/builders/refinement.rb
|
271
263
|
- lib/hanamismith/builders/rspec/application_shared_context.rb
|
@@ -280,6 +272,7 @@ files:
|
|
280
272
|
- lib/hanamismith/cli/commands/build.rb
|
281
273
|
- lib/hanamismith/cli/shell.rb
|
282
274
|
- lib/hanamismith/container.rb
|
275
|
+
- lib/hanamismith/extensions/npm.rb
|
283
276
|
- lib/hanamismith/import.rb
|
284
277
|
- lib/hanamismith/templates/%project_name%/.circleci/config.yml.erb
|
285
278
|
- lib/hanamismith/templates/%project_name%/.github/workflows/ci.yml.erb
|
@@ -287,11 +280,15 @@ files:
|
|
287
280
|
- lib/hanamismith/templates/%project_name%/Procfile.dev.erb
|
288
281
|
- lib/hanamismith/templates/%project_name%/Procfile.erb
|
289
282
|
- lib/hanamismith/templates/%project_name%/app/action.rb.erb
|
283
|
+
- lib/hanamismith/templates/%project_name%/app/assets/images/icon.svg.erb
|
284
|
+
- lib/hanamismith/templates/%project_name%/app/assets/pwa/manifest.webmanifest.erb
|
290
285
|
- lib/hanamismith/templates/%project_name%/app/repository.rb.erb
|
291
286
|
- lib/hanamismith/templates/%project_name%/app/view.rb.erb
|
292
287
|
- lib/hanamismith/templates/%project_name%/bin/hanami.erb
|
293
288
|
- lib/hanamismith/templates/%project_name%/config.ru.erb
|
294
289
|
- lib/hanamismith/templates/%project_name%/config/app.rb.erb
|
290
|
+
- lib/hanamismith/templates/%project_name%/config/assets.js.erb
|
291
|
+
- lib/hanamismith/templates/%project_name%/config/initializers/rack_attack.rb.erb
|
295
292
|
- lib/hanamismith/templates/%project_name%/config/providers/persistence.rb.erb
|
296
293
|
- lib/hanamismith/templates/%project_name%/config/puma.rb.erb
|
297
294
|
- lib/hanamismith/templates/%project_name%/config/routes.rb.erb
|
@@ -300,12 +297,12 @@ files:
|
|
300
297
|
- lib/hanamismith/templates/%project_name%/env.test.erb
|
301
298
|
- lib/hanamismith/templates/%project_name%/lib/%project_path%/refines/actions/response.rb.erb
|
302
299
|
- lib/hanamismith/templates/%project_name%/lib/%project_path%/types.rb.erb
|
303
|
-
- lib/hanamismith/templates/%project_name%/
|
304
|
-
- lib/hanamismith/templates/%project_name%/public/manifest.webmanifest.erb
|
305
|
-
- lib/hanamismith/templates/%project_name%/public/stylesheets/home.css.erb
|
300
|
+
- lib/hanamismith/templates/%project_name%/package.json.erb
|
306
301
|
- lib/hanamismith/templates/%project_name%/slices/health/actions/show.rb.erb
|
307
302
|
- lib/hanamismith/templates/%project_name%/slices/home/action.rb.erb
|
308
303
|
- lib/hanamismith/templates/%project_name%/slices/home/actions/show.rb.erb
|
304
|
+
- lib/hanamismith/templates/%project_name%/slices/home/assets/css/app.css.erb
|
305
|
+
- lib/hanamismith/templates/%project_name%/slices/home/assets/js/app.js.erb
|
309
306
|
- lib/hanamismith/templates/%project_name%/slices/home/repository.rb.erb
|
310
307
|
- lib/hanamismith/templates/%project_name%/slices/home/templates/layouts/app.html.erb.erb
|
311
308
|
- lib/hanamismith/templates/%project_name%/slices/home/templates/show.html.erb.erb
|
metadata.gz.sig
CHANGED
Binary file
|
File without changes
|