hanamismith 0.11.0 → 0.13.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: 9495f46a35b4c636e1aa31cc30ac62805938535d900d7e73ac5ce862de029792
4
- data.tar.gz: e483663fcb255a0a8a3303ebcc30ea4b1264f2190c7393ed2397fa1a22ca55ca
3
+ metadata.gz: 47bf0239adc52e6e2da05a01b326ceef8effb373c6e4702991df1be9e9b7a240
4
+ data.tar.gz: b3dcbce49b7f71d432dc1bd71114698faeaa1ab302a0a99dd6b385a0e5e935e6
5
5
  SHA512:
6
- metadata.gz: 4d0335e2b89fa3d90e4b8ae13c875bfa0318068530828c3c4b03dc5b99e6b846e89fe544c621eed051c5cffb1ffccd64187078c60c0cc3e81c0cb2c2b2e8559a
7
- data.tar.gz: ad854bb6afb4e0cc76da05c731483d2f970ab4ec9ac7fc6e08c357f9524c3de5fdd50207f641d3f592b7ddfcb2bc1738c58ad75870457e30ee0ca5bb1f50c12a
6
+ metadata.gz: 369db955e956f10c8beb26216f5b9cf9506f73f0da28f6d18fd266e271cbd735ee790790de423c80174889ed9d4955ac4cd55d3702320d3108ad7935add48d46
7
+ data.tar.gz: 2f9a1980c530ba1e7f54c35185796ab2f986f057d716d82f86bdf66828445bf21d59c2bae00fa47ea485f66dded605b1a1d07444da039dd7b455d691c3092736
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -24,7 +24,7 @@ If you're looking for new ways to build maintainable, secure, faster and testabl
24
24
  Whether you're a total beginner or an experienced developer, *this learning process may still be hard*. Over time, we become used to certain things, and it can be painful to change. *But without change, there is no challenge* and without challenge, there is no growth.
25
25
  ____
26
26
 
27
- Welcome to the modern age of web development! This gem will help you get up and running as quickly as possible. 🚀
27
+ Welcome to the modern age of web development. This gem will help you get up and running as quickly as possible. 🚀
28
28
 
29
29
  toc::[]
30
30
 
@@ -72,47 +72,21 @@ gem install hanamismith
72
72
  From the command line, type: `hanamismith --help`
73
73
 
74
74
  ....
75
- USAGE:
76
- -b, --build NAME [options] Build new project.
77
- -c, --config ACTION Manage gem configuration: edit or view.
78
- -h, --help Show this message.
79
- -v, --version Show gem version.
80
-
81
- BUILD OPTIONS:
82
- --[no-]amazing_print Add Amazing Print gem. Default: true.
83
- --[no-]caliber Add Caliber gem. Default: true.
84
- --[no-]circle_ci Add Circle CI configuration and badge. Default: false.
85
- --[no-]citation Add citation documentation. Default: true.
86
- --[no-]community Add community documentation. Default: false.
87
- --[no-]conduct Add code of conduct documentation. Default: true.
88
- --[no-]console Add console script. Default: true.
89
- --[no-]contributions Add contributions documentation. Default: true.
90
- --[no-]debug Add Debug gem. Default: true.
91
- --[no-]funding Add GitHub funding configuration. Default: false.
92
- --[no-]git Add Git. Default: true.
93
- --[no-]git_hub Add GitHub templates. Default: false.
94
- --[no-]git_hub_ci Add GitHub templates. Default: false.
95
- --[no-]git-lint Add Git Lint gem. Default: true.
96
- --[no-]guard Add Guard gem. Default: true.
97
- --[no-]license Add license documentation. Default: true.
98
- --max Use maximum/enabled options. Default: false.
99
- --min Use minimum/disabled options. Default: false.
100
- --[no-]rake Add Rake gem. Default: true.
101
- --[no-]readme Add readme documentation. Default: true.
102
- --[no-]reek Add Reek gem. Default: true.
103
- --[no-]refinements Add Refinements gem. Default: true.
104
- --[no-]rspec Add RSpec gem. Default: true.
105
- --[no-]security Add security. Default: true.
106
- --[no-]setup Add setup script. Default: true.
107
- --[no-]simple_cov Add SimpleCov gem. Default: true.
108
- --[no-]versions Add version history. Default: true.
109
- --[no-]yard Add Yard gem. Default: false.
110
- --[no-]zeitwerk Add Zeitwerk gem. Default: true.
75
+ USAGE
76
+ hanamismith [OPTIONS]
77
+ hanamismith COMMAND [OPTIONS]
78
+
79
+ OPTIONS
80
+ -v, --version Show version.
81
+ -h, --help [COMMAND] Show this message.
82
+
83
+ COMMANDS
84
+ config Manage configuration.
85
+ Path is dynamic per current directory.
86
+ build Build new project.
111
87
  ....
