/boilex

perfect Elixir project configurator

Primary LanguageElixir

Boilex

Boilex is mix-based Elixir development tool. It

  • generates dev tools configurations for
    • static bytecode analysis
    • source code analysis
    • test coverage analysis
  • generates Circleci configurations for
    • testing
    • building docker images + pushing to Dockerhub
    • building project documentation + ERD
  • generates Docker configurations
  • generates development scripts (for remote debugging etc)
  • provides releases versioning

Installation

Add the following parameters to deps function in mix.exs file

# development tools
{:excoveralls, "~> 0.8", runtime: false},
{:dialyxir, "~> 0.5",    runtime: false},
{:ex_doc, "~> 0.19",     runtime: false},
{:credo, "~> 0.9",       runtime: false},
{:boilex, "~> 0.2",      runtime: false},

Usage

boilex.init

Command mix boilex.init generates development tools configuration files in already existing Elixir project. It can be used with any Elixir or Phoenix application except umbrella projects. To generate configuration execute this command and follow instructions.

cd ./myproject
mix deps.get && mix compile
mix boilex.init
  • Coveralls tool will help you to check test coverage for each module of new project. Can be configured with coveralls.json file. It's recommended to keep minimal test coverage = 100%.
  • Dialyzer is static analysis tool for BEAM bytecode. Most useful feature of this tool is perfect type inference what will work in your project from-the-box without writing any explicit function specs or any other overhead. Can be configured with .dialyzer_ignore file.
  • ExDoc is a tool to generate beautiful documentation for your Elixir projects.
  • Credo static code analysis tool will make your code pretty and consistent. Can be configured with .credo.exs file.
  • scripts directory contains auto-generated bash helper scripts.

boilex.release

Script bumps version, creates new release, updates changelog and pushes new tag to github. Argument is one of patch | minor | major. Example:

mix boilex.release patch

boilex.hex.publish

Task is wrapper around standard mix hex.publish but it prevents accidental pushing of private organization packages to open-source. Can accept optional --confirm-public flag to enforce open-source push.

mix boilex.hex.publish [--confirm-public]

boilex.ci

Some mix tasks are made to use by CI. But of course tasks can be executed locally if needed. List of tasks:

mix help | grep "boilex\.ci"

scripts

  • .env text file contains variables are required by some scripts and mix tasks.
  • start.sh locally starts compiled application.
  • pre-commit.sh is git pre-commit hook. This script will compile project and execute all possible checks. Script will not let you make commits before all issues generated by compiler and static analysis tools will be fixed and all tests will pass.
  • remote-iex.sh provides direct access to remote erlang node through iex.
  • cluster-iex.sh connects current erlang node to remote erlang node. All local debug tools (for example Observer) are available to debug remote node. Hot code reloading is also available.
  • docs.sh creates and opens project documentation.
  • coverage.sh creates and opens project test coverage report.

Some system variables are required by some scripts, description of all variables

  • ERLANG_HOST remote hostname to connect, example: www.elixir-app.com
  • ERLANG_OTP_APPLICATION lowercase and snakecase standard OTP application name, example: elixir_app
  • ERLANG_COOKIE remote Erlang node cookie, example: OEBy/p9vFWi85XTeYOUvIwLr/sZctkHPKWNxfTtf81M=
  • ENABLE_DIALYZER run Dialyzer checks in pre-commit hooks or not, example: false
  • CHANGELOG_GITHUB_TOKEN is token for github_changelog_generator utility. Token is required for private repos. Reference is HERE.

Variables can be defined in scripts/.env file locally (useful for development) or globally in the system.

TODO

  • Add standard project template generator.
  • Add phoenix project generator with option "--without-crap" to avoid JS, CSS, other unnecessary static stuff and unnecessary Elixir code.
  • Make files generator more configurable.