# 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 + pushing to Confluence
- 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", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 0.5",    only: [:dev, :test], runtime: false},
{:ex_doc, "~> 0.18",     only: [:dev, :test], runtime: false},
{:credo, "~> 0.8",       only: [:dev, :test], runtime: false},
{:boilex, "~> 0.2",      only: [:dev, :test], 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]


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.
- `` locally starts compiled application.
- `` 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.
- `` provides direct access to remote erlang node through `iex`.
- `` 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.
- `` creates and opens project documentation.
- `` 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: ****
- `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**
- `CONFLUENCE_SUBDOMAIN` first part of confluence domain name, example: **mycompany**
- `CONFLUENCE_PAGE_ID` numeric id of project page, example:**323322444**/elixir-app
- `CONFLUENCE_SECRET` access token generated from atlassian login and password in the following way *`"#{login}:#{password}" |> Base.encode64`*, example: **bG9naW46cGFzc3dvcmQ=**. CONFLUENCE_SECRET can be generated only from normal login/password pair. To get atlassian account with normal login/password, user should not use g-suite to sign in into Confluence. The simplest way is to not use google email address as login (use any other email address).
- `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.


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