112
88
 
113
- 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.
114
-
115
- ℹī¸ 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.
89
+ 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.
116
90
 
117
91
  === Configuration
118
92
 
@@ -126,9 +100,7 @@ It can also be configured via link:https://alchemists.io/projects/xdg[XDG] envir
126
100
  variables.
127
101
 
128
102
  The default configuration is everything provided in the
129
- link:https://alchemists.io/projects/rubysmith/#_configuration[Rubysmith].
130
-
131
- 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:
103
+ link:https://alchemists.io/projects/rubysmith/#_configuration[Rubysmith]. It is recommended that you provide common URLs for your project which would be all keys found in this section:
132
104
 
133
105
  [source,yaml]
134
106
  ----
@@ -146,7 +118,7 @@ When implementing and testing your project locally, a typical workflow might be:
146
118
  [source,bash]
147
119
  ----
148
120
  # Build new project
149
- hanamismith --build demo
121
+ hanamismith build --name demo
150
122
 
151
123
  # Run code quality and test coverage checks
152
124
  cd demo
@@ -183,8 +155,8 @@ For link:https://www.gnu.org/software/bash[Bash] users -- or other shell users -
183
155
 
184
156
  [source,bash]
185
157
  ----
186
- alias hsb="hanamismith --build"
187
- alias hse="hanamismith --config edit"
158
+ alias hsb="hanamismith build --name"
159
+ alias hse="hanamismith config --edit"
188
160
  alias hsh="hanamismith --help"
189
161
  ----
190
162
 
@@ -196,10 +168,6 @@ For a fully working demonstration application -- as built by this gem -- check o
196
168
 
197
169
  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]
198
170
 
199
- 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:
200
-
201
- video::V4QPZi3j7uY[youtube,role=video]
202
-
203
171
  == Development
204
172
 
205
173
  To contribute, run:
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.11.0"
5
+ spec.version = "0.13.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/hanamismith"
@@ -23,17 +23,19 @@ Gem::Specification.new do |spec|
23
23
  spec.cert_chain = [Gem.default_cert_path]
24
24
 
25
25
  spec.required_ruby_version = "~> 3.2"
26
- spec.add_dependency "cogger", "~> 0.8"
27
- spec.add_dependency "core", "~> 0.1"
26
+ spec.add_dependency "cogger", "~> 0.10"
28
27
  spec.add_dependency "dry-container", "~> 0.11"
29
28
  spec.add_dependency "dry-monads", "~> 1.6"
29
+ spec.add_dependency "dry-schema", "~> 1.13"
30
+ spec.add_dependency "etcher", "~> 0.2"
30
31
  spec.add_dependency "hanami", "~> 2.0"
31
- spec.add_dependency "htmx", "~> 0.0"
32
- spec.add_dependency "infusible", "~> 1.0"
33
- spec.add_dependency "refinements", "~> 10.0"
34
- spec.add_dependency "rubysmith", "~> 4.9"
35
- spec.add_dependency "runcom", "~> 9.0"
36
- spec.add_dependency "spek", "~> 1.1"
32
+ spec.add_dependency "htmx", "~> 0.2"
33
+ spec.add_dependency "infusible", "~> 2.0"
34
+ spec.add_dependency "refinements", "~> 11.0"
35
+ spec.add_dependency "rubysmith", "~> 5.2"
36
+ spec.add_dependency "runcom", "~> 10.0"
37
+ spec.add_dependency "sod", "~> 0.0"
38
+ spec.add_dependency "spek", "~> 2.0"
37
39
  spec.add_dependency "zeitwerk", "~> 2.6"
38
40
 
39
41
  spec.bindir = "exe"
@@ -28,41 +28,48 @@ module Hanamismith
28
28
  # rubocop:todo Metrics/MethodLength
29
29
  def insert_main_dependencies
30
30
  with_template.insert_after("source", %(gem "dry-types", "~> 1.7"))
