hanamismith 0.4.0 → 0.6.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: acfcec1bca4aa46dcdf1938f6fe7de5df8dcb369e1cdccf70c1c50a0b091376e
4
- data.tar.gz: fb359b86de74b3bcfdf8a2b5da38fb1008938cd681f7afd6e8cf734dbe8436ae
3
+ metadata.gz: ccc945b74eb6e9d07c16a9cbaf15bd90f00e23ee2a4a4f4da0d42186d7b48f65
4
+ data.tar.gz: 1a14e5d6244c87171a8857d63605d1b8d21c8ab1a7fd8a70a649dcd56fe1ad18
5
5
  SHA512:
6
- metadata.gz: ea87d728df34d6ace0cb8110350f6828c859ed4d75f0a439d208fe1ffb883fd7798a57a5830977c99dcac3301ffb41beb48a4ec4271ea3595597bb89260c5669
7
- data.tar.gz: 4bf40a3ed2f9b000ea5d34fc6614a063d89cad15f98e2b283f75d11ead82b2f875b51e608723aeae148ea08ff1d345b41149e9977c4e90906dc6c281e96f6682
6
+ metadata.gz: be31386a7711bef55f38b756c66186f1e337648f675208e07713311f523abb367ee1a0075eba5245e807e6b8e6d63d5e6c34d4ac457c2467ac1864dfc45a6373
7
+ data.tar.gz: 8376b37b8645b49eeb764aa820298c1041645aa174fa7a16e34ff76f82d79bcc788aaa52e905e368952f03c2753d9507ef9852d71cf2d410e03736f4a85e538c
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -6,14 +6,14 @@
6
6
  :cuprite_link: link:https://cuprite.rubycdp.com[Cuprite]
7
7
  :dry_link: link:https://dry-rb.org[Dry RB]
8
8
  :dotenv_link: link:https://github.com/bkeepers/dotenv[Dotenv]
9
- :dotfiles_link: link:https://www.alchemists.io/projects/dotfiles[Dotfiles]
9
+ :dotfiles_link: link:https://alchemists.io/projects/dotfiles[Dotfiles]
10
10
  :hanami_link: link:https://hanamirb.org[Hanami]
11
11
  :htmx_link: link:https://htmx.org[HTMX]
12
12
  :pg_link: link:https://github.com/ged/ruby-pg[pg]
13
13
  :puma_link: link:https://puma.io[Puma]
14
14
  :rack_link: link:https://github.com/rack/rack[Rack]
15
15
  :rom_link: link:https://rom-rb.org[ROM]
16
- :rubysmith_link: link:https://www.alchemists.io/projects/rubysmith[Rubysmith]
16
+ :rubysmith_link: link:https://alchemists.io/projects/rubysmith[Rubysmith]
17
17
 
18
18
  = Hanamismith
19
19
 
@@ -30,8 +30,8 @@ toc::[]
30
30
 
31
31
  == Features
32
32
 
33
- * Built atop {rubysmith_link} and leverages all features.
34
- * Uses {dry_link} functional programming.
33
+ * Built atop {rubysmith_link} for building project skeleton.
34
+ * Uses {dry_link} for functional programming.
35
35
  * Uses {hanami_link} for web application development.
36
36
  * Uses {htmx_link} for proper REST (hypermedia) architectures (i.e. HTML over the wire) so you can write less code and avoid bloated JavaScript stacks.
37
37
  * Uses {pg_link} coupled with {rom_link} for database management.
@@ -40,6 +40,8 @@ toc::[]
40
40
  * Uses {capybara_link} with {cuprite_link} (driver) for full, headless, feature testing.
41
41
  * Uses {dotenv_link} for managing your environment configurations.
42
42
  * Provides support for Continuous Integration systems like link:https://circleci.com[Circle CI] (default) and link:https://docs.github.com/en/actions[GitHub Actions].
43
+ * Provides the `/up` health check endpoint via the `Health` slice.
44
+ * 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.
43
45
 
44
46
  == Requirements
45
47
 
@@ -99,7 +101,7 @@ BUILD OPTIONS:
99
101
  --[no-]zeitwerk Add Zeitwerk gem. Default: true.
100
102
  ....
