diff options
author | Loïc Hoguin <[email protected]> | 2015-03-25 13:44:08 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-03-25 13:44:08 +0100 |
commit | 83d8b63b8abb46b374439c8c8571091968af6260 (patch) | |
tree | 11a7bb370d43a7c25e4734eb7a6f7649ce9cdc61 /doc/src/guide/start.asciidoc | |
parent | eab45765497e6eb3e031cba5dad66a7a20ec3651 (diff) | |
download | gun-83d8b63b8abb46b374439c8c8571091968af6260.tar.gz gun-83d8b63b8abb46b374439c8c8571091968af6260.tar.bz2 gun-83d8b63b8abb46b374439c8c8571091968af6260.zip |
Update the guide
A number of @todo remain in it and will be worked on shortly.
The guide has been converted to Asciidoc and 'make asciidoc'
will generate a PDF and a chunked HTML version.
Diffstat (limited to 'doc/src/guide/start.asciidoc')
-rw-r--r-- | doc/src/guide/start.asciidoc | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/doc/src/guide/start.asciidoc b/doc/src/guide/start.asciidoc new file mode 100644 index 0000000..6d93e2e --- /dev/null +++ b/doc/src/guide/start.asciidoc @@ -0,0 +1,67 @@ +== Starting and stopping + +This chapter describes how to start and stop the Gun application. + +=== Setting up + +Before Gun can be used it needs to be in Erlang's `ERL_LIBS` path variable. +If you use `erlang.mk` or a similar build tool, you only need to specify +Gun as a dependency to your application and the tool will take care +of downloading Gun and setting up paths. + +With `erlang.mk` this is done by adding `gun` to the `DEPS` variable +in your Makefile. + +.Adding Gun as an erlang.mk dependency + +[source,make] +DEPS = gun + +=== Starting + +Gun is an _OTP application_. It needs to be started before you can +use it. + +.Starting Gun in an Erlang shell + +[source,erlang] +---- +1> application:ensure_all_started(gun). +{ok,[ranch,crypto,cowlib,asn1,public_key,ssl,gun]} +---- + +=== Stopping + +You can stop Gun using the `application:stop/1` function, however +only Gun will be stopped. This is the equivalent of `application:start/1`. +The `application_ensure_all_started/1` function has no equivalent for +stopping all applications. + +.Stopping Gun + +[source,erlang] +application:stop(gun). + +=== Using Gun with releases + +An _OTP release_ starts applications automatically. All you need +to do is to set up your application resource file so that Gun can +be included in the release. The application resource file can be +found in `ebin/your_application.app`, or in `src/your_application.app.src` +if you are using a build tool like `erlang.mk`. + +The key you need to change is the `applications` key. By default +it only includes `kernel` and `stdlib`. You need to add `gun` to +that list. + +.Adding Gun to the application resource file + +[source,erlang] +{applications, [ + kernel, + stdlib, + gun +]} + +Do not put an extra comma at the end, the comma is a separator +between the elements of the list. |