erlang.mk icon indicating copy to clipboard operation
erlang.mk copied to clipboard

Adding a cheat sheet to the docs

Open nyaray opened this issue 9 years ago • 0 comments

It would be immensely helpful to have a cheat sheet with useful (and sometimes rarely executed) commands. I'm thinking something along the lines of the following, but don't really know where it could/should/would go, so I'm just filing this here.

erlang.mk Cheat Sheet (starting point)

This document provides some useful (and maybe less commonly executed) commands.

"How Do I"...

Issue Command
See all available targets make help
Update erlang.mk make erlang-mk
Build a project make
Fetch and build dependencies make deps
[TO BE DECIDED] Update the dependencies make ...
Test things manually make shell
Run a release make run
List packages make search
Search across all packages make search q=json
List available templates make list-templates
Generate a gen_server module make new t=gen_server n=my_server

Configuration

Adding dependencies is done by adding package names to the DEPS variable in Makefile before the include erlang.mk line. List or search in the packages as described above to find something you might need. An example Makefile:

PROJECT = "my_project"
DEPS = cowboy
include erlang.mk

Getting started

Open a shell, cd into an empty directory and paste the following commands:

URL="https://raw.githubusercontent.com/ninenines/erlang.mk/master/erlang.mk";\
if [ -n $(command -v wget) ]; then; wget $URL; else; curl $URL; fi;\
make -f erlang.mk;

Done!

Bootstrapping

OTP Pattern Command
Application make -f erlang.mk bootstrap
Library make -f erlang.mk bootstrap-lib
Release make bootstrap-rel (can be appended to any of the previous targets)

Bootstrap for the kind of project you want to create. If you want to build a release containing an application or a library you can combine either target with bootstrap-rel. Bootstrapping a release running an OTP application:

make -f erlang.mk bootstrap bootstrap-rel

NOTE: When you've used bootstrap-rel make will cause the release to be built.

Run the built release:

make run

nyaray avatar Sep 24 '15 16:09 nyaray