31
- .insert_after("source", %(gem "erbse", "~> 0.1"\n))
32
- .insert_after("source", %(gem "hanami", "~> 2.0"\n))
33
- .insert_after("source", %(gem "hanami-controller", "~> 2.0"\n))
34
31
  .insert_after(
35
32
  "source",
36
- %(gem "hanami-helpers", github: "hanami/helpers", branch: "main"\n)
33
+ %(gem "hanami", github: "hanami/hanami", branch: "main"\n)
34
+ )
35
+ .insert_after(
36
+ "source",
37
+ %(gem "hanami-controller", github: "hanami/controller", branch: "main"\n)
38
+ )
39
+ .insert_after(
40
+ "source",
41
+ %(gem "hanami-router", github: "hanami/router", branch: "main"\n)
42
+ )
43
+ .insert_after(
44
+ "source",
45
+ %(gem "hanami-validations", github: "hanami/validations", branch: "main"\n)
37
46
  )
38
- .insert_after("source", %(gem "hanami-router", "~> 2.0"\n))
39
- .insert_after("source", %(gem "hanami-validations", "~> 2.0"\n))
40
47
  .insert_after(
41
48
  "source",
42
49
  %(gem "hanami-view", github: "hanami/view", branch: "main"\n)
43
50
  )
44
- .insert_after("source", %(gem "htmx", "~> 0.0"\n))
45
- .insert_after("source", %(gem "puma", "~> 6.0"\n))
51
+ .insert_after("source", %(gem "htmx", "~> 0.1"\n))
52
+ .insert_after("source", %(gem "puma", "~> 6.3"\n))
46
53
  .insert_after("source", %(gem "rack-attack", "~> 6.6"\n))
47
54
  end
48
55
  # rubocop:enable Metrics/MethodLength
49
56
 
50
57
  def insert_persistence_dependencies
51
- with_template.insert_after("source", %(gem "pg", "~> 1.4"\n))
58
+ with_template.insert_after("source", %(gem "pg", "~> 1.5"\n))
52
59
  .insert_after("source", %(gem "rom", "~> 5.3"\n))
53
60
  .insert_after("source", %(gem "rom-sql", "~> 3.6"\n))
54
- .insert_after("source", %(\ngem "sequel", "~> 5.64"\n))
61
+ .insert_after("source", %(\ngem "sequel", "~> 5.68"\n))
55
62
  end
56
63
 
57
64
  def alter_groups
58
65
  with_template.insert_after(/group :code_quality/, %( gem "rubocop-sequel", "~> 0.3"\n))
59
66
  .insert_after(/group :development do/, %( gem "localhost", "~> 1.1"\n))
60
67
  .insert_after(/group :development do/, %( gem "rerun", "~> 0.14"\n))
61
- .insert_after(/group :test/, %( gem "capybara", "~> 3.38"\n))
68
+ .insert_after(/group :test/, %( gem "capybara", "~> 3.39"\n))
62
69
  .insert_after(/group :test/, %( gem "cuprite", "~> 0.14"\n))
63
70
  .insert_after(/group :test/, %( gem "database_cleaner-sequel", "~> 2.0"\n))
64
71
  .insert_after(/group :test/, %( gem "launchy", "~> 2.5"\n))
65
- .insert_after(/group :test/, %( gem "rack-test", "~> 2.0"\n))
72
+ .insert_after(/group :test/, %( gem "rack-test", "~> 2.1"\n))
66
73
  .insert_after(/group :test/, %( gem "rom-factory", "~> 0.11"\n))
67
74
  end
68
75
 
@@ -83,12 +90,12 @@ module Hanamismith
83
90
 
84
91
  with_template.append <<~CONTENT
85
92
  group :test do
86
- gem "capybara", "~> 3.38"
93
+ gem "capybara", "~> 3.39"
87
94
  gem "cuprite", "~> 0.14"
88
95
  gem "database_cleaner-sequel", "~> 2.0"
89
96
  gem "hanami-rspec", "~> 2.0"
90
97
  gem "launchy", "~> 2.5"
91
- gem "rack-test", "~> 2.0"
98
+ gem "rack-test", "~> 2.1"
92
99
  gem "rom-factory", "~> 0.11"
93
100
  end
