hanamismith 0.37.0 → 0.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +2 -2
  4. data/hanamismith.gemspec +9 -9
  5. data/lib/hanamismith/builders/asset.rb +2 -2
  6. data/lib/hanamismith/builders/binstub.rb +2 -2
  7. data/lib/hanamismith/builders/bundler.rb +3 -3
  8. data/lib/hanamismith/builders/caliber.rb +3 -3
  9. data/lib/hanamismith/builders/circle_ci.rb +20 -0
  10. data/lib/hanamismith/builders/console.rb +4 -4
  11. data/lib/hanamismith/builders/core.rb +11 -14
  12. data/lib/hanamismith/builders/documentation/readme.rb +3 -3
  13. data/lib/hanamismith/builders/environments/development.rb +2 -2
  14. data/lib/hanamismith/builders/environments/test.rb +2 -2
  15. data/lib/hanamismith/builders/git/ignore.rb +3 -3
  16. data/lib/hanamismith/builders/{ci/git_hub.rb → git_hub/ci.rb} +5 -5
  17. data/lib/hanamismith/builders/guard.rb +3 -3
  18. data/lib/hanamismith/builders/icon.rb +2 -2
  19. data/lib/hanamismith/builders/javascript.rb +2 -2
  20. data/lib/hanamismith/builders/node.rb +3 -3
  21. data/lib/hanamismith/builders/providers/persistence.rb +2 -2
  22. data/lib/hanamismith/builders/providers/yjit.rb +2 -2
  23. data/lib/hanamismith/builders/puma/configuration.rb +2 -3
  24. data/lib/hanamismith/builders/puma/procfile.rb +3 -3
  25. data/lib/hanamismith/builders/pwa.rb +2 -2
  26. data/lib/hanamismith/builders/rack/attack.rb +3 -3
  27. data/lib/hanamismith/builders/rack/configuration.rb +2 -2
  28. data/lib/hanamismith/builders/rack/deflater.rb +2 -2
  29. data/lib/hanamismith/builders/rake/configuration.rb +25 -0
  30. data/lib/hanamismith/builders/refinement.rb +2 -2
  31. data/lib/hanamismith/builders/rspec/application_shared_context.rb +3 -3
  32. data/lib/hanamismith/builders/rspec/database.rb +3 -3
  33. data/lib/hanamismith/builders/rspec/factory.rb +3 -3
  34. data/lib/hanamismith/builders/rspec/hanami.rb +3 -3
  35. data/lib/hanamismith/builders/rspec/helper.rb +5 -10
  36. data/lib/hanamismith/builders/setup.rb +3 -3
  37. data/lib/hanamismith/builders/slices/health.rb +12 -12
  38. data/lib/hanamismith/builders/slices/home.rb +15 -15
  39. data/lib/hanamismith/builders/stylesheet.rb +2 -2
  40. data/lib/hanamismith/cli/commands/build.rb +37 -35
  41. data/lib/hanamismith/container.rb +31 -21
  42. data/lib/hanamismith/extensions/asset.rb +3 -12
  43. data/lib/hanamismith/extensions/npm.rb +3 -12
  44. data/lib/hanamismith/templates/%project_name%/.circleci/config.yml.erb +1 -1
  45. data/lib/hanamismith/templates/%project_name%/.github/workflows/ci.yml.erb +1 -1
  46. data/lib/hanamismith/templates/%project_name%/.node-version.erb +1 -1
  47. data/lib/hanamismith/templates/%project_name%/app/assets/pwa/manifest.webmanifest.erb +2 -2
  48. data/lib/hanamismith/templates/%project_name%/config/providers/persistence.rb.erb +2 -2
  49. data/lib/hanamismith/templates/%project_name%/env.development.erb +1 -1
  50. data/lib/hanamismith/templates/%project_name%/env.test.erb +1 -1
  51. data/lib/hanamismith/templates/%project_name%/package.json.erb +4 -4
  52. data/lib/hanamismith/templates/%project_name%/slices/health/action.rb.erb +1 -1
  53. data/lib/hanamismith/templates/%project_name%/slices/health/templates/layouts/app.html.erb.erb +2 -2
  54. data/lib/hanamismith/templates/%project_name%/slices/health/view.rb.erb +1 -1
  55. data/lib/hanamismith/templates/%project_name%/slices/home/action.rb.erb +1 -1
  56. data/lib/hanamismith/templates/%project_name%/slices/home/repository.rb.erb +1 -1
  57. data/lib/hanamismith/templates/%project_name%/slices/home/templates/layouts/app.html.erb.erb +2 -2
  58. data/lib/hanamismith/templates/%project_name%/slices/home/templates/show.html.erb.erb +1 -1
  59. data/lib/hanamismith/templates/%project_name%/slices/home/view.rb.erb +1 -1
  60. data/lib/hanamismith/templates/%project_name%/spec/features/home_spec.rb.erb +1 -1
  61. data/lib/hanamismith/templates/%project_name%/spec/lib/%project_path%/refines/actions/response_spec.rb.erb +1 -1
  62. data/lib/hanamismith.rb +1 -0
  63. data.tar.gz.sig +0 -0
  64. metadata +22 -22
  65. metadata.gz.sig +0 -0
  66. data/lib/hanamismith/builders/ci/circle.rb +0 -22
  67. data/lib/hanamismith/builders/rake.rb +0 -23
