Giter VIP home page Giter VIP logo

hanamismith's Introduction

Hanamismith

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. 🚀

Features

  • 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 pg coupled with ROM for database management.

  • 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.

Requirements

  1. Ruby.

Setup

To install, run:

gem install hanamismith

Usage

Command Line Interface (CLI)

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.

ℹ️ Use of the --zeitwerk or --no-zeitwerk flags will have no effect so you can ignore them since Hanami builds in this functionality for you by default. At the moment, this flag is a carry over from the Rubysmith project and will be removed in the future.

Configuration

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.

Workflows

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.

Aliases

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.

Demonstrations

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:

Development

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

Tests

To test, run:

bin/rake

Credits

hanamismith's People

Contributors

bkuhlmann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.