94
101
  CONTENT
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sod"
4
+
5
+ module Hanamismith
6
+ module CLI
7
+ module Commands
8
+ # Handles the build command.
9
+ class Build < Sod::Command
10
+ include Hanamismith::Import[:input, :logger]
11
+
12
+ # Order is important.
13
+ # rubocop:todo Metrics/CollectionLiteralLength
14
+ BUILDERS = [
15
+ Rubysmith::Builders::Init,
16
+ Builders::Core,
17
+ Builders::Providers::Persistence,
18
+ Builders::Refinement,
19
+ Builders::Stylesheet,
20
+ Builders::HTMX,
21
+ Builders::Slices::Main,
22
+ Builders::Slices::Health,
23
+ Rubysmith::Builders::Version,
24
+ Builders::Documentation::Readme,
25
+ Rubysmith::Builders::Documentation::Citation,
26
+ Rubysmith::Builders::Documentation::License,
27
+ Rubysmith::Builders::Documentation::Version,
28
+ Rubysmith::Builders::Git::Setup,
29
+ Rubysmith::Builders::Git::Ignore,
30
+ Rubysmith::Builders::Git::Safe,
31
+ Builders::Bundler,
32
+ Builders::Rake,
33
+ Builders::Binstub,
34
+ Builders::Console,
35
+ Builders::CI::Circle,
36
+ Builders::CI::GitHub,
37
+ Rubysmith::Builders::Setup,
38
+ Rubysmith::Builders::GitHub,
39
+ Builders::Guard,
40
+ Rubysmith::Builders::Reek,
41
+ Rubysmith::Builders::RSpec::Binstub,
42
+ Rubysmith::Builders::RSpec::Context,
43
+ Builders::RSpec::ApplicationSharedContext,
44
+ Builders::RSpec::Database,
45
+ Builders::RSpec::Factory,
46
+ Builders::RSpec::Helper,
47
+ Builders::RSpec::Hanami,
48
+ Builders::Rack,
49
+ Builders::Puma::Configuration,
50
+ Builders::Puma::Procfile,
51
+ Builders::Caliber,
52
+ Rubysmith::Extensions::Bundler,
53
+ Rubysmith::Extensions::Pragmater,
54
+ Rubysmith::Extensions::Tocer,
55
+ Rubysmith::Extensions::Rubocop,
56
+ Builders::Environments::Development,
57
+ Builders::Environments::Test,
58
+ Builders::Git::Commit
59
+ ].freeze
60
+ # rubocop:enable Metrics/CollectionLiteralLength
61
+
62
+ handle "build"
63
+
64
+ description "Build new project."
65
+
66
+ on Rubysmith::CLI::Actions::Name, input: Container[:input]
67
+ on Rubysmith::CLI::Actions::AmazingPrint, input: Container[:input]
68
+ on Rubysmith::CLI::Actions::Caliber, input: Container[:input]
69
+ on Rubysmith::CLI::Actions::CircleCI, input: Container[:input]
70
+ on Rubysmith::CLI::Actions::Citation, input: Container[:input]
71
+ on Rubysmith::CLI::Actions::Community, input: Container[:input]
72
+ on Rubysmith::CLI::Actions::Conduct, input: Container[:input]
73
+ on Rubysmith::CLI::Actions::Console, input: Container[:input]
74
+ on Rubysmith::CLI::Actions::Contributions, input: Container[:input]
75
+ on Rubysmith::CLI::Actions::Debug, input: Container[:input]
76
+ on Rubysmith::CLI::Actions::Funding, input: Container[:input]
77
+ on Rubysmith::CLI::Actions::Git, input: Container[:input]
78
+ on Rubysmith::CLI::Actions::GitHub, input: Container[:input]
79
+ on Rubysmith::CLI::Actions::GitHubCI, input: Container[:input]
80
+ on Rubysmith::CLI::Actions::GitLint, input: Container[:input]
81
+ on Rubysmith::CLI::Actions::Guard, input: Container[:input]
82
+ on Rubysmith::CLI::Actions::License, input: Container[:input]
83
+ on Rubysmith::CLI::Actions::Maximum, input: Container[:input]
84
+ on Rubysmith::CLI::Actions::Minimum, input: Container[:input]
85
+ on Rubysmith::CLI::Actions::Rake, input: Container[:input]
86
+ on Rubysmith::CLI::Actions::Readme, input: Container[:input]
87
+ on Rubysmith::CLI::Actions::Reek, input: Container[:input]
88
+ on Rubysmith::CLI::Actions::Refinements, input: Container[:input]
89
+ on Rubysmith::CLI::Actions::RSpec, input: Container[:input]
90
+ on Rubysmith::CLI::Actions::Security, input: Container[:input]
91
+ on Rubysmith::CLI::Actions::Setup, input: Container[:input]
92
+ on Rubysmith::CLI::Actions::SimpleCov, input: Container[:input]
93
+ on Rubysmith::CLI::Actions::Versions, input: Container[:input]
94
+ on Rubysmith::CLI::Actions::Yard, input: Container[:input]
95
+
96
+ def initialize(builders: BUILDERS, **)
97
+ super(**)
98
+ @builders = builders
99
+ end
100
+
101
+ def call
102
+ log_info "Building project skeleton: #{input.project_name}..."
103
+ builders.each { |builder| builder.call input }
104
+ log_info "Project skeleton complete!"
105
+ end
106
+
107
+ private
108
+
109
+ attr_reader :builders
110
+
111
+ def log_info(message) = logger.info { message }
112
+ end
113
+ end
114
+ end
115
+ end
@@ -1,36 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "core"
3
+ require "sod"
4
4
 
