hanamismith 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +2 -0
  3. data/LICENSE.adoc +134 -0
  4. data/README.adoc +206 -0
  5. data/exe/hanamismith +6 -0
  6. data/hanamismith.gemspec +42 -0
  7. data/lib/hanamismith/builders/binstub.rb +31 -0
  8. data/lib/hanamismith/builders/bundler.rb +95 -0
  9. data/lib/hanamismith/builders/caliber.rb +26 -0
  10. data/lib/hanamismith/builders/console.rb +22 -0
  11. data/lib/hanamismith/builders/core.rb +64 -0
  12. data/lib/hanamismith/builders/documentation/readme.rb +31 -0
  13. data/lib/hanamismith/builders/environment.rb +31 -0
  14. data/lib/hanamismith/builders/git/commit.rb +12 -0
  15. data/lib/hanamismith/builders/guard.rb +20 -0
  16. data/lib/hanamismith/builders/puma/configuration.rb +32 -0
  17. data/lib/hanamismith/builders/puma/procfile.rb +31 -0
  18. data/lib/hanamismith/builders/rack.rb +28 -0
  19. data/lib/hanamismith/builders/rake.rb +27 -0
  20. data/lib/hanamismith/builders/rspec/hanami.rb +34 -0
  21. data/lib/hanamismith/builders/rspec/helper.rb +24 -0
  22. data/lib/hanamismith/builders/slices/main.rb +67 -0
  23. data/lib/hanamismith/cli/actions/build.rb +66 -0
  24. data/lib/hanamismith/cli/actions/config.rb +34 -0
  25. data/lib/hanamismith/cli/actions/container.rb +19 -0
  26. data/lib/hanamismith/cli/actions/import.rb +11 -0
  27. data/lib/hanamismith/cli/parser.rb +38 -0
  28. data/lib/hanamismith/cli/parsers/core.rb +69 -0
  29. data/lib/hanamismith/cli/shell.rb +36 -0
  30. data/lib/hanamismith/configuration/content.rb +18 -0
  31. data/lib/hanamismith/configuration/defaults.yml +0 -0
  32. data/lib/hanamismith/configuration/loader.rb +27 -0
  33. data/lib/hanamismith/container.rb +17 -0
  34. data/lib/hanamismith/import.rb +7 -0
  35. data/lib/hanamismith/templates/%project_name%/Guardfile.erb +19 -0
  36. data/lib/hanamismith/templates/%project_name%/Procfile.dev.erb +1 -0
  37. data/lib/hanamismith/templates/%project_name%/Procfile.erb +1 -0
  38. data/lib/hanamismith/templates/%project_name%/app/action.rb.erb +9 -0
  39. data/lib/hanamismith/templates/%project_name%/app/repo.rb.erb +10 -0
  40. data/lib/hanamismith/templates/%project_name%/app/view.rb.erb +10 -0
  41. data/lib/hanamismith/templates/%project_name%/bin/hanami.erb +20 -0
  42. data/lib/hanamismith/templates/%project_name%/config/app.rb.erb +8 -0
  43. data/lib/hanamismith/templates/%project_name%/config/providers/persistence.rb.erb +28 -0
  44. data/lib/hanamismith/templates/%project_name%/config/puma.rb.erb +20 -0
  45. data/lib/hanamismith/templates/%project_name%/config/routes.rb.erb +8 -0
  46. data/lib/hanamismith/templates/%project_name%/config/settings.rb.erb +6 -0
  47. data/lib/hanamismith/templates/%project_name%/config.ru.erb +4 -0
  48. data/lib/hanamismith/templates/%project_name%/envrc.erb +1 -0
  49. data/lib/hanamismith/templates/%project_name%/lib/%project_path%/types.rb.erb +10 -0
  50. data/lib/hanamismith/templates/%project_name%/slices/main/action.rb.erb +7 -0
  51. data/lib/hanamismith/templates/%project_name%/slices/main/actions/home/show.rb.erb +10 -0
  52. data/lib/hanamismith/templates/%project_name%/slices/main/repo.rb.erb +7 -0
  53. data/lib/hanamismith/templates/%project_name%/slices/main/templates/home/show.html.erb.erb +3 -0
  54. data/lib/hanamismith/templates/%project_name%/slices/main/templates/layouts/app.html.erb.erb +32 -0
  55. data/lib/hanamismith/templates/%project_name%/slices/main/view.rb.erb +8 -0
  56. data/lib/hanamismith/templates/%project_name%/slices/main/views/home/show.rb.erb +9 -0
  57. data/lib/hanamismith/templates/%project_name%/spec/hanami_helper.rb.erb +22 -0
  58. data/lib/hanamismith.rb +13 -0
  59. data.tar.gz.sig +0 -0
  60. metadata +283 -0
  61. metadata.gz.sig +2 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1547f2b3305d29362da3bfc4779fd1093aba4834ddf8ab7a09d684722325b708