101
103
 
102
- The core functionality of this gem centers around the `--build` command and associated flags. The build options allow you to further customize the kind of gem you want to build. Most build options are enabled by default. For detailed documentation on all supported flags, see the link:https://www.alchemists.io/projects/rubysmith/#_build[Rubysmith] documentation.
104
+ The core functionality of this gem centers around the `--build` command and associated flags. The build options allow you to further customize the kind of gem you want to build. Most build options are enabled by default. For detailed documentation on all supported flags, see the link:https://alchemists.io/projects/rubysmith/#_build[Rubysmith] documentation.
103
105
 
104
106
  ℹ️ Use of the `--zeitwerk` or `--no-zeitwerk` flags will have no effect so you can ignore them since {hanami_link} builds in this functionality for you by default. At the moment, this flag is a carry over from the {rubysmith_link} project and will be removed in the future.
105
107
 
@@ -111,11 +113,11 @@ This gem can be configured via a global configuration:
111
113
  $HOME/.config/hanamismith/configuration.yml
112
114
  ....
113
115
 
114
- It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
116
+ It can also be configured via link:https://alchemists.io/projects/xdg[XDG] environment
115
117
  variables.
116
118
 
117
119
  The default configuration is everything provided in the
118
- link:https://www.alchemists.io/projects/rubysmith/#_configuration[Rubysmith].
120
+ link:https://alchemists.io/projects/rubysmith/#_configuration[Rubysmith].
119
121
 
120
122
  Feel free to modify the default and save as your own custom `configuration.yml`. It is recommended that you provide common URLs for your project which would be all keys found in this section:
121
123
 
@@ -164,7 +166,7 @@ bin/hanami --help
164
166
  Once the server is running you can visit (or ping) the following endpoints:
165
167
 
166
168
  * `/`: The default welcome page.
167
- * `/status`: The health status of the application. This will be _green_ (200 OK) when the server is up or _red_ (503 Service Unavailable) when the server is down.
169
+ * `/up`: The health status of the application. This will be _green_ (200 OK) when the server is up or _red_ (503 Service Unavailable) when the server is down.
168
170
 
169
171
  === Aliases
170
172
 
@@ -183,7 +185,7 @@ The above is what I use via my {dotfiles_link} project.
183
185
 
184
186
  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:
185
187
 
186
- video::https://www.alchemists.io/videos/projects/hemo/demo.mp4[poster=https://www.alchemists.io/images/projects/hemo/demo.png,width=800,height=450,role=focal_point]
188
+ video::https://alchemists.io/videos/projects/hemo/demo.mp4[poster=https://alchemists.io/images/projects/hemo/demo.png,width=800,height=450,role=focal_point]
187
189
 
188
190
  In case you are not aware of link:https://hanamimastery.com[Hanami Mastery], now would be a good time to introduce you. link:https://hanamimastery.com/about[Seb Wilgosz] -- the creator of Hanami Mastery -- recently published link:https://hanamimastery.com/episodes/40-hanamismith[Episode 40] (see below) which features this gem. _Please note that multiple advancements have been applied since the original recording of this video_. That said, this'll give you another perspective on usage which you might enjoy:
189
191
 
@@ -216,19 +218,19 @@ To test, run:
216
218
  bin/rake
217
219
  ----
218
220
 
219
- == link:https://www.alchemists.io/policies/license[License]
221
+ == link:https://alchemists.io/policies/license[License]
220
222
 
221
- == link:https://www.alchemists.io/policies/security[Security]
223
+ == link:https://alchemists.io/policies/security[Security]
222
224
 
223
- == link:https://www.alchemists.io/policies/code_of_conduct[Code of Conduct]
225
+ == link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]
224
226
 
225
- == link:https://www.alchemists.io/policies/contributions[Contributions]
227
+ == link:https://alchemists.io/policies/contributions[Contributions]
226
228
 
227
- == link:https://www.alchemists.io/projects/hanamismith/versions[Versions]
229
+ == link:https://alchemists.io/projects/hanamismith/versions[Versions]
228
230
 
229
- == link:https://www.alchemists.io/community[Community]
231
+ == link:https://alchemists.io/community[Community]
230
232
 
231
233
  == Credits
