From e9032fa19c9d7981134e519256a4d934d2c4e5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 3 Apr 2016 17:50:26 +0200 Subject: Update user guide --- guide/getting_started.html | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'guide/getting_started.html') diff --git a/guide/getting_started.html b/guide/getting_started.html index b34b6e0..1d63499 100644 --- a/guide/getting_started.html +++ b/guide/getting_started.html @@ -115,13 +115,22 @@ heart_beat_kill_pid = 16389 Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] Eshell V7.0 (abort with ^G) -(hello_joe@127.0.0.1)1>

Simple as that!

2.6. Using spaces instead of tabs

Erlang.mk defaults to tabs when creating files from templates. +(hello_joe@127.0.0.1)1>

Simple as that!

2.6. Getting started from scratch

If you already have an application, or you want to have full +control over what files will be created, you can setup Erlang.mk +manually.

Erlang.mk is very easy to setup: all that you need to do is to +create a folder, put Erlang.mk in it, and write a one line +Makefile containing:

include erlang.mk

For a step by step:

$ mkdir hello_joe
+$ cd hello_joe
+$ curl https://raw.githubusercontent.com/ninenines/erlang.mk/master/erlang.mk
+$ echo "include erlang.mk" > Makefile
+$ make

From that point onward you can create an src/ folder or start +using templates.

2.7. Using spaces instead of tabs

Erlang.mk defaults to tabs when creating files from templates. This is in part because of a personal preference, and in part because it is much easier to convert tabs to spaces than the opposite.

Use the SP variable if you prefer spaces. Set it to the number of spaces per indentation level you want.

For example, if you prefer two spaces per indentation level:

$ make -f erlang.mk bootstrap SP=2

When you bootstrap the project initially, the variable automatically gets added to the Makefile, so you only need to provide it when -you get started.

2.7. Using templates

It is no secret that Erlang’s OTP behaviors tend to have some +you get started.

2.8. Using templates

It is no secret that Erlang’s OTP behaviors tend to have some boilerplate. It is rarely an issue of course, except when creating new modules. That’s why Erlang.mk not only comes with templates for generating projects, but also individual modules!

You can list all available templates with the list-templates @@ -132,12 +141,12 @@ using the gen_server template.

This module is make:

$ make
  ERLC   my_server.erl
  APP    hello_joe.app.src

All that’s left to do is to open it in your favorite editor -and make it do something!

2.8. Hiding Erlang.mk from git

Erlang.mk is a large text file. It can easily take a large part of +and make it do something!

2.9. Hiding Erlang.mk from git

Erlang.mk is a large text file. It can easily take a large part of a git diff or a git grep command. You can avoid this by telling Git that erlang.mk is a binary file.

Add this to your .gitattributes file. This is a file that you can create at the root of your repository:

erlang.mk -diff

The erlang.mk file will still appear in diffs and greps, but as a binary file, meaning its contents won’t be shown by default -anymore.

2.9. Getting help

During development, if you don’t remember the name of a target, +anymore.

2.10. Getting help

During development, if you don’t remember the name of a target, you can always run make help:

$ make help
 erlang.mk (version 1.2.0-642-gccd2b9f) is distributed under the terms of the ISC License.
 Copyright (c) 2013-2015 Loïc Hoguin <essen@ninenines.eu>
-- 
cgit v1.2.3