| a | b | |
|---|
| 0 | + | %% @author author <author@example.com> |
|---|
| 0 | + | %% @copyright YYYY author. |
|---|
| 0 | + | |
|---|
| 0 | + | %% @doc TEMPLATE. |
|---|
| 0 | + | |
|---|
| 0 | + | -module(myapp). |
|---|
| 0 | + | -author('author <author@example.com>'). |
|---|
| 0 | + | -export([start/0, stop/0]). |
|---|
| 0 | + | |
|---|
| 0 | + | ensure_started(App) -> |
|---|
| 0 | + | case application:start(App) of |
|---|
| 0 | + | ok -> |
|---|
| 0 | + | ok; |
|---|
| 0 | + | {error, {already_started, App}} -> |
|---|
| 0 | + | ok |
|---|
| 0 | + | end. |
|---|
| 0 | + | |
|---|
| 0 | + | %% @spec start() -> ok |
|---|
| 0 | + | %% @doc Start the myapp server. |
|---|
| 0 | + | start() -> |
|---|
| 0 | + | myapp_deps:ensure(), |
|---|
| 0 | + | ensure_started(crypto), |
|---|
| 0 | + | ensure_started(mnesia), |
|---|
| 0 | + | application:start(myapp). |
|---|
| 0 | + | |
|---|
| 0 | + | %% @spec stop() -> ok |
|---|
| 0 | + | %% @doc Stop the myapp server. |
|---|
| 0 | + | stop() -> |
|---|
| 0 | + | Res = application:stop(myapp), |
|---|
| 0 | + | application:stop(mnesia), |
|---|
| 0 | + | application:stop(crypto), |
|---|
| 0 | + | Res. |
|---|
| ... | |
|---|