Skip to content

delbetu/hexa

Repository files navigation

Maintainability Test Coverage

What is Hexa?

Hexa can be considered a light way Framework.

It is optimized for the appliance of best practices (BDD, TDD, Design, easier to refactor).
Well, actually all depends on you but at least it doesn't limit you (you know, usually your logic depends on the framework when should be the opposite).
I encourage you to see this keynote which was the starting motivation of Hexa

Embrace separation of concerns
Its primary design mission is to keep side-effects, business-logic, and presentation-logic separated from each other.

It is Use-Case centered
A use-case is defined as a set of actions reflecting user-intentions coming from the browser to the system.

In order to allow features scalability without making your code a mess. This "framework" divides the whole application into smaller applications. Each of these smaller applications represents just one use case.

Folders-DSS

These small applications follow a hexagonal architecture
So each use-case has its own API - BusinessLogic - DBAccess within a small scope that you can easily navigate.

The fact that is use-case centered suggests that you can take advantage of documenting your DSS I know, maintaining that is a pain in the ass, but working on a big project with many other devs is the high-level picture that you would wish to have.

Starting up the application

Starts a web server connected to a database

$> docker-compose up --build

IRB console

Loads gems, files under /lib

$>  ./bin/console

Database Console

$> ./bin/db/console

Sequel Console

$> ./bin/sequel_console

Create/Destroy Database

$> ./bin/db/create
$> ./bin/db/drop

Environment Variable

RACK_ENV sets the current environment .env variables are loaded into ENV Check .env.template

Migrations

Running Migrations

$> bin/db/migrate
START Running Migrations ...
...
FINISH Running Migrations ...

If you want to rollback you need to specify the version to which you want to rollback

$> ./bin/db/rollback 20201011091343

Dumping Schema

$> ./bin/db/dump
$> cat db/schema.rb

Running tests

Tests recreate a sqlite in memory db when running them.

$> bundle exec rspec

Load Seed Data

$> ./bin/db/seed

List Tables

$> ./bin/db/tables

Deploying to Heroku

Requires environment variable APP_ROOT='/app' in heorku.

$> git push heroku master

Docker

Running docker

$> docker compose up --build

Login to docker

$> docker exec -it hexa_rack bash -l