Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bkuhlmann/hanamismith

A command line interface for smithing Hanami projects.
https://github.com/bkuhlmann/hanamismith

cli gem hanami ruby

Last synced: 13 days ago
JSON representation

A command line interface for smithing Hanami projects.

Awesome Lists containing this project

README

        

:toc: macro
:toclevels: 5
:figure-caption!:

:capybara_link: link:https://github.com/teamcapybara/capybara[Capybara]
:cuprite_link: link:https://cuprite.rubycdp.com[Cuprite]
:dotenv_link: link:https://github.com/bkeepers/dotenv[Dotenv]
:dotfiles_link: link:https://alchemists.io/projects/dotfiles[Dotfiles]
:hanami_link: link:https://hanamirb.org[Hanami]
:htmx_link: link:https://alchemists.io/projects/htmx[HTMX]
:pg_link: link:https://github.com/ged/ruby-pg[pg]
:puma_link: link:https://puma.io[Puma]
:rack_link: link:https://github.com/rack/rack[Rack]
:rom_link: link:https://rom-rb.org[ROM]
:rubysmith_link: link:https://alchemists.io/projects/rubysmith[Rubysmith]

= Hanamismith

Hanamismith is a Command Line Interface (CLI) for smithing Hanami projects. Perfect when you need a professional, configurable, and robust tool for building new project skeletons.

toc::[]

== Features

* Built atop {rubysmith_link} for building project skeleton.
* Uses {hanami_link} for web application development.
* Uses {htmx_link} for Hypermedia REST so you can write less code and avoid bloated JavaScript stacks.
* Uses {pg_link} coupled with {rom_link} for database management.
* Uses {rack_link}, specifically: link:https://github.com/rack/rack-attack[Rack::Attack], `Rack::Deflater`, and `Rack::Static`.
* Uses {puma_link} as the default web server and fully configured for local and production environments.
* Uses {capybara_link} with {cuprite_link} (driver) for full, headless, feature testing.
* Uses {dotenv_link} for managing your environment configurations.
* Provides support for Continuous Integration systems like link:https://circleci.com[Circle CI] (default) and link:https://docs.github.com/en/actions[GitHub Actions].
* Provides the `/up` health check endpoint via the `Health` slice.
* Uses link:https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md[YJIT] as a provider so you can deploy with YJIT disabled (i.e. `RUBYOPT=--yjit-disable --yjit-exec-mem-size=192`) and let the application enable upon boot.
* Disables link:https://github.com/ruby/irb[IRB] console autocomplete when used in production-like environments. You can re-enable IRB autocomplete by setting `IRB_USE_AUTOCOMPLETE=true` before launching your console in non development or test environments.

== Screenshots/Screencasts

image:https://alchemists.io/images/projects/hanamismith/screenshots/home.png[Home,width=702,height=694,role=focal_point]

The above is a screenshot of a _Demo_ project that was generated and run locally. For a fully working demonstration application -- as built by this gem -- check out the link:https://github.com/bkuhlmann/hemo[Hemo] project. Here's a quick screencast overview of this demonstration application in action:

video::https://alchemists.io/videos/projects/hemo/demo.mp4[poster=https://alchemists.io/images/projects/hemo/demo.png,width=1280,height=720,role=focal_point]

== Requirements

. link:https://www.ruby-lang.org[Ruby].

== Setup

To install _with_ security, run:

[source,bash]
----
# 💡 Skip this line if you already have the public certificate installed.
gem cert --add <(curl --compressed --location https://alchemists.io/gems.pem)
gem install hanamismith --trust-policy HighSecurity
----

To install _without_ security, run:

[source,bash]
----
gem install hanamismith
----

== Usage

=== Command Line Interface (CLI)

From the command line, type: `hanamismith --help`

image:https://alchemists.io/images/projects/hanamismith/screenshots/usage.png[Usage,width=586,height=333,role=focal_point]

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.

=== Configuration

This gem can be configured via a global configuration:

....
$HOME/.config/hanamismith/configuration.yml
....

It can also be configured via link:https://alchemists.io/projects/xdg[XDG] environment
variables.

The default configuration is everything provided in the
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:

[source,yaml]
----
project:
url:
# Add key/value pairs 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.

=== Workflows

When implementing and testing your project locally, a typical workflow might be:

[source,bash]
----
# Build new project
hanamismith build --name demo

# Run code quality and test coverage checks
cd demo
bin/setup
bin/rake

# Develop (red, green, refactor)
NO_COVERAGE=true retest
git commit # (repeat until finished with implementation)

# Run: With Overmind (recommended)
overmind start --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 home page.
* `/up`: 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.

=== Aliases

For link:https://www.gnu.org/software/bash[Bash] users -- or other shell users -- you might find these suggested aliases helpful in reducing keystrokes when using this gem:

[source,bash]
----
alias hsb="hanamismith build --name"
alias hse="hanamismith config --edit"
alias hsh="hanamismith --help"
----

The above is what I use via my {dotfiles_link} project.

== Development

To contribute, run:

[source,bash]
----
git clone https://github.com/bkuhlmann/hanamismith
cd hanamismith
bin/setup
----

You can also use the IRB console for direct access to all objects:

[source,bash]
----
bin/console
----

== Tests

To test, run:

[source,bash]
----
bin/rake
----

== link:https://alchemists.io/policies/license[License]

== link:https://alchemists.io/policies/security[Security]

== link:https://alchemists.io/policies/code_of_conduct[Code of Conduct]

== link:https://alchemists.io/policies/contributions[Contributions]

== link:https://alchemists.io/policies/developer_certificate_of_origin[Developer Certificate of Origin]

== link:https://alchemists.io/projects/hanamismith/versions[Versions]

== link:https://alchemists.io/community[Community]

== Credits

* Built with link:https://alchemists.io/projects/gemsmith[Gemsmith].
* Engineered by link:https://alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].