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 RB and Hanami teams:
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.
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.
Welcome to the modern age of web development! This gem will help you get up and running as quickly as possible. 🚀
-
Built atop Rubysmith and leverages all features.
-
Uses Dry RB functional programming.
-
Uses Hanami for web application development.
-
Uses HTMX for proper REST (hypermedia) architectures (i.e. HTML over the wire) so you can write less code and avoid bloated JavaScript stacks.
-
Uses Rack, specifically:
Rack::Deflater
,Rack::Static
, and Rack::Attack. -
Uses Puma as the default web server and fully configured for local and production environments.
-
Uses Capybara with Cuprite (driver) for full, headless, feature testing.
-
Uses Dotenv for managing your environment configurations.
-
Provides support for Continuous Integration systems like Circle CI (default) and GitHub Actions.
-
Ruby.
From the command line, type: hanamismith --help
USAGE: -b, --build NAME [options] Build new project. -c, --config ACTION Manage gem configuration: edit or view. -h, --help Show this message. -v, --version Show gem version. BUILD OPTIONS: --[no-]amazing_print Add Amazing Print gem. Default: true. --[no-]caliber Add Caliber gem. Default: true. --[no-]circle_ci Add Circle CI configuration and badge. Default: false. --[no-]citation Add citation documentation. Default: true. --[no-]community Add community documentation. Default: false. --[no-]conduct Add code of conduct documentation. Default: true. --[no-]console Add console script. Default: true. --[no-]contributions Add contributions documentation. Default: true. --[no-]debug Add Debug gem. Default: true. --[no-]funding Add GitHub funding configuration. Default: false. --[no-]git Add Git. Default: true. --[no-]git_hub Add GitHub templates. Default: false. --[no-]git_hub_ci Add GitHub templates. Default: false. --[no-]git-lint Add Git Lint gem. Default: true. --[no-]guard Add Guard gem. Default: true. --[no-]license Add license documentation. Default: true. --max Use maximum/enabled options. Default: false. --min Use minimum/disabled options. Default: false. --[no-]rake Add Rake gem. Default: true. --[no-]readme Add readme documentation. Default: true. --[no-]reek Add Reek gem. Default: true. --[no-]refinements Add Refinements gem. Default: true. --[no-]rspec Add RSpec gem. Default: true. --[no-]security Add security. Default: true. --[no-]setup Add setup script. Default: true. --[no-]simple_cov Add SimpleCov gem. Default: true. --[no-]versions Add version history. Default: true. --[no-]yard Add Yard gem. Default: false. --[no-]zeitwerk Add Zeitwerk gem. Default: true.
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 Rubysmith documentation.
This gem can be configured via a global configuration:
$HOME/.config/hanamismith/configuration.yml
It can also be configured via XDG environment variables.
The default configuration is everything provided in the Rubysmith.
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:
:project:
:url:
# Add sub-key values here.
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.
When implementing and testing your project locally, a typical workflow might be:
# Build new project
hanamismith --build demo
# Run code quality and test coverage checks
cd demo
bin/setup
bin/hanami db create
HANAMI_ENV=test hanami db create
bin/rake
# Develop (red, green, refactor)
bin/guard
git commit # (repeat until finished with implementation)
# Run: With Overmind (recommended)
overmind start --port-step 10 --procfile Procfile.dev
# Run: Without Overmind
bin/hanami server
# Deploy
git push
# Help
bin/hanami --help
Once the server is running you can visit (or ping) the following endpoints:
-
/
: The default welcome page. -
/status
: The health status of the application. This will be green (200 OK) when the server is up or red (503 Service Unavailable) when the server is down.
For Bash users — or other shell users — you might find the following aliases helpful in reducing terminal keystrokes when using this gem:
alias hsb="hanamismith --build"
alias hse="hanamismith --config edit"
alias hsh="hanamismith --help"
The above is what I use via my Dotfiles project.
For a fully working demonstration application — as built by this gem — check out the Hemo project. Here’s a quick screencast overview of this demonstration application in action:
In case you are not aware of Hanami Mastery, now would be a good time to introduce you. Seb Wilgosz — the creator of Hanami Mastery — recently published 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:
To contribute, run:
git clone https://github.com/bkuhlmann/hanamismith
cd hanamismith
bin/setup
You can also use the IRB console for direct access to all objects:
bin/console
-
Built with Gemsmith.
-
Engineered by Brooke Kuhlmann.