4
+ data.tar.gz: 9b83495269ac455d6eca644ff635127746bef385bda1ce0593a389cdfe421175
5
+ SHA512:
6
+ metadata.gz: c351b54ab430d6c0f54e5b9bfa562fc052bd532ac1f95af6d9ddac58a957d49330eb5da490336fc2e72ad245fef324965fd05a25c633845c2f3dea0a40fb6c70
7
+ data.tar.gz: 73767e229d91778bb6f21df1edf5cafebd94794c9f7ae97471eaca9876fe0d39cd242cb1b70f194af067a3cf1c3511f2445a7a5f36f28119eb0ab8716b09ba72
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ,H~k�jyi��4��t������a�Ը��Ц�::{�Y��n+
2
+ C�V{%,�b�ea�Zz�i,��}S,�t̲���, Y���#��o�=���񿅀4��:�ֻ,b3����Z��F^�z20�e�=<�`8���W�Z�鼾�y[��-�����$;z���#�i�'�ٴi[������l���o�#�<M��k�~�%�B�=��5��������栿N6���Ld�j0k�x��0�lF�%�ځ2q? �
data/LICENSE.adoc ADDED
@@ -0,0 +1,134 @@
1
+ = Hippocratic License
2
+
3
+ Version: 2.1.0.
4
+
5
+ Purpose. The purpose of this License is for the Licensor named above to
6
+ permit the Licensee (as defined below) broad permission, if consistent
7
+ with Human Rights Laws and Human Rights Principles (as each is defined
8
+ below), to use and work with the Software (as defined below) within the
9
+ full scope of Licensor’s copyright and patent rights, if any, in the
10
+ Software, while ensuring attribution and protecting the Licensor from
11
+ liability.
12
+
13
+ Permission and Conditions. The Licensor grants permission by this
14
+ license ("License"), free of charge, to the extent of Licensor’s
15
+ rights under applicable copyright and patent law, to any person or
16
+ entity (the "Licensee") obtaining a copy of this software and
17
+ associated documentation files (the "Software"), to do everything with
18
+ the Software that would otherwise infringe (i) the Licensor’s copyright
19
+ in the Software or (ii) any patent claims to the Software that the
20
+ Licensor can license or becomes able to license, subject to all of the
21
+ following terms and conditions:
22
+
23
+ * Acceptance. This License is automatically offered to every person and
24
+ entity subject to its terms and conditions. Licensee accepts this
25
+ License and agrees to its terms and conditions by taking any action with
26
+ the Software that, absent this License, would infringe any intellectual
27
+ property right held by Licensor.
28
+ * Notice. Licensee must ensure that everyone who gets a copy of any part
29
+ of this Software from Licensee, with or without changes, also receives
30
+ the License and the above copyright notice (and if included by the
31
+ Licensor, patent, trademark and attribution notice). Licensee must cause
32
+ any modified versions of the Software to carry prominent notices stating
33
+ that Licensee changed the Software. For clarity, although Licensee is
34
+ free to create modifications of the Software and distribute only the
35
+ modified portion created by Licensee with additional or different terms,
36
+ the portion of the Software not modified must be distributed pursuant to
37
+ this License. If anyone notifies Licensee in writing that Licensee has
38
+ not complied with this Notice section, Licensee can keep this License by
39
+ taking all practical steps to comply within 30 days after the notice. If
40
+ Licensee does not do so, Licensee’s License (and all rights licensed
41
+ hereunder) shall end immediately.
42
+ * Compliance with Human Rights Principles and Human Rights Laws.
43
+ [arabic]
44
+ . Human Rights Principles.
45
+ [loweralpha]
46
+ .. Licensee is advised to consult the articles of the United Nations
47
+ Universal Declaration of Human Rights and the United Nations Global
48
+ Compact that define recognized principles of international human rights
49
+ (the "Human Rights Principles"). Licensee shall use the Software in a
50
+ manner consistent with Human Rights Principles.
51
+ .. Unless the Licensor and Licensee agree otherwise, any dispute,
52
+ controversy, or claim arising out of or relating to (i) Section 1(a)
53
+ regarding Human Rights Principles, including the breach of Section 1(a),
54
+ termination of this License for breach of the Human Rights Principles,
55
+ or invalidity of Section 1(a) or (ii) a determination of whether any Law
56
+ is consistent or in conflict with Human Rights Principles pursuant to
57
+ Section 2, below, shall be settled by arbitration in accordance with the
58
+ Hague Rules on Business and Human Rights Arbitration (the "Rules");
59
+ provided, however, that Licensee may elect not to participate in such
60
+ arbitration, in which event this License (and all rights licensed
61
+ hereunder) shall end immediately. The number of arbitrators shall be one
62
+ unless the Rules require otherwise.
63
+ +
64
+ Unless both the Licensor and Licensee agree to the contrary: (1) All
65
+ documents and information concerning the arbitration shall be public and
66
+ may be disclosed by any party; (2) The repository referred to under
67
+ Article 43 of the Rules shall make available to the public in a timely
68
+ manner all documents concerning the arbitration which are communicated
69
+ to it, including all submissions of the parties, all evidence admitted
70
+ into the record of the proceedings, all transcripts or other recordings
71
+ of hearings and all orders, decisions and awards of the arbitral
72
+ tribunal, subject only to the arbitral tribunal’s powers to take such
73
+ measures as may be necessary to safeguard the integrity of the arbitral
74
+ process pursuant to Articles 18, 33, 41 and 42 of the Rules; and (3)
75
+ Article 26(6) of the Rules shall not apply.
76
+ . Human Rights Laws. The Software shall not be used by any person or
77
+ entity for any systems, activities, or other uses that violate any Human
78
+ Rights Laws. "Human Rights Laws" means any applicable laws,
79
+ regulations, or rules (collectively, "Laws") that protect human,
80
+ civil, labor, privacy, political, environmental, security, economic, due
81
+ process, or similar rights; provided, however, that such Laws are
82
+ consistent and not in conflict with Human Rights Principles (a dispute
83
+ over the consistency or a conflict between Laws and Human Rights
84
+ Principles shall be determined by arbitration as stated above). Where
85
+ the Human Rights Laws of more than one jurisdiction are applicable or in
86
+ conflict with respect to the use of the Software, the Human Rights Laws
87
+ that are most protective of the individuals or groups harmed shall
88
+ apply.
89
+ . Indemnity. Licensee shall hold harmless and indemnify Licensor (and
90
+ any other contributor) against all losses, damages, liabilities,
91
+ deficiencies, claims, actions, judgments, settlements, interest, awards,
92
+ penalties, fines, costs, or expenses of whatever kind, including
93
+ Licensor’s reasonable attorneys’ fees, arising out of or relating to
94
+ Licensee’s use of the Software in violation of Human Rights Laws or
95
+ Human Rights Principles.
96
+ * Failure to Comply. Any failure of Licensee to act according to the
97
+ terms and conditions of this License is both a breach of the License and
98
+ an infringement of the intellectual property rights of the Licensor
99
+ (subject to exceptions under Laws, e.g., fair use). In the event of a
100
+ breach or infringement, the terms and conditions of this License may be
101
+ enforced by Licensor under the Laws of any jurisdiction to which
102
+ Licensee is subject. Licensee also agrees that the Licensor may enforce
103
+ the terms and conditions of this License against Licensee through
104
+ specific performance (or similar remedy under Laws) to the extent
105
+ permitted by Laws. For clarity, except in the event of a breach of this
106
+ License, infringement, or as otherwise stated in this License, Licensor
107
+ may not terminate this License with Licensee.
108
+ * Enforceability and Interpretation. If any term or provision of this
109
+ License is determined to be invalid, illegal, or unenforceable by a
110
+ court of competent jurisdiction, then such invalidity, illegality, or
111
+ unenforceability shall not affect any other term or provision of this
112
+ License or invalidate or render unenforceable such term or provision in
113
+ any other jurisdiction; provided, however, subject to a court
114
+ modification pursuant to the immediately following sentence, if any term
115
+ or provision of this License pertaining to Human Rights Laws or Human
116
+ Rights Principles is deemed invalid, illegal, or unenforceable against
117
+ Licensee by a court of competent jurisdiction, all rights in the
118
+ Software granted to Licensee shall be deemed null and void as between
119
+ Licensor and Licensee. Upon a determination that any term or provision
120
+ is invalid, illegal, or unenforceable, to the extent permitted by Laws,
121
+ the court may modify this License to affect the original purpose that
122
+ the Software be used in compliance with Human Rights Principles and
123
+ Human Rights Laws as closely as possible. The language in this License
124
+ shall be interpreted as to its fair meaning and not strictly for or
125
+ against any party.
126
+ * Disclaimer. TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE COMES
127
+ "AS IS," WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR AND
128
+ ANY OTHER CONTRIBUTOR SHALL NOT BE LIABLE TO ANYONE FOR ANY DAMAGES OR
129
+ OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE
130
+ OR THIS LICENSE, UNDER ANY KIND OF LEGAL CLAIM.
131
+
132
+ This Hippocratic License is an link:https://ethicalsource.dev[Ethical Source license] and is offered
133
+ for use by licensors and licensees at their own risk, on an "AS IS" basis, and with no warranties
134
+ express or implied, to the maximum extent permitted by Laws.
data/README.adoc ADDED
@@ -0,0 +1,206 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ :cuprite_link: link:https://cuprite.rubycdp.com[Cuprite]
6
+ :dry_link: link:https://dry-rb.org[Dry RB]
7
+ :dotfiles_link: link:https://www.alchemists.io/projects/dotfiles[Dotfiles]
8
+ :hanami_link: link:https://hanamirb.org[Hanami]
9
+ :htmx_link: link:https://htmx.org[HTMX]
10
+ :rubysmith_link: link:https://www.alchemists.io/projects/rubysmith[Rubysmith]
11
+
12
+ = Hanamismith
13
+
14
+ Hanamismith is a Command Line Interface (CLI) for smithing Hanami projects. Perfect for when you need a professional and robust tool for building new project skeletons. To quote from the {dry_link} and {hanami_link} team:
15
+ ____
16
+ If you're looking for new ways to build maintainable, secure, faster and testable Ruby applications, you're in for a treat. *Hanami is built for people like you*.
17
+
18
+ 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.
19
+ ____
20
+
21
+ Welcome to the modern age of web development! This gem will help you get up and running as quickly as possible. 🚀
22
+
23
+ toc::[]
24
+
25
+ == Features
26
+
27
+ * Supports all {rubysmith_link} features.
28
+ * Supports {dry_link} functional programming.
29
+ * Supports {hanami_link} for web application development.
30
+ * Supports {htmx_link} for proper REST (hypermedia) architectures (i.e. HTML over the wire) so you can write less code and avoid bloated JavaScript stacks.
31
+ * Supports {cuprite_link} for full, headless, feature testing.
32
+
33
+ == Requirements
34
+
35
+ . link:https://www.ruby-lang.org[Ruby].
36
+
37
+ == Setup
38
+
39
+ To install, run:
40
+
41
+ [source,bash]
42
+ ----
43
+ gem install hanamismith
44
+ ----
45
+
46
+ == Usage
47
+
48
+ === Command Line Interface (CLI)
49
+
50
+ From the command line, type: `hanamismith --help`
51
+
52
+ ....
53
+ USAGE:
54
+ -b, --build NAME [options] Build new project.
55
+ -c, --config ACTION Manage gem configuration: edit or view.
56
+ -h, --help Show this message.
57
+ -v, --version Show gem version.
58
+
59
+ BUILD OPTIONS:
60
+ --[no-]amazing_print Add Amazing Print gem. Default: true.
61
+ --[no-]caliber Add Caliber gem. Default: true.
62
+ --[no-]circle_ci Add Circle CI configuration and badge. Default: false.
63
+ --[no-]citation Add citation documentation. Default: true.
64
+ --[no-]community Add community documentation. Default: false.
65
+ --[no-]conduct Add code of conduct documentation. Default: true.
66
+ --[no-]console Add console script. Default: true.
67
+ --[no-]contributions Add contributions documentation. Default: true.
68
+ --[no-]debug Add Debug gem. Default: true.
69
+ --[no-]funding Add GitHub funding configuration. Default: false.
70
+ --[no-]git Add Git. Default: true.
71
+ --[no-]git_hub Add GitHub templates. Default: false.
72
+ --[no-]git_hub_ci Add GitHub templates. Default: false.
73
+ --[no-]git-lint Add Git Lint gem. Default: true.
74
+ --[no-]guard Add Guard gem. Default: true.
75
+ --[no-]license Add license documentation. Default: true.
76
+ --max Use maximum/enabled options. Default: false.
77
+ --min Use minimum/disabled options. Default: false.
78
+ --[no-]rake Add Rake gem. Default: true.
79
+ --[no-]readme Add readme documentation. Default: true.
80
+ --[no-]reek Add Reek gem. Default: true.
81
+ --[no-]refinements Add Refinements gem. Default: true.
82
+ --[no-]rspec Add RSpec gem. Default: true.
83
+ --[no-]security Add security. Default: true.
84
+ --[no-]setup Add setup script. Default: true.
85
+ --[no-]simple_cov Add SimpleCov gem. Default: true.
86
+ --[no-]versions Add version history. Default: true.
87
+ --[no-]yard Add Yard gem. Default: false.
88
+ --[no-]zeitwerk Add Zeitwerk gem. Default: true.
89
+ ....
90
+
91
+ The core functionality of this gem centers around the `--build` command and associated flags. The build options allow you to further customize the kind of gem you want to build. Most build options are enabled by default. For detailed documentation on all supported flags, see the link:https://www.alchemists.io/projects/rubysmith/#_build[Rubysmith] documentation.
92
+
93
+ ℹ️ 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.
94
+
95
+ === Configuration
96
+
97
+ This gem can be configured via a global configuration:
98
+
99
+ ....
100
+ $HOME/.config/hanamismith/configuration.yml
101
+ ....
102
+
103
+ It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
104
+ variables.
105
+
106
+ The default configuration is everything provided in the
107
+ link:https://www.alchemists.io/projects/rubysmith/#_configuration[Rubysmith].
108
+
109
+ 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:
110
+
111
+ [source,yaml]
112
+ ----
113
+ :project:
114
+ :url:
115
+ # Add sub-key values here.
116
+ ----
117
+
118
+ When these values exist, you'll benefit from having this information added to your generated project documentation. Otherwise -- if these values are empty -- they are removed from new project generation entirely.
119
+
120
+ === Workflows
121
+
122
+ When implementing and testing your project locally, a typical workflow might be:
123
+
124
+ [source,bash]
125
+ ----
126
+ # Build new project
127
+ hanamismith --build demo
128
+
129
+ # Run code quality and test coverage checks
130
+ cd demo
131
+ bundle exec rake
132
+
133
+ # Develop (red, green, refactor)
134
+ bin/guard
135
+ git commit # (repeat until finished with implementation)
136
+
137
+ # Run: With Overmind (recommended)
138
+ overmind start --port-step 10 --procfile Procfile.dev
139
+
140
+ # Run: Without Overmind
141
+ hanami start
142
+
143
+ # Deploy
144
+ git push
145
+ ----
146
+
147
+ === Aliases
148
+
149
+ For link:https://www.gnu.org/software/bash[Bash] users -- or other shell users -- you might find the following aliases helpful in reducing terminal keystrokes when using this gem:
150
+
151
+ [source,bash]
152
+ ----
153
+ alias hsb="hanamismith --build"
154
+ alias hse="hanamismith --config edit"
155
+ alias hsh="hanamismith --help"
156
+ ----
157
+
158
+ The above is what I use via my {dotfiles_link} project.
159
+
160
+ === Demonstration
161
+
162
+ If you'd like a fully working demonstration appliation -- as built by this gem -- then check ouh the link:https://github.com/bkuhlmann/hemo[Hemo] project.
163
+
164
+ == Development
165
+
166
+ To contribute, run:
167
+
168
+ [source,bash]
169
+ ----
170
+ git clone https://github.com/bkuhlmann/hanamismith
171
+ cd hanamismith
172
+ bin/setup
173
+ ----
174
+
175
+ You can also use the IRB console for direct access to all objects:
176
+
177
+ [source,bash]
178
+ ----
179
+ bin/console
180
+ ----
181
+
182
+ == Tests
183
+
184
+ To test, run:
185
+
186
+ [source,bash]
187
+ ----
188
+ bundle exec rake
189
+ ----
190
+
191
+ == link:https://www.alchemists.io/policies/license[License]
192
+
193
+ == link:https://www.alchemists.io/policies/security[Security]
194
+
195
+ == link:https://www.alchemists.io/policies/code_of_conduct[Code of Conduct]
196
+
197
+ == link:https://www.alchemists.io/policies/contributions[Contributions]
198
+
199
+ == link:https://www.alchemists.io/projects/hanamismith/versions[Versions]
200
+
201
+ == link:https://www.alchemists.io/community[Community]
202
+
203
+ == Credits
204
+
205
+ * Built with link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
206
+ * Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
data/exe/hanamismith ADDED
@@ -0,0 +1,6 @@
1
+ #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "hanamismith"
5
+
6
+ Hanamismith::CLI::Shell.new.call ARGV
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "hanamismith"
5
+ spec.version = "0.0.0"
6
+ spec.authors = ["Brooke Kuhlmann"]
7
+ spec.email = ["brooke@alchemists.io"]
8
+ spec.homepage = "https://www.alchemists.io/projects/hanamismith"
9
+ spec.summary = "A command line interface for smithing Hanami projects."
10
+ spec.license = "Hippocratic-2.1"
11
+
12
+ spec.metadata = {
13
+ "bug_tracker_uri" => "https://github.com/bkuhlmann/hanamismith/issues",
14
+ "changelog_uri" => "https://www.alchemists.io/projects/hanamismith/versions",
15
+ "documentation_uri" => "https://www.alchemists.io/projects/hanamismith",
16
+ "funding_uri" => "https://github.com/sponsors/bkuhlmann",
17
+ "label" => "Hanamismith",
18
+ "rubygems_mfa_required" => "true",
19
+ "source_code_uri" => "https://github.com/bkuhlmann/hanamismith"
20
+ }
21
+
22
+ spec.signing_key = Gem.default_key_path
23
+ spec.cert_chain = [Gem.default_cert_path]
24
+
25
+ spec.required_ruby_version = "~> 3.2"
26
+ spec.add_dependency "cogger", "~> 0.5"
27
+ spec.add_dependency "core", "~> 0.1"
28
+ spec.add_dependency "dry-container", "~> 0.11"
29
+ spec.add_dependency "dry-monads", "~> 1.6"
30
+ spec.add_dependency "hanami", "~> 2.0"
31
+ spec.add_dependency "infusible", "~> 1.0"
32
+ spec.add_dependency "refinements", "~> 10.0"
33
+ spec.add_dependency "rubysmith", "~> 4.3"
34
+ spec.add_dependency "runcom", "~> 9.0"
35
+ spec.add_dependency "spek", "~> 1.0"
36
+ spec.add_dependency "zeitwerk", "~> 2.6"
37
+
38
+ spec.bindir = "exe"
39
+ spec.executables << "hanamismith"
40
+ spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
41
+ spec.files = Dir["*.gemspec", "lib/**/*"]
42
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ # Builds project skeleton binstub.
8
+ class Binstub
9
+ using Refinements::Structs
10
+
11
+ def self.call(...) = new(...).call
12
+
13
+ def initialize configuration, builder: Rubysmith::Builder
14
+ @configuration = configuration
15
+ @builder = builder
16
+ end
17
+
18
+ def call
19
+ builder.call(configuration.merge(template_path: "%project_name%/bin/hanami.erb"))
20
+ .render
21
+ .permit 0o755
22
+
23
+ configuration
24
+ end
25
+
26
+ private
27
+
28
+ attr_reader :configuration, :builder
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ # Builds project skeleton with Gemfile configuration.
8
+ class Bundler < Rubysmith::Builders::Bundler
9
+ using Refinements::Structs
10
+
11
+ # :reek:TooManyStatements
12
+ def call
13
+ super
14
+ insert_main_dependencies
15
+ insert_persistence_dependencies
16
+ alter_groups
17
+ append_development_group
18
+ append_test_group
19
+ remove_zeitwerk
20
+ configuration
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :configuration, :builder
26
+
27
+ # rubocop:todo Metrics/MethodLength
28
+ def insert_main_dependencies
29
+ with_template.insert_after("source", %(gem "dry-types", "~> 1.7"))
30
+ .insert_after("source", %(gem "erbse", "~> 0.1"\n))
31
+ .insert_after("source", %(gem "hanami", "~> 2.0"\n))
32
+ .insert_after("source", %(gem "hanami-controller", "~> 2.0"\n))
33
+ .insert_after("source", %(gem "hanami-router", "~> 2.0"\n))
34
+ .insert_after("source", %(gem "hanami-validations", "~> 2.0"\n))
35
+ .insert_after(
36
+ "source",
37
+ %(gem "hanami-view", github: "hanami/view", branch: "main"\n)
38
+ )
39
+ .insert_after("source", %(gem "puma", "~> 6.0"\n))
40
+ end
41
+ # rubocop:enable Metrics/MethodLength
42
+
43
+ def insert_persistence_dependencies
44
+ with_template.insert_after("source", %(gem "pg", "~> 1.4"\n))
45
+ .insert_after("source", %(gem "rom", "~> 5.3"\n))
46
+ .insert_after("source", %(gem "rom-sql", "~> 3.6"\n))
47
+ .insert_after("source", %(\ngem "sequel", "~> 5.64"\n))
48
+ end
49
+
50
+ def alter_groups
51
+ with_template.insert_after(/group :code_quality/, %( gem "rubocop-sequel", "~> 0.3"\n))
52
+ .insert_after(/group :development/, %( gem "localhost", "~> 1.1"\n))
53
+ .insert_after(/group :development/, %( gem "rerun", "~> 0.14"\n))
54
+ .insert_after(/group :test/, %( gem "capybara", "~> 3.38"\n))
55
+ .insert_after(/group :test/, %( gem "cuprite", "~> 0.14"\n))
56
+ .insert_after(/group :test/, %( gem "rack-test", "~> 2.0"\n))
57
+ .insert_after(/group :test/, %( gem "rom-factory", "~> 0.11"\n))
58
+ .replace(/gem "rspec.+/, %(gem "hanami-rspec", "~> 2.0"))
59
+ end
60
+
61
+ def append_development_group
62
+ return if configuration.markdown? || configuration.build_rake || configuration.build_yard
63
+
64
+ with_template.append <<~CONTENT
65
+
66
+ group :development do
67
+ gem "localhost", "~> 1.1"
68
+ gem "rerun", "~> 0.14"
69
+ end
70
+
71
+ CONTENT
72
+ end
73
+
74
+ def append_test_group
75
+ return if configuration.build_guard || configuration.build_rspec
76
+
77
+ with_template.append <<~CONTENT
78
+ group :test do
79
+ gem "capybara", "~> 3.38"
80
+ gem "cuprite", "~> 0.14"
81
+ gem "hanami-rspec", "~> 2.0"
82
+ gem "rack-test", "~> 2.0"
83
+ gem "rom-factory", "~> 0.11"
84
+ end
85
+ CONTENT
86
+ end
87
+
88
+ def remove_zeitwerk = with_template.replace(/.+zeitwerk.+\n\n/, "\n")
89
+
90
+ def with_template
91
+ builder.call configuration.merge(template_path: "%project_name%/Gemfile.erb")
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ # Builds project skeleton with Caliber style support.
8
+ class Caliber < Rubysmith::Builders::Caliber
9
+ using Refinements::Structs
10
+
11
+ def call
12
+ return configuration unless configuration.build_caliber
13
+
14
+ super
15
+ builder.call(configuration.merge(template_path: "%project_name%/.rubocop.yml.erb"))
16
+ .append("\nrequire: rubocop-sequel\n")
17
+
18
+ configuration
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :configuration, :builder
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ # Builds project skeleton console for object inspection and exploration.
8
+ class Console < Rubysmith::Builders::Console
9
+ using Refinements::Structs
10
+
11
+ def call
12
+ return configuration unless configuration.build_console
13
+
14
+ super
15
+ builder.call(configuration.merge(template_path: "%project_name%/bin/console.erb"))
16
+ .replace(/require_relative.+/, %(require "hanami/prepare"))
17
+
18
+ configuration
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ # Builds project skeleton foundation.
8
+ class Core
9
+ using Refinements::Structs
10
+
11
+ def self.call(...) = new(...).call
12
+
13
+ def initialize configuration, builder: Rubysmith::Builder
14
+ @configuration = configuration
15
+ @builder = builder
16
+ end
17
+
18
+ def call
19
+ private_methods.grep(/\Aadd_/).sort.each { |method| __send__ method }
20
+ configuration
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :configuration, :builder
26
+
27
+ def add_application_action
28
+ builder.call(configuration.merge(template_path: "%project_name%/app/action.rb.erb")).render
29
+ end
30
+
31
+ def add_application_repository
32
+ builder.call(configuration.merge(template_path: "%project_name%/app/repo.rb.erb")).render
33
+ end
34
+
35
+ def add_application_view
36
+ builder.call(configuration.merge(template_path: "%project_name%/app/view.rb.erb")).render
37
+ end
38
+
39
+ def add_persistence_provider
40
+ path = "%project_name%/config/providers/persistence.rb.erb"
41
+ builder.call(configuration.merge(template_path: path)).render
42
+ end
43
+
44
+ def add_application_configuration
45
+ builder.call(configuration.merge(template_path: "%project_name%/config/app.rb.erb")).render
46
+ end
47
+
48
+ def add_routes_configuration
49
+ builder.call(configuration.merge(template_path: "%project_name%/config/routes.rb.erb"))
50
+ .render
51
+ end
52
+
53
+ def add_settings_configuration
54
+ builder.call(configuration.merge(template_path: "%project_name%/config/settings.rb.erb"))
55
+ .render
56
+ end
57
+
58
+ def add_types
59
+ path = "%project_name%/lib/%project_path%/types.rb.erb"
60
+ builder.call(configuration.merge(template_path: path)).render
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Hanamismith
6
+ module Builders
7
+ module Documentation
8
+ # Builds project skeleton README documentation.
9
+ class Readme < Rubysmith::Builders::Documentation::Readme
10
+ using Refinements::Structs
11
+
12
+ def call
13
+ return configuration unless configuration.build_readme
14
+
15
+ super
16
+ builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
17
+ .replace("Rubysmith", "Hanamismith")
18
+ .replace("rubysmith", "hanamismith")
19
+
20
+ configuration
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :configuration, :builder
26
+
27
+ def kind = configuration.documentation_format
28
+ end
29
+ end
30
+ end
31
+ end