5
5
  module Hanamismith
6
6
  module CLI
7
7
  # The main Command Line Interface (CLI) object.
8
8
  class Shell
9
- include Actions::Import[:config, :build, :kernel, :logger, :specification]
9
+ include Import[:defaults_path, :xdg_config, :specification]
10
10
 
11
- def initialize(parser: Parser.new, **)
11
+ def initialize(context: Sod::Context, dsl: Sod, **)
12
12
  super(**)
13
- @parser = parser
13
+ @context = context
14
+ @dsl = dsl
14
15
  end
15
16
 
16
- def call arguments = Core::EMPTY_ARRAY
17
- act_on parser.call(arguments)
18
- rescue OptionParser::ParseError => error
19
- logger.error { error.message }
20
- end
17
+ def call(...) = cli.call(...)
21
18
 
22
19
  private
23
20
 
24
- attr_reader :parser
21
+ attr_reader :context, :dsl
22
+
23
+ # :reek:TooManyStatements
24
+ def cli
25
+ context = build_context
25
26
 
26
- def act_on configuration
27
- case configuration
28
- in action_build: true then build.call configuration
29
- in action_config: Symbol => action then config.call action
30
- in action_version: true then kernel.puts specification.labeled_version
31
- else kernel.puts parser.to_s
27
+ dsl.new :hanamismith, banner: specification.banner do
28
+ on(Sod::Prefabs::Commands::Config, context:)
29
+ on Commands::Build
30
+ on(Sod::Prefabs::Actions::Version, context:)
31
+ on Sod::Prefabs::Actions::Help, self
32
32
  end
33
33
  end
34
+
35
+ def build_context
36
+ context[defaults_path:, xdg_config:, version_label: specification.labeled_version]
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "cogger"
4
- require "dry/container"
4
+ require "dry-container"
5
+ require "etcher"
6
+ require "runcom"
5
7
  require "spek"
6
8
 
7
9
  module Hanamismith
@@ -9,7 +11,32 @@ module Hanamismith
9
11
  module Container
10
12
  extend Dry::Container::Mixin
11
13
 
