Current section
12 Versions
Jump to
Current section
12 Versions
Compare versions
7
files changed
+44
additions
-16
deletions
| @@ -70,6 +70,11 @@ config :myapp, | |
| 70 70 | divo_wait: [dwell: 700, max_tries: 50] |
| 71 71 | ``` |
| 72 72 | |
| 73 | + ##### Known Modules: |
| 74 | + - [Kafka](https://github.com/smartcitiesdata/divo_kafka) |
| 75 | + - [Redis](https://github.com/smartcitiesdata/divo_redis) |
| 76 | + - [Machinebox](https://github.com/joshrotenberg/divo_machinebox) |
| 77 | + |
| 73 78 | #### Method 3 - Elixir map |
| 74 79 | ```elixir |
| 75 80 | #config/config.exs |
| @@ -4,12 +4,13 @@ | |
| 4 4 | <<"A library for easily constructing integration service dependencies in docker and orchestrating with mix.">>}. |
| 5 5 | {<<"elixir">>,<<"~> 1.8">>}. |
| 6 6 | {<<"files">>, |
| 7 | - [<<"lib">>,<<"lib/divo">>,<<"lib/divo/validate.ex">>,<<"lib/divo/file.ex">>, |
| 7 | + [<<"lib">>,<<"lib/divo">>,<<"lib/divo/validate.ex">>, |
| 8 8 | <<"lib/divo/helper.ex">>,<<"lib/divo/stack.ex">>,<<"lib/divo/compose.ex">>, |
| 9 | - <<"lib/divo.ex">>,<<"lib/mix">>,<<"lib/mix/tasks">>, |
| 10 | - <<"lib/mix/tasks/docker_start.ex">>,<<"lib/mix/tasks/test_integration.ex">>, |
| 11 | - <<"lib/mix/tasks/docker_stop.ex">>,<<"lib/mix/tasks/docker_kill.ex">>, |
| 12 | - <<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}. |
| 9 | + <<"lib/divo/file.ex">>,<<"lib/divo/case.ex">>,<<"lib/divo.ex">>, |
| 10 | + <<"lib/mix">>,<<"lib/mix/tasks">>,<<"lib/mix/tasks/docker_start.ex">>, |
| 11 | + <<"lib/mix/tasks/test_integration.ex">>,<<"lib/mix/tasks/docker_stop.ex">>, |
| 12 | + <<"lib/mix/tasks/docker_kill.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 13 | + <<"README.md">>,<<"LICENSE">>]}. |
| 13 14 | {<<"licenses">>,[<<"Apache 2.0">>]}. |
| 14 15 | {<<"links">>,[{<<"GitHub">>,<<"https://github.com/smartcitiesdata/divo">>}]}. |
| 15 16 | {<<"name">>,<<"divo">>}. |
| @@ -24,4 +25,4 @@ | |
| 24 25 | {<<"optional">>,false}, |
| 25 26 | {<<"repository">>,<<"hexpm">>}, |
| 26 27 | {<<"requirement">>,<<"~> 0.2">>}]]}. |
| 27 | - {<<"version">>,<<"1.1.9">>}. |
| 28 | + {<<"version">>,<<"1.2.0">>}. |
| @@ -14,6 +14,7 @@ defmodule Divo do | |
| 14 14 | """ |
| 15 15 | defmacro __using__(opts \\ []) do |
| 16 16 | auto_start = Keyword.get(opts, :auto_start, true) |
| 17 | + post_docker_run = Keyword.get(opts, :post_docker_run, []) |
| 17 18 | |
| 18 19 | quote do |
| 19 20 | import Divo.Compose |
| @@ -21,6 +22,9 @@ defmodule Divo do | |
| 21 22 | setup_all do |
| 22 23 | Divo.Compose.run(unquote(opts)) |
| 23 24 | |
| 25 | + unquote(post_docker_run) |
| 26 | + |> Enum.each(& &1.()) |
| 27 | + |
| 24 28 | app = Mix.Project.config() |> Keyword.get(:app) |
| 25 29 | if unquote(auto_start), do: Application.ensure_all_started(app) |
| @@ -0,0 +1,16 @@ | |
| 1 | + defmodule Divo.Case do |
| 2 | + @moduledoc """ |
| 3 | + Can be used in place of Divo to also include ExUnit.Case. |
| 4 | + Opts will still be passed to Divo as normal, and the async |
| 5 | + opt will be passed only to ExUnit.Case. |
| 6 | + """ |
| 7 | + |
| 8 | + defmacro __using__(opts \\ []) do |
| 9 | + {async, opts} = Keyword.pop(opts, :async, false) |
| 10 | + |
| 11 | + quote do |
| 12 | + use ExUnit.Case, async: unquote(async) |
| 13 | + use Divo, unquote(opts) |
| 14 | + end |
| 15 | + end |
| 16 | + end |
| @@ -14,7 +14,7 @@ defmodule Divo.Compose do | |
| 14 14 | call to start the entirety of the defined stack or a subset of the services |
| 15 15 | defined in the stack based on supplying an optional list of service keys. |
| 16 16 | """ |
| 17 | - @spec run(keyword()) :: none() |
| 17 | + @spec run(keyword()) :: [any()] |
| 18 18 | def run(opts \\ []) do |
| 19 19 | services = get_services(opts) |
| 20 20 | |
| @@ -29,7 +29,7 @@ defmodule Divo.Compose do | |
| 29 29 | call to stop the containerized services without removing the resources created |
| 30 30 | by the compose file. |
| 31 31 | """ |
| 32 | - @spec stop() :: none() |
| 32 | + @spec stop() :: :ok | {:error, any()} |
| 33 33 | def stop() do |
| 34 34 | execute("stop") |
| 35 35 | end |
| @@ -39,7 +39,7 @@ defmodule Divo.Compose do | |
| 39 39 | call to stop the containerized services and removes all resources created by |
| 40 40 | the compose file such as containers, networks, and volumes. |
| 41 41 | """ |
| 42 | - @spec kill() :: none() |
| 42 | + @spec kill() :: :ok | {:error, any()} |
| 43 43 | def kill() do |
| 44 44 | execute("down") |
| 45 45 | end |
Loading more files…