hanamismith 1.12.0 → 1.13.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/hanamismith.gemspec +1 -1
- data/lib/hanamismith/builders/bundler.rb +8 -8
- data/lib/hanamismith/builders/caliber.rb +6 -1
- data/lib/hanamismith/builders/core.rb +5 -1
- data/lib/hanamismith/builders/git/ignore.rb +11 -4
- data/lib/hanamismith/builders/providers/logger.rb +48 -0
- data/lib/hanamismith/builders/rake/configuration.rb +1 -0
- data/lib/hanamismith/builders/reek.rb +38 -0
- data/lib/hanamismith/builders/rspec/application_shared_context.rb +1 -1
- data/lib/hanamismith/cli/commands/build.rb +2 -1
- data/lib/hanamismith/templates/%project_name%/app/aspects/logging/rack_adapter.rb.erb +21 -0
- data/lib/hanamismith/templates/%project_name%/app/providers/logger.rb.erb +43 -0
- data/lib/hanamismith/templates/%project_name%/config/initializers/rack_logger_patch.rb.erb +21 -0
- data/lib/hanamismith/templates/%project_name%/config/initializers/sql_logger_patch.rb.erb +13 -0
- data/lib/hanamismith/templates/%project_name%/config/providers/logger.rb.erb +3 -0
- data/lib/hanamismith/templates/%project_name%/package.json.erb +1 -1
- data/lib/hanamismith/templates/%project_name%/spec/app/aspects/logging/rack_adapter_spec.rb.erb +34 -0
- data/lib/hanamismith/templates/%project_name%/spec/app/providers/logger_spec.rb.erb +101 -0
- data/lib/hanamismith/templates/%project_name%/spec/hanami_helper.rb.erb +2 -2
- data/lib/hanamismith/templates/%project_name%/spec/lib/%project_path%/refines/actions/response_spec.rb.erb +1 -1
- data/lib/hanamismith/templates/%project_name%/spec/support/shared_contexts/{application.rb.erb → application_dependencies.rb.erb} +2 -1
- data.tar.gz.sig +0 -0
- metadata +11 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87776c02595114ae39a7d0c425c7f9dc1d5b9ff333e0e09de68372658e77cedc
|
|
4
|
+
data.tar.gz: 549dd6871dafc8b0e94202bc7de49389489f92971cfbd620ba621ddfc41f7f58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f748c097fe691ec3ba89b66585c5d53aee1741e2a4d686728f6f34f42864a7b854320718e158bc4be7a4c7520ce156316fd468bd646d0c997d754b9aed2c40e
|
|
7
|
+
data.tar.gz: e648dd2a4bf625fe551a244ab478e36a64fc94132869b5c04f3003a68ef1ef44ad977be3c740d1fb67e0434b3d87dd0b632e5e413d5d5008d20c0de9c13b5a62
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/hanamismith.gemspec
CHANGED
|
@@ -35,13 +35,13 @@ module Hanamismith
|
|
|
35
35
|
|
|
36
36
|
def insert_hanami
|
|
37
37
|
with_template.insert_after "source", <<~CONTENT.strip
|
|
38
|
-
gem "hanami", "~> 2.
|
|
39
|
-
gem "hanami-assets", "~> 2.
|
|
40
|
-
gem "hanami-controller", "~> 2.
|
|
41
|
-
gem "hanami-db", "~> 2.
|
|
42
|
-
gem "hanami-router", "~> 2.
|
|
43
|
-
gem "hanami-validations", "~> 2.
|
|
44
|
-
gem "hanami-view", "~> 2.
|
|
38
|
+
gem "hanami", "~> 2.3"
|
|
39
|
+
gem "hanami-assets", "~> 2.3"
|
|
40
|
+
gem "hanami-controller", "~> 2.3"
|
|
41
|
+
gem "hanami-db", "~> 2.3"
|
|
42
|
+
gem "hanami-router", "~> 2.3"
|
|
43
|
+
gem "hanami-validations", "~> 2.3"
|
|
44
|
+
gem "hanami-view", "~> 2.3"
|
|
45
45
|
CONTENT
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -83,7 +83,7 @@ module Hanamismith
|
|
|
83
83
|
|
|
84
84
|
def insert_development
|
|
85
85
|
with_template.insert_after(/group :development do/, <<~CONTENT.gsub("gem", " gem"))
|
|
86
|
-
gem "hanami-webconsole", "~> 2.
|
|
86
|
+
gem "hanami-webconsole", "~> 2.3"
|
|
87
87
|
gem "localhost", "~> 1.3"
|
|
88
88
|
gem "rerun", "~> 0.14"
|
|
89
89
|
CONTENT
|
|
@@ -14,7 +14,12 @@ module Hanamismith
|
|
|
14
14
|
super
|
|
15
15
|
path = "%project_name%/.config/rubocop/config.yml.erb"
|
|
16
16
|
builder.call(settings.with(template_path: path))
|
|
17
|
-
.append("\nplugins: rubocop-sequel\n")
|
|
17
|
+
.append("\nplugins: rubocop-sequel\n\n")
|
|
18
|
+
.append(<<~CONTENT)
|
|
19
|
+
RSpec/SpecFilePathFormat:
|
|
20
|
+
CustomTransform:
|
|
21
|
+
#{settings.project_namespaced_class}: ""
|
|
22
|
+
CONTENT
|
|
18
23
|
|
|
19
24
|
true
|
|
20
25
|
end
|
|
@@ -53,7 +53,7 @@ module Hanamismith
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def add_migrate_directory
|
|
56
|
-
builder.call(settings.with(template_path: "%project_name%/db/migrate")).make_path
|
|
56
|
+
builder.call(settings.with(template_path: "%project_name%/config/db/migrate")).make_path
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def add_well_known_security_text
|
|
@@ -70,6 +70,10 @@ module Hanamismith
|
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
def add_log_directory
|
|
74
|
+
builder.call(settings.with(template_path: "%project_name%/log")).make_path
|
|
75
|
+
end
|
|
76
|
+
|
|
73
77
|
def add_temp_directory
|
|
74
78
|
builder.call(settings.with(template_path: "%project_name%/tmp")).make_path
|
|
75
79
|
end
|
|
@@ -13,14 +13,21 @@ module Hanamismith
|
|
|
13
13
|
return false unless settings.build_git
|
|
14
14
|
|
|
15
15
|
super
|
|
16
|
+
add_entries
|
|
17
|
+
true
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def add_entries
|
|
16
23
|
builder.call(settings.with(template_path: "%project_name%/.gitignore.erb"))
|
|
17
24
|
.insert_before "tmp\n", <<~CONTENT
|
|
18
25
|
node_modules
|
|
19
|
-
public
|
|
20
|
-
public
|
|
26
|
+
public/*
|
|
27
|
+
!public/.well-known
|
|
28
|
+
!public/404.html
|
|
29
|
+
!public/500.html
|
|
21
30
|
CONTENT
|
|
22
|
-
|
|
23
|
-
true
|
|
24
31
|
end
|
|
25
32
|
end
|
|
26
33
|
end
|
|
@@ -0,0 +1,48 @@
|
|
|
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 logger provider.
|
|
9
|
+
class Logger < Rubysmith::Builders::Abstract
|
|
10
|
+
using Refinements::Struct
|
|
11
|
+
|
|
12
|
+
def call
|
|
13
|
+
build_all
|
|
14
|
+
add_initializers
|
|
15
|
+
true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def build_all
|
|
21
|
+
%w[
|
|
22
|
+
%project_name%/app/providers/logger.rb.erb
|
|
23
|
+
%project_name%/spec/app/providers/logger_spec.rb.erb
|
|
24
|
+
%project_name%/config/providers/logger.rb.erb
|
|
25
|
+
%project_name%/app/aspects/logging/rack_adapter.rb.erb
|
|
26
|
+
%project_name%/spec/app/aspects/logging/rack_adapter_spec.rb.erb
|
|
27
|
+
%project_name%/config/initializers/rack_logger_patch.rb.erb
|
|
28
|
+
%project_name%/config/initializers/sql_logger_patch.rb.erb
|
|
29
|
+
].each { build it }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def build(path) = builder.call(settings.with(template_path: path)).render
|
|
33
|
+
|
|
34
|
+
def add_initializers
|
|
35
|
+
builder.call(settings.with(template_path: "%project_name%/config/app.rb.erb"))
|
|
36
|
+
.insert_after(
|
|
37
|
+
/require/,
|
|
38
|
+
<<~REQUIRES
|
|
39
|
+
|
|
40
|
+
require_relative "initializers/rack_logger_patch"
|
|
41
|
+
require_relative "initializers/sql_logger_patch"
|
|
42
|
+
REQUIRES
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -16,6 +16,7 @@ module Hanamismith
|
|
|
16
16
|
builder.call(settings.with(template_path: "%project_name%/Rakefile.erb"))
|
|
17
17
|
.render
|
|
18
18
|
.insert_after(%r(bundler/setup), %(require "hanami/rake_tasks"))
|
|
19
|
+
.insert_after(/RuboCop::RakeTask/, %(\nRake.add_rakelib "lib/tasks"\n))
|
|
19
20
|
|
|
20
21
|
true
|
|
21
22
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "refinements/struct"
|
|
4
|
+
|
|
5
|
+
module Hanamismith
|
|
6
|
+
module Builders
|
|
7
|
+
# Builds project skeleton Reek code quality support.
|
|
8
|
+
class Reek < Rubysmith::Builders::Reek
|
|
9
|
+
using Refinements::Struct
|
|
10
|
+
|
|
11
|
+
def call
|
|
12
|
+
return false unless settings.build_reek
|
|
13
|
+
|
|
14
|
+
super
|
|
15
|
+
add_detectors
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def add_detectors
|
|
20
|
+
with_template.insert_after(
|
|
21
|
+
/enabled:\sfalse\n/,
|
|
22
|
+
<<~DETECTORS.gsub(/^/, " ")
|
|
23
|
+
TooManyStatements:
|
|
24
|
+
exclude:
|
|
25
|
+
- RackLoggerPatch#prepare_app_providers
|
|
26
|
+
UtilityFunction:
|
|
27
|
+
exclude:
|
|
28
|
+
- SQLLoggerPatch#log_query
|
|
29
|
+
DETECTORS
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def with_template
|
|
34
|
+
builder.call settings.with(template_path: "%project_name%/.reek.yml.erb")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -12,7 +12,7 @@ module Hanamismith
|
|
|
12
12
|
def call
|
|
13
13
|
return false unless settings.build_rspec
|
|
14
14
|
|
|
15
|
-
path = "%project_name%/spec/support/shared_contexts/
|
|
15
|
+
path = "%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb"
|
|
16
16
|
builder.call(settings.with(template_path: path)).render
|
|
17
17
|
|
|
18
18
|
true
|
|
@@ -14,6 +14,7 @@ module Hanamismith
|
|
|
14
14
|
Rubysmith::Builders::Init,
|
|
15
15
|
Builders::Core,
|
|
16
16
|
Builders::Providers::HTMX,
|
|
17
|
+
Builders::Providers::Logger,
|
|
17
18
|
Builders::Refinement,
|
|
18
19
|
Builders::Icon,
|
|
19
20
|
Builders::Stylesheet,
|
|
@@ -42,7 +43,7 @@ module Hanamismith
|
|
|
42
43
|
Rubysmith::Builders::GitHub::Funding,
|
|
43
44
|
Builders::GitHub::CI,
|
|
44
45
|
Builders::Setup,
|
|
45
|
-
|
|
46
|
+
Builders::Reek,
|
|
46
47
|
Rubysmith::Builders::RSpec::Binstub,
|
|
47
48
|
Rubysmith::Builders::RSpec::Context,
|
|
48
49
|
Builders::RSpec::ApplicationSharedContext,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<% namespace do %>
|
|
2
|
+
module Aspects
|
|
3
|
+
module Logging
|
|
4
|
+
# Adapts Cogger Rack middleware for provider registration.
|
|
5
|
+
module RackAdapter
|
|
6
|
+
module_function
|
|
7
|
+
|
|
8
|
+
def with logger
|
|
9
|
+
@logger = logger
|
|
10
|
+
self
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def new application
|
|
14
|
+
@application = Cogger::Rack::Logger.new application, {logger: @logger}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def call(environment) = @application.call environment
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
<% end %>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<% namespace do %>
|
|
2
|
+
module Providers
|
|
3
|
+
# The logger provider.
|
|
4
|
+
class Logger < Hanami::Provider::Source
|
|
5
|
+
RESOLVER = proc { Object.const_get "Cogger" }
|
|
6
|
+
|
|
7
|
+
def initialize(environment: Hanami.env, resolver: RESOLVER, **)
|
|
8
|
+
@environment = environment
|
|
9
|
+
@resolver = resolver
|
|
10
|
+
@id = Hanami.app.namespace.to_s.downcase.to_sym
|
|
11
|
+
super(**)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def prepare = require "cogger"
|
|
15
|
+
|
|
16
|
+
def start
|
|
17
|
+
add_filters
|
|
18
|
+
register :logger, build_instance
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader :environment, :resolver, :id
|
|
24
|
+
|
|
25
|
+
def add_filters = cogger.add_filters :api_key, :csrf, :password, :password_confirmation
|
|
26
|
+
|
|
27
|
+
def build_instance
|
|
28
|
+
io = "log/#{environment}.log"
|
|
29
|
+
|
|
30
|
+
case environment
|
|
31
|
+
when :test
|
|
32
|
+
cogger.new(id:, io: StringIO.new, formatter: :json, level: :debug).add_stream io:
|
|
33
|
+
when :development then cogger.new(id:).add_stream(io:, formatter: :json)
|
|
34
|
+
else cogger.new id:, formatter: :json
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def cogger
|
|
39
|
+
@cogger ||= resolver.call
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
<% end %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "dry/system"
|
|
2
|
+
|
|
3
|
+
# Patches Hanami's default providers.
|
|
4
|
+
module RackLoggerPatch
|
|
5
|
+
def prepare_app_providers
|
|
6
|
+
require "hanami/providers/inflector"
|
|
7
|
+
|
|
8
|
+
logger = Class.new Hanami::Provider::Source do
|
|
9
|
+
def start
|
|
10
|
+
slice.start :logger
|
|
11
|
+
register :monitor, <%= settings.project_namespaced_class %>::Aspects::Logging::RackAdapter.with(slice[:logger])
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
register_provider :inflector, source: Hanami::Providers::Inflector
|
|
16
|
+
register_provider :rack, source: logger, namespace: true
|
|
17
|
+
register_provider :db_logging, source: Hanami::Providers::DBLogging
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Hanami::App::ClassMethods.prepend RackLoggerPatch
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require "dry-monitor"
|
|
2
|
+
require "dry/monitor/sql/logger"
|
|
3
|
+
|
|
4
|
+
# Patches Hanami's default SQL logger.
|
|
5
|
+
module SQLLoggerPatch
|
|
6
|
+
def log_query time:, name:, query:
|
|
7
|
+
# :nocov:
|
|
8
|
+
Hanami.app[:logger].info { {message: query, tags: [{db: name, duration: time}]} }
|
|
9
|
+
# :nocov:
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Dry::Monitor::SQL::Logger.prepend SQLLoggerPatch
|
data/lib/hanamismith/templates/%project_name%/spec/app/aspects/logging/rack_adapter_spec.rb.erb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "hanami_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe <%= settings.project_namespaced_class %>::Aspects::Logging::RackAdapter do
|
|
4
|
+
subject(:adapter) { described_class }
|
|
5
|
+
|
|
6
|
+
include_context "with application dependencies"
|
|
7
|
+
|
|
8
|
+
let(:application) { proc { [200, {"Content-Type" => "text/plain"}, "test"] } }
|
|
9
|
+
|
|
10
|
+
describe ".with" do
|
|
11
|
+
it "answers itself" do
|
|
12
|
+
expect(adapter.with(nil)).to eq(adapter)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe ".new" do
|
|
17
|
+
it "answers Cogger middleware" do
|
|
18
|
+
expect(adapter.with(logger).new(application)).to be_a(Cogger::Rack::Logger)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe ".call" do
|
|
23
|
+
let(:middleware) { adapter.with(logger).new application }
|
|
24
|
+
|
|
25
|
+
it "answers application" do
|
|
26
|
+
expect(middleware.call({})).to eq([200, {"Content-Type" => "text/plain"}, "test"])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "logs request" do
|
|
30
|
+
middleware.call({})
|
|
31
|
+
expect(logger.reread).to match(/level.+INFO.+status.+200/)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
require "hanami_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe <%= settings.project_namespaced_class %>::Providers::Logger do
|
|
4
|
+
subject(:provider) { described_class.new provider_container:, target_container:, slice: }
|
|
5
|
+
|
|
6
|
+
let(:provider_container) { Dry::Core::Container.new }
|
|
7
|
+
let(:target_container) { Dry::Core::Container.new }
|
|
8
|
+
let(:slice) { Hanami.app }
|
|
9
|
+
|
|
10
|
+
describe "#prepare" do
|
|
11
|
+
it "answers false due to already being loaded" do
|
|
12
|
+
expect(provider.prepare).to be(false)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "#start" do
|
|
17
|
+
let(:cogger) { class_spy Cogger }
|
|
18
|
+
let(:hub) { instance_spy Cogger::Hub }
|
|
19
|
+
|
|
20
|
+
before { allow(cogger).to receive(:new).and_return hub }
|
|
21
|
+
|
|
22
|
+
it "adds filters" do
|
|
23
|
+
provider = described_class.new(
|
|
24
|
+
environment: :test,
|
|
25
|
+
resolver: proc { cogger },
|
|
26
|
+
provider_container:,
|
|
27
|
+
target_container:,
|
|
28
|
+
slice:
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
provider.start
|
|
32
|
+
expect(cogger).to have_received(:add_filters).with(any_args)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context "with test environment" do
|
|
36
|
+
subject :provider do
|
|
37
|
+
described_class.new environment: :test,
|
|
38
|
+
resolver: proc { cogger },
|
|
39
|
+
provider_container:,
|
|
40
|
+
target_container:,
|
|
41
|
+
slice:
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "initializes" do
|
|
45
|
+
provider.start
|
|
46
|
+
|
|
47
|
+
expect(cogger).to have_received(:new).with(
|
|
48
|
+
id: :<%= settings.project_name %>,
|
|
49
|
+
io: kind_of(StringIO),
|
|
50
|
+
formatter: :json,
|
|
51
|
+
level: :debug
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "adds stream" do
|
|
56
|
+
provider.start
|
|
57
|
+
expect(hub).to have_received(:add_stream).with(io: "log/test.log")
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context "with development environment" do
|
|
62
|
+
subject :provider do
|
|
63
|
+
described_class.new environment: :development,
|
|
64
|
+
resolver: proc { cogger },
|
|
65
|
+
provider_container:,
|
|
66
|
+
target_container:,
|
|
67
|
+
slice:
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "initializes" do
|
|
71
|
+
provider.start
|
|
72
|
+
expect(cogger).to have_received(:new).with(id: :<%= settings.project_name %>)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "adds stream" do
|
|
76
|
+
provider.start
|
|
77
|
+
expect(hub).to have_received(:add_stream).with(io: "log/development.log", formatter: :json)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context "with any other environment" do
|
|
82
|
+
subject :provider do
|
|
83
|
+
described_class.new environment: :production,
|
|
84
|
+
resolver: proc { cogger },
|
|
85
|
+
provider_container:,
|
|
86
|
+
target_container:,
|
|
87
|
+
slice:
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it "initializes" do
|
|
91
|
+
provider.start
|
|
92
|
+
expect(cogger).to have_received(:new).with(id: :<%= settings.project_name %>, formatter: :json)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "registers logger" do
|
|
97
|
+
provider.start
|
|
98
|
+
expect(provider_container.key?(:logger)).to be(true)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -32,8 +32,8 @@ RSpec.configure do |config|
|
|
|
32
32
|
config.define_derived_metadata(file_path: %r(/spec/features/)) { it[:type] = :feature }
|
|
33
33
|
config.define_derived_metadata(file_path: %r(/spec/requests/)) { it[:type] = :request }
|
|
34
34
|
|
|
35
|
-
config.include_context "with application", type: :request
|
|
36
|
-
config.include_context "with application", type: :feature
|
|
35
|
+
config.include_context "with application dependencies", type: :request
|
|
36
|
+
config.include_context "with application dependencies", type: :feature
|
|
37
37
|
|
|
38
38
|
databases = proc do
|
|
39
39
|
Hanami.app.slices.with_nested.prepend(Hanami.app).each.with_object Set.new do |slice, dbs|
|
|
@@ -4,7 +4,7 @@ RSpec.describe <%= settings.project_namespaced_class %>::Refines::Actions::Respo
|
|
|
4
4
|
using described_class
|
|
5
5
|
|
|
6
6
|
subject :response do
|
|
7
|
-
config = Class.new(Hanami::Action).config.tap { it.
|
|
7
|
+
config = Class.new(Hanami::Action).config.tap { it.formats.accept :json }
|
|
8
8
|
Hanami::Action::Response.new request:, config:
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
RSpec.shared_context "with application" do
|
|
1
|
+
RSpec.shared_context "with application dependencies" do
|
|
2
2
|
let(:app) { Hanami.app }
|
|
3
3
|
let(:json_payload) { JSON last_response.body, symbolize_names: true }
|
|
4
|
+
let(:logger) { app[:logger] }
|
|
4
5
|
let(:routes) { app[:routes] }
|
|
5
6
|
let(:settings) { app[:settings] }
|
|
6
7
|
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.
|
|
4
|
+
version: 1.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -252,6 +252,7 @@ files:
|
|
|
252
252
|
- lib/hanamismith/builders/layout.rb
|
|
253
253
|
- lib/hanamismith/builders/node.rb
|
|
254
254
|
- lib/hanamismith/builders/providers/htmx.rb
|
|
255
|
+
- lib/hanamismith/builders/providers/logger.rb
|
|
255
256
|
- lib/hanamismith/builders/puma/configuration.rb
|
|
256
257
|
- lib/hanamismith/builders/puma/procfile.rb
|
|
257
258
|
- lib/hanamismith/builders/pwa.rb
|
|
@@ -259,6 +260,7 @@ files:
|
|
|
259
260
|
- lib/hanamismith/builders/rack/configuration.rb
|
|
260
261
|
- lib/hanamismith/builders/rack/deflater.rb
|
|
261
262
|
- lib/hanamismith/builders/rake/configuration.rb
|
|
263
|
+
- lib/hanamismith/builders/reek.rb
|
|
262
264
|
- lib/hanamismith/builders/refinement.rb
|
|
263
265
|
- lib/hanamismith/builders/rspec/application_shared_context.rb
|
|
264
266
|
- lib/hanamismith/builders/rspec/hanami.rb
|
|
@@ -280,6 +282,7 @@ files:
|
|
|
280
282
|
- lib/hanamismith/templates/%project_name%/Procfile.dev.erb
|
|
281
283
|
- lib/hanamismith/templates/%project_name%/Procfile.erb
|
|
282
284
|
- lib/hanamismith/templates/%project_name%/app/action.rb.erb
|
|
285
|
+
- lib/hanamismith/templates/%project_name%/app/aspects/logging/rack_adapter.rb.erb
|
|
283
286
|
- lib/hanamismith/templates/%project_name%/app/assets/css/colors.css.erb
|
|
284
287
|
- lib/hanamismith/templates/%project_name%/app/assets/css/defaults.css.erb
|
|
285
288
|
- lib/hanamismith/templates/%project_name%/app/assets/css/layout.css.erb
|
|
@@ -291,6 +294,7 @@ files:
|
|
|
291
294
|
- lib/hanamismith/templates/%project_name%/app/db/relation.rb.erb
|
|
292
295
|
- lib/hanamismith/templates/%project_name%/app/db/repository.rb.erb
|
|
293
296
|
- lib/hanamismith/templates/%project_name%/app/db/struct.rb.erb
|
|
297
|
+
- lib/hanamismith/templates/%project_name%/app/providers/logger.rb.erb
|
|
294
298
|
- lib/hanamismith/templates/%project_name%/app/templates/layouts/app.html.erb.erb
|
|
295
299
|
- lib/hanamismith/templates/%project_name%/app/view.rb.erb
|
|
296
300
|
- lib/hanamismith/templates/%project_name%/bin/hanami.erb
|
|
@@ -299,7 +303,10 @@ files:
|
|
|
299
303
|
- lib/hanamismith/templates/%project_name%/config/app.rb.erb
|
|
300
304
|
- lib/hanamismith/templates/%project_name%/config/assets.js.erb
|
|
301
305
|
- lib/hanamismith/templates/%project_name%/config/initializers/rack_attack.rb.erb
|
|
306
|
+
- lib/hanamismith/templates/%project_name%/config/initializers/rack_logger_patch.rb.erb
|
|
307
|
+
- lib/hanamismith/templates/%project_name%/config/initializers/sql_logger_patch.rb.erb
|
|
302
308
|
- lib/hanamismith/templates/%project_name%/config/providers/htmx.rb.erb
|
|
309
|
+
- lib/hanamismith/templates/%project_name%/config/providers/logger.rb.erb
|
|
303
310
|
- lib/hanamismith/templates/%project_name%/config/puma.rb.erb
|
|
304
311
|
- lib/hanamismith/templates/%project_name%/config/routes.rb.erb
|
|
305
312
|
- lib/hanamismith/templates/%project_name%/config/settings.rb.erb
|
|
@@ -327,11 +334,13 @@ files:
|
|
|
327
334
|
- lib/hanamismith/templates/%project_name%/slices/home/view.rb.erb
|
|
328
335
|
- lib/hanamismith/templates/%project_name%/slices/home/views/context.rb.erb
|
|
329
336
|
- lib/hanamismith/templates/%project_name%/slices/home/views/show.rb.erb
|
|
337
|
+
- lib/hanamismith/templates/%project_name%/spec/app/aspects/logging/rack_adapter_spec.rb.erb
|
|
338
|
+
- lib/hanamismith/templates/%project_name%/spec/app/providers/logger_spec.rb.erb
|
|
330
339
|
- lib/hanamismith/templates/%project_name%/spec/features/home_spec.rb.erb
|
|
331
340
|
- lib/hanamismith/templates/%project_name%/spec/hanami_helper.rb.erb
|
|
332
341
|
- lib/hanamismith/templates/%project_name%/spec/lib/%project_path%/refines/actions/response_spec.rb.erb
|
|
333
342
|
- lib/hanamismith/templates/%project_name%/spec/slices/health/actions/show_spec.rb.erb
|
|
334
|
-
- lib/hanamismith/templates/%project_name%/spec/support/shared_contexts/
|
|
343
|
+
- lib/hanamismith/templates/%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb
|
|
335
344
|
homepage: https://alchemists.io/projects/hanamismith
|
|
336
345
|
licenses:
|
|
337
346
|
- Hippocratic-2.1
|
metadata.gz.sig
CHANGED
|
Binary file
|