12
- register(:configuration) { Configuration::Loader.call }
14
+ register :configuration do
15
+ self[:defaults].add_loader(Etcher::Loaders::YAML.new(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
22
+
23
+ registry.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
24
+ .add_transformer(Rubysmith::Configuration::Transformers::CurrentTime)
25
+ .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
26
+ .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
27
+ .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
28
+ .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new)
29
+ .add_transformer(
30
+ Rubysmith::Configuration::Transformers::TemplateRoot.new(
31
+ Pathname(__dir__).join("templates")
32
+ )
33
+ )
34
+ .add_transformer(Rubysmith::Configuration::Transformers::TargetRoot)
35
+ end
36
+
37
+ register(:input, memoize: true) { self[:configuration].dup }
38
+ register(:defaults_path) { Rubysmith::Container[:defaults_path] }
39
+ register(:xdg_config) { Runcom::Config.new "hanamismith/configuration.yml" }
13
40
  register(:specification) { Spek::Loader.call "#{__dir__}/../../hanamismith.gemspec" }
14
41
  register(:kernel) { Kernel }
15
42
  register(:logger) { Cogger.new formatter: :emoji }
@@ -1,6 +1,5 @@
1
1
  # auto_register: false
2
2
 
3
- require "erbse"
4
3
  require "hanami/view"
5
4
 
6
5
  <% namespace do %>
@@ -3,9 +3,7 @@
3
3
  <head>
4
4
  <title><%= configuration.project_label %></title>
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
-
7
6
  <link title="<%= configuration.project_label %> - Stylesheet" rel="stylesheet" href="/stylesheets/site.css" type="text/css">
8
-
9
7
  <script src="/javascripts/htmx.js"></script>
10
8
  </head>
11
9
 
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.11.0
4
+ version: 0.13.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-05-20 00:00:00.000000000 Z
38
+ date: 2023-06-19 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -43,56 +43,70 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.8'
46
+ version: '0.10'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.8'
53
+ version: '0.10'
54
54
  - !ruby/object:Gem::Dependency
55
- name: core
55
+ name: dry-container
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.1'
60
+ version: '0.11'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.1'
67
+ version: '0.11'
68
68
  - !ruby/object:Gem::Dependency
69
- name: dry-container
69
+ name: dry-monads
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0.11'
74
+ version: '1.6'
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0.11'
81
+ version: '1.6'
82
82
  - !ruby/object:Gem::Dependency
83
- name: dry-monads
83
+ name: dry-schema
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '1.6'
88
+ version: '1.13'
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '1.6'
95
+ version: '1.13'
96
+ - !ruby/object:Gem::Dependency
97
+ name: etcher
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.2'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.2'
96
110
  - !ruby/object:Gem::Dependency
97
111
  name: hanami
98
112
  requirement: !ruby/object:Gem::Requirement
@@ -113,84 +127,98 @@ dependencies:
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '0.0'
130
+ version: '0.2'
117
131
  type: :runtime
118
132
  prerelease: false
119
133
  version_requirements: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: '0.0'
137
+ version: '0.2'
124
138
  - !ruby/object:Gem::Dependency
125
139
  name: infusible
126
140
  requirement: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: '1.0'
144
+ version: '2.0'
131
145
  type: :runtime
132
146
  prerelease: false
133
147
  version_requirements: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: '1.0'
151
+ version: '2.0'
138
152
  - !ruby/object:Gem::Dependency
139
153
  name: refinements
140
154
  requirement: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: '10.0'
158
+ version: '11.0'
145
159
  type: :runtime
146
160
  prerelease: false
147
161
  version_requirements: !ruby/object:Gem::Requirement
148
162
  requirements:
149
163
  - - "~>"
150
164
  - !ruby/object:Gem::Version
151
- version: '10.0'
165
+ version: '11.0'
152
166
  - !ruby/object:Gem::Dependency
153
167
  name: rubysmith
154
168
  requirement: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
- version: '4.9'
172
+ version: '5.2'
159
173
  type: :runtime
160
174
  prerelease: false
161
175
  version_requirements: !ruby/object:Gem::Requirement
162
176
  requirements:
163
177
  - - "~>"
164
178
  - !ruby/object:Gem::Version
165
- version: '4.9'
179
+ version: '5.2'
166
180
  - !ruby/object:Gem::Dependency
167
181
  name: runcom
168
182
  requirement: !ruby/object:Gem::Requirement
169
183
  requirements:
170
184
  - - "~>"
171
185
  - !ruby/object:Gem::Version
172
- version: '9.0'
186
+ version: '10.0'
173
187
  type: :runtime
174
188
  prerelease: false
175
189
  version_requirements: !ruby/object:Gem::Requirement
176
190
  requirements:
177
191
  - - "~>"
178
192
  - !ruby/object:Gem::Version
179
- version: '9.0'
193
+ version: '10.0'
194
+ - !ruby/object:Gem::Dependency
195
+ name: sod
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '0.0'
201
+ type: :runtime
202
+ prerelease: false
203
+ version_requirements: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '0.0'
180
208
  - !ruby/object:Gem::Dependency
181
209
  name: spek
182
210
  requirement: !ruby/object:Gem::Requirement
183
211
  requirements:
184
212
  - - "~>"
185
213
  - !ruby/object:Gem::Version
186
- version: '1.1'
214
+ version: '2.0'
187
215
  type: :runtime
188
216
  prerelease: false
189
217
  version_requirements: !ruby/object:Gem::Requirement
190
218
  requirements:
191
219
  - - "~>"
192
220
  - !ruby/object:Gem::Version
193
- version: '1.1'
221
+ version: '2.0'
194
222
  - !ruby/object:Gem::Dependency
195
223
  name: zeitwerk
196
224
  requirement: !ruby/object:Gem::Requirement
@@ -247,16 +275,8 @@ files:
247
275
  - lib/hanamismith/builders/slices/health.rb
248
276
  - lib/hanamismith/builders/slices/main.rb
249
277
  - lib/hanamismith/builders/stylesheet.rb
250
- - lib/hanamismith/cli/actions/build.rb
251
- - lib/hanamismith/cli/actions/config.rb
252
- - lib/hanamismith/cli/actions/container.rb
253
- - lib/hanamismith/cli/actions/import.rb
254
- - lib/hanamismith/cli/parser.rb
255
- - lib/hanamismith/cli/parsers/core.rb
278
+ - lib/hanamismith/cli/commands/build.rb
256
279
  - lib/hanamismith/cli/shell.rb
257
- - lib/hanamismith/configuration/content.rb
258
- - lib/hanamismith/configuration/defaults.yml
259
- - lib/hanamismith/configuration/loader.rb
260
280
  - lib/hanamismith/container.rb
261
281
  - lib/hanamismith/import.rb
262
282
  - lib/hanamismith/templates/%project_name%/.circleci/config.yml.erb
@@ -320,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
340
  - !ruby/object:Gem::Version
321
341
  version: '0'
322
342
  requirements: []
323
- rubygems_version: 3.4.13
343
+ rubygems_version: 3.4.14
324
344
  signing_key:
325
345
  specification_version: 4
326
346
  summary: A command line interface for smithing Hanami projects.
metadata.gz.sig CHANGED
Binary file
@@ -1,78 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanamismith
4
- module CLI
5
- module Actions
6
- # Handles the build action.
7
- class Build
8
- include Hanamismith::Import[:logger]
9
-
10
- # Order is important.
11
- # rubocop:todo Metrics/CollectionLiteralLength
12
- BUILDERS = [
13
- Builders::Core,
14
- Builders::Providers::Persistence,
15
- Builders::Refinement,
16
- Builders::Stylesheet,
17
- Builders::HTMX,
18
- Builders::Slices::Main,
19
- Builders::Slices::Health,
20
- Rubysmith::Builders::Version,
21
- Builders::Documentation::Readme,
22
- Rubysmith::Builders::Documentation::Citation,
23
- Rubysmith::Builders::Documentation::License,
24
- Rubysmith::Builders::Documentation::Version,
25
- Rubysmith::Builders::Git::Setup,
26
- Rubysmith::Builders::Git::Ignore,
27
- Rubysmith::Builders::Git::Safe,
28
- Builders::Bundler,
29
- Builders::Rake,
30
- Builders::Binstub,
31
- Builders::Console,
32
- Builders::CI::Circle,
33
- Builders::CI::GitHub,
34
- Rubysmith::Builders::Setup,
35
- Rubysmith::Builders::GitHub,
36
- Builders::Guard,
37
- Rubysmith::Builders::Reek,
38
- Rubysmith::Builders::RSpec::Binstub,
39
- Rubysmith::Builders::RSpec::Context,
40
- Builders::RSpec::ApplicationSharedContext,
41
- Builders::RSpec::Database,
42
- Builders::RSpec::Factory,
43
- Builders::RSpec::Helper,
44
- Builders::RSpec::Hanami,
45
- Builders::Rack,
46
- Builders::Puma::Configuration,
47
- Builders::Puma::Procfile,
48
- Builders::Caliber,
49
- Rubysmith::Extensions::Bundler,
50
- Rubysmith::Extensions::Pragmater,
51
- Rubysmith::Extensions::Tocer,
52
- Rubysmith::Extensions::Rubocop,
53
- Builders::Environments::Development,
54
- Builders::Environments::Test,
55
- Builders::Git::Commit
56
- ].freeze
57
- # rubocop:enable Metrics/CollectionLiteralLength
58
-
59
- def initialize(builders: BUILDERS, **)
60
- super(**)
61
- @builders = builders
62
- end
63
-
64
- def call configuration
65
- log_info "Building project skeleton: #{configuration.project_name}..."
66
- builders.each { |builder| builder.call configuration }
67
- log_info "Project skeleton complete!"
68
- end
69
-
70
- private
71
-
72
- attr_reader :builders
73
-
74
- def log_info(message) = logger.info { message }
75
- end
76
- end
77
- end
78
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanamismith
4
- module CLI
5
- module Actions
6
- # Handles the config action.
7
- class Config
8
- include Hanamismith::Import[:kernel, :logger]
9
-
10
- def initialize(client: Configuration::Loader::CLIENT, **)
11
- super(**)
12
- @client = client
13
- end
14
-
15
- def call selection
16
- case selection
17
- when :edit then edit
18
- when :view then view
19
- else logger.error { "Invalid configuration selection: #{selection}." }
20
- end
21
- end
22
-
23
- private
24
-
25
- attr_reader :client
26
-
27
- def edit = kernel.system("$EDITOR #{client.current}")
28
-
29
- def view = kernel.system("cat #{client.current}")
30
- end
31
- end
32
- end
33
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/container"
4
-
5
- module Hanamismith
6
- module CLI
7
- module Actions
8
- # Provides a single container of application and action specific dependencies.
9
- module Container
10
- extend Dry::Container::Mixin
11
-
12
- merge Hanamismith::Container
13
-
14
- register(:build) { Build.new }
15
- register(:config) { Config.new }
16
- end
17
- end
18
- end
19
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "infusible"
4
-
5
- module Hanamismith
6
- module CLI
7
- module Actions
8
- Import = Infusible.with Container
9
- end
10
- end
11
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "core"
4
- require "optparse"
5
-
6
- module Hanamismith
7
- module CLI
8
- # Assembles and parses all Command Line Interface (CLI) options.
9
- class Parser
10
- include Import[:configuration]
11
-
12
- CLIENT = OptionParser.new nil, 40, " "
13
-
14
- # Order is important.
15
- SECTIONS = [Parsers::Core, Rubysmith::CLI::Parsers::Build].freeze
16
-
17
- def initialize(sections: SECTIONS, client: CLIENT, **)
18
- super(**)
19
- @sections = sections
20
- @client = client
21
- @configuration_duplicate = configuration.dup
22
- end
23
-
24
- def call arguments = Core::EMPTY_ARRAY
25
- sections.each { |section| section.call configuration_duplicate, client: }
26
- client.parse arguments
27
- configuration_duplicate.freeze
28
- end
29
-
30
- def to_s = client.to_s
31
-
32
- private
33
-
34
- attr_reader :sections, :client, :configuration_duplicate
35
- end
36
- end
37
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "core"
4
- require "refinements/structs"
5
-
6
- module Hanamismith
7
- module CLI
8
- module Parsers
9
- # Handles parsing of Command Line Interface (CLI) core options.
10
- class Core
11
- include Import[:specification]
12
-
13
- using Refinements::Structs
14
-
15
- def self.call(...) = new(...).call
16
-
17
- def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **)
18
- super(**)
19
- @configuration = configuration
20
- @client = client
21
- end
22
-
23
- def call arguments = ::Core::EMPTY_ARRAY
24
- client.banner = specification.labeled_summary
25
- client.separator "\nUSAGE:\n"
26
- collate
27
- client.parse arguments
28
- configuration
29
- end
30
-
31
- private
32
-
33
- attr_reader :configuration, :client
34
-
35
- def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
36
-
37
- def add_build
38
- client.on "-b", "--build NAME [options]", "Build new project." do |name|
39
- configuration.merge! action_build: true, project_name: name
40
- end
41
- end
42
-
43
- def add_config
44
- client.on "-c",
45
- "--config ACTION",
46
- %i[edit view],
47
- "Manage gem configuration: edit or view." do |action|
48
- configuration.merge! action_config: action
49
- end
50
- end
51
-
52
- def add_version
53
- client.on "-v", "--version", "Show gem version." do
54
- configuration.merge! action_version: true
55
- end
56
- end
57
-
58
- def add_help
59
- client.on "-h", "--help", "Show this message." do
60
- configuration.merge! action_help: true
61
- end
62
- end
63
- end
64
- end
65
- end
66
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanamismith
4
- module Configuration
5
- # Defines the content of the configuration for use throughout the gem.
6
- Content = Struct.new(
7
- :action_config,
8
- :action_help,
9
- :action_version,
10
- keyword_init: true
11
- ) do
12
- def initialize *arguments
13
- super
14
- freeze
15
- end
16
- end
17
- end
18
- end
File without changes
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "runcom"
4
-
5
- module Hanamismith
6
- module Configuration
7
- # Represents the fully assembled Command Line Interface (CLI) configuration.
8
- class Loader < Rubysmith::Configuration::Loader
9
- DEFAULTS = Rubysmith::Configuration::Loader::DEFAULTS
10
- CLIENT = Runcom::Config.new "hanamismith/configuration.yml", defaults: DEFAULTS
11
-
12
- def self.with_overrides
13
- new client: DEFAULTS,
14
- enhancers: {template_root: Rubysmith::Configuration::Enhancers::TemplateRoot}
15
- end
16
-
17
- def initialize(client: CLIENT, **) = super
18
-
19
- def call
20
- return super unless enhancers.key? :template_root
21
-
22
- enhancers[:template_root].call(super, overrides: Pathname(__dir__).join("../templates"))
23
- .freeze
24
- end
25
- end
26
- end
27
- end