232
234
 
233
- * Built with link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
234
- * Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
235
+ * Built with link:https://alchemists.io/projects/gemsmith[Gemsmith].
236
+ * Engineered by link:https://alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
data/hanamismith.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "hanamismith"
5
- spec.version = "0.4.0"
5
+ spec.version = "0.6.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
- spec.homepage = "https://www.alchemists.io/projects/hanamismith"
8
+ spec.homepage = "https://alchemists.io/projects/hanamismith"
9
9
  spec.summary = "A command line interface for smithing Hanami projects."
10
10
  spec.license = "Hippocratic-2.1"
11
11
 
12
12
  spec.metadata = {
13
13
  "bug_tracker_uri" => "https://github.com/bkuhlmann/hanamismith/issues",
14
- "changelog_uri" => "https://www.alchemists.io/projects/hanamismith/versions",
15
- "documentation_uri" => "https://www.alchemists.io/projects/hanamismith",
14
+ "changelog_uri" => "https://alchemists.io/projects/hanamismith/versions",
15
+ "documentation_uri" => "https://alchemists.io/projects/hanamismith",
16
16
  "funding_uri" => "https://github.com/sponsors/bkuhlmann",
17
17
  "label" => "Hanamismith",
18
18
  "rubygems_mfa_required" => "true",
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "hanami", "~> 2.0"
31
31
  spec.add_dependency "infusible", "~> 1.0"
32
32
  spec.add_dependency "refinements", "~> 10.0"
33
- spec.add_dependency "rubysmith", "~> 4.5"
33
+ spec.add_dependency "rubysmith", "~> 4.6"
34
34
  spec.add_dependency "runcom", "~> 9.0"
35
35
  spec.add_dependency "spek", "~> 1.0"
36
36
  spec.add_dependency "zeitwerk", "~> 2.6"
@@ -14,9 +14,27 @@ module Hanamismith
14
14
  super
15
15
  builder.call(configuration.merge(template_path: "%project_name%/bin/console.erb"))
16
16
  .replace(/require_relative.+/, %(require "hanami/prepare"))
17
+ add_irb_autocomplete
17
18
 
18
19
  configuration
19
20
  end
21
+
22
+ private
23
+
24
+ def add_irb_autocomplete
25
+ with_template.insert_before "IRB.start",
26
+ <<~CODE
27
+ unless Hanami.env? :development, :test
28
+ ENV["IRB_USE_AUTOCOMPLETE"] ||= "false"
29
+ puts "IRB autocomplete disabled."
30
+ end
31
+
32
+ CODE
33
+ end
34
+
35
+ def with_template
36
+ builder.call configuration.merge(template_path: "%project_name%/bin/console.erb")
37
+ end
20
38
  end
21
39
  end
22
40
  end
@@ -8,6 +8,7 @@ module Hanamismith
8
8
  include Hanamismith::Import[:logger]
9
9
 
10
10
  # Order is important.
11
+ # rubocop:todo Metrics/CollectionLiteralLength
11
12
  BUILDERS = [
12
13
  Builders::Core,
13
14
  Builders::Providers::Persistence,
@@ -24,6 +25,7 @@ module Hanamismith
24
25
  Rubysmith::Builders::Documentation::Version,
25
26
  Rubysmith::Builders::Git::Setup,
26
27
  Rubysmith::Builders::Git::Ignore,
28
+ Rubysmith::Builders::Git::Safe,
27
29
  Builders::Bundler,
28
30
  Builders::Rake,
29
31
  Builders::Binstub,
@@ -53,6 +55,7 @@ module Hanamismith
53
55
  Builders::Environments::Test,
54
56
  Builders::Git::Commit
55
57
  ].freeze
58
+ # rubocop:enable Metrics/CollectionLiteralLength
56
59
 
57
60
  def initialize(builders: BUILDERS, **)
58
61
  super(**)
@@ -1 +1 @@
1
- web: bundle exec puma --port $PORT --config ./config/puma.rb
1
+ web: bundle exec puma --config ./config/puma.rb
@@ -1,11 +1,20 @@
1
1
  require "hanami"
2
2
 
3
3
  <% namespace do %>
4
- # Handles HTTP requests.
4
+ # Defines global application configuration.
5
5
  class App < Hanami::App
6
6
  config.actions.content_security_policy[:script_src] = "'self' 'unsafe-eval'"
7
7
 
8
8
  config.middleware.use Rack::Deflater
9
9
  config.middleware.use Rack::Static, {urls: %w[/stylesheets /javascript], root: "public"}
10
+
11
+ environment :development do
12
+ config.logger.options[:colorize] = true
13
+
14
+ config.logger = config.logger.instance.add_backend(
15
+ colorize: false,
16
+ stream: Hanami.app.root.join("log/development.log")
17
+ )
18
+ end
10
19
  end
11
20
  <% end %>
@@ -15,12 +15,20 @@ Hanami.app.register_provider :persistence, namespace: true do
15
15
 
16
16
  configuration.plugin :sql, relations: :auto_restrictions
17
17
 
18
+ database = configuration.gateways[:default].connection
19
+
18
20
  register "config", configuration
19
- register "db", configuration.gateways[:default].connection
21
+ register "db", database
22
+
23
+ Sequel::Migrator.is_current? database, Hanami.app.root.join("db/migrate")
24
+ rescue NoMethodError, Sequel::Migrator::Error => error
25
+ message = error.message
26
+ Hanami.logger.error message unless error.is_a?(NoMethodError) && message.include?("migration")
20
27
  end
21
28
 
22
29
  start do
23
30
  configuration = target["persistence.config"]
31
+
24
32
  configuration.auto_registration(
25
33
  target.root.join("lib/<%= configuration.project_path %>/persistence"),
26
34
  namespace: "<%= configuration.project_namespaced_class %>::Persistence"
@@ -1,7 +1,7 @@
1
1
  <% namespace do %>
2
- # Configures application routes.
2
+ # Defines application routes.
3
3
  class Routes < Hanami::Routes
4
- slice(:health, at: "/status") { root to: "show" }
4
+ slice(:health, at: "/up") { root to: "show" }
5
5
  slice(:main, at: "/") { root to: "home.show" }
6
6
  end
7
7
  <% end %>
@@ -1,6 +1,6 @@
1
1
  <% namespace do %>
2
- # Configures application settings.
2
+ # Defines application settings.
3
3
  class Settings < Hanami::Settings
4
- setting :database_url
4
+ setting :database_url, constructor: Types::Params::String
5
5
  end
6
6
  <% 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.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
29
29
  RFE=
30
30
  -----END CERTIFICATE-----
31
- date: 2023-02-05 00:00:00.000000000 Z
31
+ date: 2023-03-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: cogger
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '4.5'
137
+ version: '4.6'
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '4.5'
144
+ version: '4.6'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: runcom
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -275,13 +275,13 @@ files:
275
275
  - lib/hanamismith/templates/%project_name%/spec/support/database.rb.erb
276
276
  - lib/hanamismith/templates/%project_name%/spec/support/factory.rb.erb
277
277
  - lib/hanamismith/templates/%project_name%/spec/support/shared_contexts/application.rb.erb
278
- homepage: https://www.alchemists.io/projects/hanamismith
278
+ homepage: https://alchemists.io/projects/hanamismith
279
279
  licenses:
280
280
  - Hippocratic-2.1
281
281
  metadata:
282
282
  bug_tracker_uri: https://github.com/bkuhlmann/hanamismith/issues
283
- changelog_uri: https://www.alchemists.io/projects/hanamismith/versions
284
- documentation_uri: https://www.alchemists.io/projects/hanamismith
283
+ changelog_uri: https://alchemists.io/projects/hanamismith/versions
284
+ documentation_uri: https://alchemists.io/projects/hanamismith
285
285
  funding_uri: https://github.com/sponsors/bkuhlmann
286
286
  label: Hanamismith
287
287
  rubygems_mfa_required: 'true'
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  - !ruby/object:Gem::Version
302
302
  version: '0'
303
303
  requirements: []
304
- rubygems_version: 3.4.6
304
+ rubygems_version: 3.4.7
305
305
  signing_key:
306
306
  specification_version: 4
307
307
  summary: A command line interface for smithing Hanami projects.
metadata.gz.sig CHANGED
Binary file