@@ -11,18 +11,18 @@ module Hanamismith
11
11
 
12
12
  def initialize(...)
13
13
  super
14
- @template = builder.call configuration.merge(
14
+ @template = builder.call settings.merge(
15
15
  template_path: "%project_name%/spec/spec_helper.rb.erb"
16
16
  )
17
17
  end
18
18
 
19
19
  def call
20
- return configuration unless configuration.build_rspec
20
+ return false unless settings.build_rspec
21
21
 
22
22
  super
23
23
  remove_project_requirement
24
24
  disable_simple_cov_eval
25
- configuration
25
+ true
26
26
  end
27
27
 
28
28
  private
@@ -30,16 +30,11 @@ module Hanamismith
30
30
  attr_reader :template
31
31
 
32
32
  def remove_project_requirement
33
- template.replace(/require.+#{configuration.project_name}.+\n/, "")
33
+ template.replace(/require.+#{settings.project_name}.+\n/, "")
34
34
  end
35
35
 
36
36
  def disable_simple_cov_eval
37
- template.replace(
38
- /enable_coverage_for_eval\n/,
39
- "# TODO: Enable once this issue is fixed: " \
40
- "https://bugs.ruby-lang.org/issues/19363.\n " \
41
- "# enable_coverage_for_eval\n"
42
- )
37
+ template.replace(/\s{4}enable_coverage_for_eval\n/, "")
43
38
  end
44
39
  end
45
40
  end
@@ -9,17 +9,17 @@ module Hanamismith
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- return configuration unless configuration.build_setup
12
+ return false unless settings.build_setup
13
13
 
14
14
  super
15
15
  append
16
- configuration
16
+ true
17
17
  end
18
18
 
19
19
  private
20
20
 
21
21
  def append
22
- builder.call(configuration.merge(template_path: "%project_name%/bin/setup.erb"))
22
+ builder.call(settings.merge(template_path: "%project_name%/bin/setup.erb"))
23
23
  .insert_after(%(Runner.call "bundle install"\n), <<~CONTENT.gsub(/^(?=\w)/, " "))
24
24
 
25
25
  puts "Installing packages..."
@@ -11,29 +11,29 @@ module Hanamismith
11
11
 
12
12
  def call
13
13
  private_methods.grep(/\Aadd_/).sort.each { |method| __send__ method }
14
- configuration
14
+ true
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def add_configuration
20
20
  path = "%project_name%/config/slices/health.rb.erb"
21
- builder.call(configuration.merge(template_path: path)).render
21
+ builder.call(settings.merge(template_path: path)).render
22
22
  end
23
23
 
24
24
  def add_action
25
25
  path = "%project_name%/slices/health/action.rb.erb"
26
- builder.call(configuration.merge(template_path: path)).render
26
+ builder.call(settings.merge(template_path: path)).render
27
27
  end
28
28
 
29
29
  def add_view
30
30
  path = "%project_name%/slices/health/view.rb.erb"
31
- builder.call(configuration.merge(template_path: path)).render
31
+ builder.call(settings.merge(template_path: path)).render
32
32
  end
33
33
 
34
34
  def add_layout
35
35
  path = "%project_name%/slices/health/templates/layouts/app.html.erb.erb"
36
- builder.call(configuration.merge(template_path: path))
36
+ builder.call(settings.merge(template_path: path))
37
37
  .render
38
38
  .replace("<!-- title -->", "<%= content_for :title %>")
39
39
  .replace("<!-- favicon -->", favicon)
@@ -42,7 +42,7 @@ module Hanamismith
42
42
 
43
43
  def favicon
44
44
  %(<%= favicon_tag app_assets["icon.svg"],\n) +
45
- %( title: "#{configuration.project_label}: Icon",\n) +
45
+ %( title: "#{settings.project_label}: Icon",\n) +
46
46
  %( rel: :icon,\n) +
47
47
  %( type: "image/svg+xml" %>)
48
48
  end
@@ -50,33 +50,33 @@ module Hanamismith
50
50
  def add_show_template
51
51
  path = "%project_name%/slices/health/templates/show.html.erb.erb"
52
52
 
53
- builder.call(configuration.merge(template_path: path))
53
+ builder.call(settings.merge(template_path: path))
54
54
  .render
55
55
  .replace(
56
56
  "<!-- title -->",
57
- %(<% content_for :title, "Health | #{configuration.project_label}" %>)
57
+ %(<% content_for :title, "Health | #{settings.project_label}" %>)
58
58
  )
59
59
  .replace("<!-- color -->", %(<%= color %>))
60
60
  end
61
61
 
62
62
  def add_context
63
63
  path = "%project_name%/slices/health/views/context.rb.erb"
64
- builder.call(configuration.merge(template_path: path)).render
64
+ builder.call(settings.merge(template_path: path)).render
65
65
  end
66
66
 
67
67
  def add_show_view
68
68
  path = "%project_name%/slices/health/views/show.rb.erb"
69
- builder.call(configuration.merge(template_path: path)).render
69
+ builder.call(settings.merge(template_path: path)).render
70
70
  end
71
71
 
72
72
  def add_show_action
73
73
  path = "%project_name%/slices/health/actions/show.rb.erb"
74
- builder.call(configuration.merge(template_path: path)).render
74
+ builder.call(settings.merge(template_path: path)).render
75
75
  end
76
76
 
77
77
  def add_show_action_spec
78
78
  path = "%project_name%/spec/slices/health/actions/show_spec.rb.erb"
79
- builder.call(configuration.merge(template_path: path)).render
79
+ builder.call(settings.merge(template_path: path)).render
80
80
  end
81
81
  end
82
82
  end
@@ -11,34 +11,34 @@ module Hanamismith
11
11
 
12
12
  def call
13
13
  private_methods.grep(/\Aadd_/).sort.each { |method| __send__ method }
14
- configuration
14
+ true
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def add_configuration
20
20
  path = "%project_name%/config/slices/home.rb.erb"
21
- builder.call(configuration.merge(template_path: path)).render
21
+ builder.call(settings.merge(template_path: path)).render
22
22
  end
23
23
 
24
24
  def add_action
25
25
  path = "%project_name%/slices/home/action.rb.erb"
26
- builder.call(configuration.merge(template_path: path)).render
26
+ builder.call(settings.merge(template_path: path)).render
27
27
  end
28
28
 
29
29
  def add_repository
30
30
  path = "%project_name%/slices/home/repository.rb.erb"
31
- builder.call(configuration.merge(template_path: path)).render
31
+ builder.call(settings.merge(template_path: path)).render
32
32
  end
33
33
 
34
34
  def add_view
35
35
  path = "%project_name%/slices/home/view.rb.erb"
36
- builder.call(configuration.merge(template_path: path)).render
36
+ builder.call(settings.merge(template_path: path)).render
37
37
  end
38
38
 
39
39
  def add_layout_template
40
40
  path = "%project_name%/slices/home/templates/layouts/app.html.erb.erb"
41
- builder.call(configuration.merge(template_path: path))
41
+ builder.call(settings.merge(template_path: path))
42
42
  .render
43
43
  .replace("<!-- title -->", "<%= content_for :title %>")
44
44
  .replace("<!-- favicon -->", favicon)
@@ -49,34 +49,34 @@ module Hanamismith
49
49
 
50
50
  def favicon
51
51
  %(<%= favicon_tag app_assets["icon.svg"],\n) +
52
- %( title: "#{configuration.project_label}: Icon",\n) +
52
+ %( title: "#{settings.project_label}: Icon",\n) +
53
53
  %( rel: :icon,\n) +
54
54
  %( type: "image/svg+xml" %>)
55
55
  end
56
56
 
57
57
  def manifest
58
- %(<%= tag.link title: "#{configuration.project_label}: Manifest",\n) +
58
+ %(<%= tag.link title: "#{settings.project_label}: Manifest",\n) +
59
59
  %( rel: :manifest,\n) +
60
60
  %( href: app_assets["manifest.webmanifest"] %>)
61
61
  end
62
62
 
63
63
  def stylesheet
64
- %(<%= stylesheet_tag "app", title: "#{configuration.project_label}: Stylesheet" %>)
64
+ %(<%= stylesheet_tag "app", title: "#{settings.project_label}: Stylesheet" %>)
65
65
  end
66
66
 
67
67
  def add_context
68
68
  path = "%project_name%/slices/home/views/context.rb.erb"
69
- builder.call(configuration.merge(template_path: path)).render
69
+ builder.call(settings.merge(template_path: path)).render
70
70
  end
71
71
 
72
72
  def add_show_template
73
73
  path = "%project_name%/slices/home/templates/show.html.erb.erb"
74
74
 
75
- builder.call(configuration.merge(template_path: path))
75
+ builder.call(settings.merge(template_path: path))
76
76
  .render
77
77
  .replace(
78
78
  "<!-- title -->",
79
- %(<% content_for :title, "#{configuration.project_label}" %>)
79
+ %(<% content_for :title, "#{settings.project_label}" %>)
80
80
  )
81
81
  .replace("<!-- ruby_version -->", "<%= ruby_version %>")
82
82
  .replace("<!-- hanami_version -->", "<%= hanami_version %>")
@@ -84,17 +84,17 @@ module Hanamismith
84
84
 
85
85
  def add_show_view
86
86
  path = "%project_name%/slices/home/views/show.rb.erb"
87
- builder.call(configuration.merge(template_path: path)).render
87
+ builder.call(settings.merge(template_path: path)).render
88
88
  end
89
89
 
90
90
  def add_show_action
91
91
  path = "%project_name%/slices/home/actions/show.rb.erb"
92
- builder.call(configuration.merge(template_path: path)).render
92
+ builder.call(settings.merge(template_path: path)).render
93
93
  end
94
94
 
95
95
  def add_request_spec
96
96
  path = "%project_name%/spec/features/home_spec.rb.erb"
97
- builder.call(configuration.merge(template_path: path)).render
97
+ builder.call(settings.merge(template_path: path)).render
98
98
  end
99
99
  end
100
100
  end
@@ -10,8 +10,8 @@ module Hanamismith
10
10
 
11
11
  def call
12
12
  path = "%project_name%/slices/home/assets/css/app.css.erb"
13
- builder.call(configuration.merge(template_path: path)).render
14
- configuration
13
+ builder.call(settings.merge(template_path: path)).render
14
+ true
15
15
  end
16
16
  end
17
17
  end
@@ -7,7 +7,7 @@ module Hanamismith
7
7
  module Commands
8
8
  # Handles the build command.
9
9
  class Build < Sod::Command
10
- include Hanamismith::Import[:input, :logger]
10
+ include Hanamismith::Import[:settings, :logger]
11
11
 
12
12
  # Order matters.
13
13
  BUILDERS = [
@@ -33,13 +33,15 @@ module Hanamismith
33
33
  Builders::Bundler,
34
34
  Builders::Node,
35
35
  Builders::Asset,
36
- Builders::Rake,
36
+ Rubysmith::Builders::Rake::Binstub,
37
+ Builders::Rake::Configuration,
37
38
  Builders::Binstub,
38
39
  Builders::Console,
39
- Builders::CI::Circle,
40
- Builders::CI::GitHub,
40
+ Builders::CircleCI,
41
+ Rubysmith::Builders::GitHub::Template,
42
+ Rubysmith::Builders::GitHub::Funding,
43
+ Builders::GitHub::CI,
41
44
  Builders::Setup,
42
- Rubysmith::Builders::GitHub,
43
45
  Builders::Guard,
44
46
  Rubysmith::Builders::Reek,
45
47
  Rubysmith::Builders::RSpec::Binstub,
@@ -70,34 +72,34 @@ module Hanamismith
70
72
 
71
73
  description "Build new project."
72
74
 
73
- on Rubysmith::CLI::Actions::Name, input: Container[:input]
74
- on Rubysmith::CLI::Actions::AmazingPrint, input: Container[:input]
75
- on Rubysmith::CLI::Actions::Caliber, input: Container[:input]
76
- on Rubysmith::CLI::Actions::CircleCI, input: Container[:input]
77
- on Rubysmith::CLI::Actions::Citation, input: Container[:input]
78
- on Rubysmith::CLI::Actions::Community, input: Container[:input]
79
- on Rubysmith::CLI::Actions::Conduct, input: Container[:input]
80
- on Rubysmith::CLI::Actions::Console, input: Container[:input]
81
- on Rubysmith::CLI::Actions::Contributions, input: Container[:input]
82
- on Rubysmith::CLI::Actions::Debug, input: Container[:input]
83
- on Rubysmith::CLI::Actions::Funding, input: Container[:input]
84
- on Rubysmith::CLI::Actions::Git, input: Container[:input]
85
- on Rubysmith::CLI::Actions::GitHub, input: Container[:input]
86
- on Rubysmith::CLI::Actions::GitHubCI, input: Container[:input]
87
- on Rubysmith::CLI::Actions::GitLint, input: Container[:input]
88
- on Rubysmith::CLI::Actions::Guard, input: Container[:input]
89
- on Rubysmith::CLI::Actions::License, input: Container[:input]
90
- on Rubysmith::CLI::Actions::Maximum, input: Container[:input]
91
- on Rubysmith::CLI::Actions::Minimum, input: Container[:input]
92
- on Rubysmith::CLI::Actions::Rake, input: Container[:input]
93
- on Rubysmith::CLI::Actions::Readme, input: Container[:input]
94
- on Rubysmith::CLI::Actions::Reek, input: Container[:input]
95
- on Rubysmith::CLI::Actions::Refinements, input: Container[:input]
96
- on Rubysmith::CLI::Actions::RSpec, input: Container[:input]
97
- on Rubysmith::CLI::Actions::Security, input: Container[:input]
98
- on Rubysmith::CLI::Actions::Setup, input: Container[:input]
99
- on Rubysmith::CLI::Actions::SimpleCov, input: Container[:input]
100
- on Rubysmith::CLI::Actions::Versions, input: Container[:input]
75
+ on Rubysmith::CLI::Actions::Name, settings: Container[:settings]
76
+ on Rubysmith::CLI::Actions::AmazingPrint, settings: Container[:settings]
77
+ on Rubysmith::CLI::Actions::Caliber, settings: Container[:settings]
78
+ on Rubysmith::CLI::Actions::CircleCI, settings: Container[:settings]
79
+ on Rubysmith::CLI::Actions::Citation, settings: Container[:settings]
80
+ on Rubysmith::CLI::Actions::Community, settings: Container[:settings]
81
+ on Rubysmith::CLI::Actions::Conduct, settings: Container[:settings]
82
+ on Rubysmith::CLI::Actions::Console, settings: Container[:settings]
83
+ on Rubysmith::CLI::Actions::Contributions, settings: Container[:settings]
84
+ on Rubysmith::CLI::Actions::Debug, settings: Container[:settings]
85
+ on Rubysmith::CLI::Actions::Funding, settings: Container[:settings]
86
+ on Rubysmith::CLI::Actions::Git, settings: Container[:settings]
87
+ on Rubysmith::CLI::Actions::GitHub, settings: Container[:settings]
88
+ on Rubysmith::CLI::Actions::GitHubCI, settings: Container[:settings]
89
+ on Rubysmith::CLI::Actions::GitLint, settings: Container[:settings]
90
+ on Rubysmith::CLI::Actions::Guard, settings: Container[:settings]
91
+ on Rubysmith::CLI::Actions::License, settings: Container[:settings]
92
+ on Rubysmith::CLI::Actions::Maximum, settings: Container[:settings]
93
+ on Rubysmith::CLI::Actions::Minimum, settings: Container[:settings]
94
+ on Rubysmith::CLI::Actions::Rake, settings: Container[:settings]
95
+ on Rubysmith::CLI::Actions::Readme, settings: Container[:settings]
96
+ on Rubysmith::CLI::Actions::Reek, settings: Container[:settings]
97
+ on Rubysmith::CLI::Actions::Refinements, settings: Container[:settings]
98
+ on Rubysmith::CLI::Actions::RSpec, settings: Container[:settings]
99
+ on Rubysmith::CLI::Actions::Security, settings: Container[:settings]
100
+ on Rubysmith::CLI::Actions::Setup, settings: Container[:settings]
101
+ on Rubysmith::CLI::Actions::SimpleCov, settings: Container[:settings]
102
+ on Rubysmith::CLI::Actions::Versions, settings: Container[:settings]
101
103
 
102
104
  def initialize(builders: BUILDERS, **)
103
105
  super(**)
@@ -105,8 +107,8 @@ module Hanamismith
105
107
  end
106
108
 
107
109
  def call
108
- log_info "Building project skeleton: #{input.project_name}..."
109
- builders.each { |builder| builder.call input }
110
+ log_info "Building project skeleton: #{settings.project_name}..."
111
+ builders.each { |constant| constant.new(settings:).call }
110
112
  log_info "Project skeleton complete!"
111
113
  end
112
114
 
@@ -11,34 +11,44 @@ module Hanamismith
11
11
  module Container
12
12
  extend Containable
13
13
 
14
- register :configuration do
15
- self[:defaults].add_loader(:yaml, self[:xdg_config].active)
16
- .then { |registry| Etcher.call registry }
17
- end
18
-
19
- register :defaults do
20
- registry = Etcher::Registry.new contract: Rubysmith::Configuration::Contract,
21
- model: Rubysmith::Configuration::Model
14
+ register :registry do
15
+ contract = Rubysmith::Configuration::Contract
16
+ model = Rubysmith::Configuration::Model
22
17
 
23
- registry.add_loader(:yaml, self[:defaults_path])
24
- .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
25
- .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
26
- .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
27
- .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new)
28
- .add_transformer(
29
- Rubysmith::Configuration::Transformers::TemplateRoot.new(
30
- default: Pathname(__dir__).join("templates")
31
- )
32
- )
33
- .add_transformer(Rubysmith::Configuration::Transformers::TargetRoot)
34
- .add_transformer(:time)
18
+ Etcher::Registry.new(contract:, model:)
19
+ .add_loader(:yaml, self[:defaults_path])
20
+ .add_loader(:yaml, self[:xdg_config].active)
21
+ .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
22
+ .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
23
+ .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
24
+ .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new)
25
+ .add_transformer(
26
+ Rubysmith::Configuration::Transformers::TemplateRoot.new(
27
+ default: Pathname(__dir__).join("templates")
28
+ )
29
+ )
30
+ .add_transformer(:root, :target_root)
31
+ .add_transformer(:format, :author_uri)
32
+ .add_transformer(:format, :project_uri_community)
33
+ .add_transformer(:format, :project_uri_conduct)
34
+ .add_transformer(:format, :project_uri_contributions)
35
+ .add_transformer(:format, :project_uri_download, :project_name)
36
+ .add_transformer(:format, :project_uri_funding)
37
+ .add_transformer(:format, :project_uri_home, :project_name)
38
+ .add_transformer(:format, :project_uri_issues, :project_name)
39
+ .add_transformer(:format, :project_uri_license)
40
+ .add_transformer(:format, :project_uri_security)
41
+ .add_transformer(:format, :project_uri_source, :project_name)
42
+ .add_transformer(:format, :project_uri_versions, :project_name)
43
+ .add_transformer(:time, :loaded_at)
35
44
  end
36
45
 
46
+ register(:settings) { Etcher.call(self[:registry]).dup }
37
47
  register(:specification) { Spek::Loader.call "#{__dir__}/../../hanamismith.gemspec" }
38
- register(:input) { self[:configuration].dup }
39
48
  register(:defaults_path) { Rubysmith::Container[:defaults_path] }
40
49
  register(:xdg_config) { Runcom::Config.new "hanamismith/configuration.yml" }
41
50
  register(:logger) { Cogger.new id: :hanamismith }
42
51
  register :kernel, Kernel
52
+ register :io, STDOUT
43
53
  end
44
54
  end
@@ -6,29 +6,20 @@ module Hanamismith
6
6
  module Extensions
7
7
  # Ensures assets are compiled.
8
8
  class Asset
9
- include Import[:kernel, :logger]
9
+ include Import[:settings, :kernel, :logger]
10
10
 
11
11
  using Refinements::Pathname
12
12
 
13
- def self.call(...) = new(...).call
14
-
15
- def initialize(configuration, **)
16
- super(**)
17
- @configuration = configuration
18
- end
19
-
20
13
  def call
21
14
  logger.error { "Unable to compile assets. Try: `hanami assets compile`." } unless run
22
- configuration
15
+ true
23
16
  end
24
17
 
25
18
  private
26
19
 
27
- attr_reader :configuration
28
-
29
20
  def run
30
21
  success = false
31
- configuration.project_root.change_dir { success = compile_app && compile_home }
22
+ settings.project_root.change_dir { success = compile_app && compile_home }
32
23
  success
33
24
  end
34
25
 
@@ -7,31 +7,22 @@ module Hanamismith
7
7
  module Extensions
8
8
  # Ensures NPM packages are installed if NPM is available.
9
9
  class NPM
10
- include Import[:kernel, :logger]
10
+ include Import[:settings, :kernel, :logger]
11
11
 
12
12
  using Refinements::IO
13
13
  using Refinements::Pathname
14
14
 
15
- def self.call(...) = new(...).call
16
-
17
- def initialize(configuration, **)
18
- super(**)
19
- @configuration = configuration
20
- end
21
-
22
15
  def call
23
16
  logger.error { "Unable to detect NPM. Install NPM and run: `npm install`." } unless run
24
- configuration
17
+ true
25
18
  end
26
19
 
27
20
  private
28
21
 
29
- attr_reader :configuration
30
-
31
22
  def run
32
23
  success = false
33
24
 
34
- configuration.project_root.change_dir do
25
+ settings.project_root.change_dir do
35
26
  STDOUT.squelch { success = kernel.system "command -v npm && npm install" }
36
27
  end
37
28
 
@@ -74,7 +74,7 @@ jobs:
74
74
  bin/hanami assets compile
75
75
  bundle exec rake
76
76
 
77
- <% if configuration.build_simple_cov %>
77
+ <% if settings.build_simple_cov %>
78
78
  - store_artifacts:
79
79
  name: SimpleCov Archive
80
80
  path: ~/project/coverage
@@ -58,7 +58,7 @@ jobs:
58
58
  bin/hanami assets compile
59
59
  bundle exec rake
60
60
 
61
- <% if configuration.build_simple_cov %>
61
+ <% if settings.build_simple_cov %>
62
62
  - name: SimpleCov Archive
63
63
  uses: actions/upload-artifact@v4
64
64
  with:
@@ -1 +1 @@
1
- 21.7.2
1
+ 22.3.0
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "<%= configuration.project_label %>",
3
- "short_name": "<%= configuration.project_label %>",
2
+ "name": "<%= settings.project_label %>",
3
+ "short_name": "<%= settings.project_label %>",
4
4
  "description": "A Hanamismith skeleton application.",
5
5
  "icons": [
6
6
  {
@@ -34,8 +34,8 @@ Hanami.app.register_provider :persistence, namespace: true do
34
34
  configuration = target["persistence.config"]
35
35
 
36
36
  configuration.auto_registration(
37
- target.root.join("lib/<%= configuration.project_path %>/persistence"),
38
- namespace: "<%= configuration.project_namespaced_class %>::Persistence"
37
+ target.root.join("lib/<%= settings.project_path %>/persistence"),
38
+ namespace: "<%= settings.project_namespaced_class %>::Persistence"
39
39
  )
40
40
 
41
41
  register "rom", ROM.container(configuration)
@@ -1 +1 @@
1
- DATABASE_URL=postgres://localhost/<%= configuration.project_name %>_development
1
+ DATABASE_URL=postgres://localhost/<%= settings.project_name %>_development
@@ -1 +1 @@
1
- DATABASE_URL=postgres://localhost/<%= configuration.project_name %>_test
1
+ DATABASE_URL=postgres://localhost/<%= settings.project_name %>_test
@@ -1,9 +1,9 @@
1
1
  {
2
- "name": "<%= configuration.project_name %>",
2
+ "name": "<%= settings.project_name %>",
3
3
  "description": "",
4
- "version": "<%= configuration.project_version %>",
5
- "author": "<%= configuration.author_name %>",
6
- "license": "<%= configuration.license_label_version %>",
4
+ "version": "<%= settings.project_version %>",
5
+ "author": "<%= settings.author_name %>",
6
+ "license": "<%= settings.license_label_version %>",
7
7
  "private": true,
8
8
  "type": "module",
9
9
  "keywords": ["ruby", "hanami"],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Health
4
4
  # The health action.
5
- class Action < <%= configuration.project_namespaced_class %>::Action
5
+ class Action < <%= settings.project_namespaced_class %>::Action
6
6
  end
7
7
  end
@@ -12,12 +12,12 @@
12
12
  <meta name="apple-mobile-web-app-capable" content="yes">
13
13
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
 
15
- <link title="<%= configuration.project_label %>: Favorite Icon"
15
+ <link title="<%= settings.project_label %>: Favorite Icon"
16
16
  rel="icon"
17
17
  href="https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
18
18
  sizes="32x32">
19
19
  <!-- favicon -->
20
- <link title="<%= configuration.project_label %>: Apple Icon"
20
+ <link title="<%= settings.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">
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Health
4
4
  # The health view.
5
- class View < <%= configuration.project_namespaced_class %>::View
5
+ class View < <%= settings.project_namespaced_class %>::View
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Home
4
4
  # The home action.
5
- class Action < <%= configuration.project_namespaced_class %>::Action
5
+ class Action < <%= settings.project_namespaced_class %>::Action
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Home
4
4
  # The home repository.
5
- class Repository < <%= configuration.project_namespaced_class %>::Repository
5
+ class Repository < <%= settings.project_namespaced_class %>::Repository
6
6
  end
7
7
  end
@@ -12,12 +12,12 @@
12
12
  <meta name="apple-mobile-web-app-capable" content="yes">
13
13
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
14
14
 
15
- <link title="<%= configuration.project_label %>: Favorite Icon"
15
+ <link title="<%= settings.project_label %>: Favorite Icon"
16
16
  rel="icon"
17
17
  href="https://alchemists.io/images/projects/hanamismith/icons/favicon.ico"
18
18
  sizes="32x32">
19
19
  <!-- favicon -->
20
- <link title="<%= configuration.project_label %>: Apple Icon"
20
+ <link title="<%= settings.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">