hanamismith 0.5.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: cb4751527ea999f3256458b6597d01c43d0244267dc857cf31fcce2ffb70e158
4
- data.tar.gz: 39a561ae20f394be55815bb28b4830db199a5ce15254115c97ea4604a853c840
3
+ metadata.gz: ccc945b74eb6e9d07c16a9cbaf15bd90f00e23ee2a4a4f4da0d42186d7b48f65
4
+ data.tar.gz: 1a14e5d6244c87171a8857d63605d1b8d21c8ab1a7fd8a70a649dcd56fe1ad18
5
5
  SHA512:
6
- metadata.gz: 8eb9623af682563f1aabbe25965a1f5578d16bb1d15049e995b83e4a75f361c4bc9aa11310e7b156be0d7576af57fe06be2634dec02c461679c47204ae68f144
7
- data.tar.gz: 9039ddf30e1c0bd6531ba26b27546a6ec2355d56dcc24accf0693fe16d70a844d6a0ad9e31c663b1171febc06546bba65a2d5a11f7d28cf47b9fd24fe8037550
6
+ metadata.gz: be31386a7711bef55f38b756c66186f1e337648f675208e07713311f523abb367ee1a0075eba5245e807e6b8e6d63d5e6c34d4ac457c2467ac1864dfc45a6373
7
+ data.tar.gz: 8376b37b8645b49eeb764aa820298c1041645aa174fa7a16e34ff76f82d79bcc788aaa52e905e368952f03c2753d9507ef9852d71cf2d410e03736f4a85e538c
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -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
 
@@ -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
 
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.0"
5
+ spec.version = "0.6.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/hanamismith"
@@ -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,5 +1,5 @@
1
1
  <% namespace do %>
2
- # Configures application settings.
2
+ # Defines application settings.
3
3
  class Settings < Hanami::Settings
4
4
  setting :database_url, constructor: Types::Params::String
5
5
  end
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
-
2
- P"T"Fw%{F��t4t2!NJ��sJ9_Q���mɎg&���>w�Y�\������:Ypu��,T�|�g+�%^�ti��[?����>&%v��K��W{�x�C�f̧bj�~�B��!�&������u@�s]�H�1��şk'�c��?߽y�A���$A�����U�h�C,�� d� H��^8(��z�t��C�a<I Y�+z�=�͛.3X.�
1
+ �Z����ɜ���C3hZ������]�u�d�uv�����*���8D�uǢ����G��x��B������Tc<k)�R��J�Ğld�D�kʿi�*o�lk�?Mz��������Hv���S��/�O��z�'�KF�B�R�}�T&0��F��D�)ƓBa���;���ݯ�U�]d$�Іh�Q�`��~:Y�H�����k#�۲9m鮫��;��ϱ�ZB�J��#k�-�J�Y�>�|��Jw
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.5.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-19 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
metadata.gz.sig CHANGED
Binary file