diff --git a/lib/cortex/application.ex b/lib/cortex/application.ex index 4f7a305..68357e6 100644 --- a/lib/cortex/application.ex +++ b/lib/cortex/application.ex @@ -25,24 +25,16 @@ defmodule Cortex.Application do end defp children do - import Supervisor.Spec, warn: false - - children = [ - worker(FileWatcher, []), - worker(Reloader, []), - worker(Controller, []) - ] - env_specific_children = case Mix.env() do :dev -> [] :test -> - [worker(TestRunner, [])] + [TestRunner] end - children ++ env_specific_children + [FileWatcher, Reloader, Controller] ++ env_specific_children end defp autostart? do diff --git a/lib/cortex/controller.ex b/lib/cortex/controller.ex index 0cd7d37..334d733 100644 --- a/lib/cortex/controller.ex +++ b/lib/cortex/controller.ex @@ -16,7 +16,7 @@ defmodule Cortex.Controller do # Public API ########################################## - def start_link do + def start_link([]) do GenServer.start_link(__MODULE__, [], name: __MODULE__) end @@ -152,7 +152,7 @@ defmodule Cortex.Controller do result = cb.(stage) continue? = - !stage.cancel_on_error? or + !stage.cancel_on_error?() or !match?({:error, _}, result) {result, continue?} diff --git a/lib/cortex/reloader.ex b/lib/cortex/reloader.ex index 7896d3e..f9923e4 100644 --- a/lib/cortex/reloader.ex +++ b/lib/cortex/reloader.ex @@ -14,8 +14,8 @@ defmodule Cortex.Reloader do # Public API ########################################## - @spec start_link :: GenServer.on_start() - def start_link do + @spec start_link([]) :: GenServer.on_start() + def start_link([]) do GenServer.start_link(__MODULE__, [], name: __MODULE__) end diff --git a/lib/cortex/test_runner.ex b/lib/cortex/test_runner.ex index f525051..25d9ffc 100644 --- a/lib/cortex/test_runner.ex +++ b/lib/cortex/test_runner.ex @@ -10,8 +10,8 @@ defmodule Cortex.TestRunner do # Public API ########################################## - @spec start_link :: GenServer.on_start() - def start_link do + @spec start_link([]) :: GenServer.on_start() + def start_link([]) do GenServer.start_link(__MODULE__, [], name: __MODULE__) end diff --git a/mix.exs b/mix.exs index 74791f2..17e9e72 100644 --- a/mix.exs +++ b/mix.exs @@ -12,7 +12,9 @@ defmodule Cortex.Mixfile do deps: deps(), package: package(), description: description(), - dialyzer: [ignore_warnings: "./.dialyzer-ignore-warnings.txt"] + dialyzer: [ignore_warnings: "./.dialyzer-ignore-warnings.txt"], + elixirc_paths: elixir_paths(Mix.env()), + xref: [exclude: [IEx.Helpers]] ] end @@ -62,4 +64,7 @@ defmodule Cortex.Mixfile do {:ex_dash, "~> 0.1.0", only: [:dev]} ] end + + def elixir_paths(:test), do: ["lib", "test/fixtures/initials"] + def elixir_paths(_), do: ["lib"] end diff --git a/mix.lock b/mix.lock index 2095ab5..4ba1891 100644 --- a/mix.lock +++ b/mix.lock @@ -1,15 +1,15 @@ %{ - "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, - "credo": {:hex, :credo, "0.9.2", "841d316612f568beb22ba310d816353dddf31c2d94aa488ae5a27bb53760d0bf", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, - "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, - "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm"}, - "ex_dash": {:hex, :ex_dash, "0.1.5", "cec8f0820f88539eeba71e88e12f64db1588c443e92216d881512097d88ef0ad", [:mix], [{:ex_doc, "~> 0.15", [hex: :ex_doc, repo: "hexpm", optional: false]}, {:floki, "~> 0.14.0", [hex: :floki, repo: "hexpm", optional: false]}], "hexpm"}, - "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"}, - "file_system": {:hex, :file_system, "0.2.0", "1b899a8708dd121648b4f4f632022cf8fd989f3d7250621f34eca4831b217ee9", [:mix], [], "hexpm"}, - "floki": {:hex, :floki, "0.14.0", "91a6be57349e10a63cf52d7890479a19012cef9185fa93c305d4fe42e6a50dee", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"}, - "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm"}, - "mochiweb": {:hex, :mochiweb, "2.15.0", "e1daac474df07651e5d17cc1e642c4069c7850dc4508d3db7263a0651330aacc", [:rebar3], [], "hexpm"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm"}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "credo": {:hex, :credo, "0.9.2", "841d316612f568beb22ba310d816353dddf31c2d94aa488ae5a27bb53760d0bf", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "8394e6ad3f53b74a75013f79b8104c935add0247ec5dfcde7f444ffe509000c0"}, + "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm", "6c32a70ed5d452c6650916555b1f96c79af5fc4bf286997f8b15f213de786f73"}, + "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"}, + "ex_dash": {:hex, :ex_dash, "0.1.5", "cec8f0820f88539eeba71e88e12f64db1588c443e92216d881512097d88ef0ad", [:mix], [{:ex_doc, "~> 0.15", [hex: :ex_doc, repo: "hexpm", optional: false]}, {:floki, "~> 0.14.0", [hex: :floki, repo: "hexpm", optional: false]}], "hexpm", "27ba5725a230393c0b7240a9d49c1dea41333f52fc6a2ad9bddf08c7b0a40792"}, + "ex_doc": {:hex, :ex_doc, "0.21.2", "caca5bc28ed7b3bdc0b662f8afe2bee1eedb5c3cf7b322feeeb7c6ebbde089d6", [:mix], [{:earmark, "~> 1.3.3 or ~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f1155337ae17ff7a1255217b4c1ceefcd1860b7ceb1a1874031e7a861b052e39"}, + "file_system": {:hex, :file_system, "0.2.0", "1b899a8708dd121648b4f4f632022cf8fd989f3d7250621f34eca4831b217ee9", [:mix], [], "hexpm", "7d69c554254e5c91f1bc02febd72114995efe34cd07257b4d2a225e17bbf55c5"}, + "floki": {:hex, :floki, "0.14.0", "91a6be57349e10a63cf52d7890479a19012cef9185fa93c305d4fe42e6a50dee", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm", "d21b1e459b218718c20defebb8dec6826091f67b0f58e6d0d0762294cc7150d3"}, + "makeup": {:hex, :makeup, "1.0.0", "671df94cf5a594b739ce03b0d0316aa64312cee2574b6a44becb83cd90fb05dc", [:mix], [{:nimble_parsec, "~> 0.5.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "a10c6eb62cca416019663129699769f0c2ccf39428b3bb3c0cb38c718a0c186d"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.14.0", "cf8b7c66ad1cff4c14679698d532f0b5d45a3968ffbcbfd590339cb57742f1ae", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "d4b316c7222a85bbaa2fd7c6e90e37e953257ad196dc229505137c5e505e9eff"}, + "mochiweb": {:hex, :mochiweb, "2.15.0", "e1daac474df07651e5d17cc1e642c4069c7850dc4508d3db7263a0651330aacc", [:rebar3], [], "hexpm", "b960d1cbcf40a30963eeee90ab7aeae074cbfa9a238561fb4434add1afc3075c"}, + "nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"}, + "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, } diff --git a/test/cortex/reloader_test.exs b/test/cortex/reloader_test.exs index d5ea802..c53b139 100644 --- a/test/cortex/reloader_test.exs +++ b/test/cortex/reloader_test.exs @@ -17,12 +17,6 @@ defmodule Cortex.ReloaderTest do describe "recompiles files" do test "recompiles a file", %{state: state} do - path = fixture_for("hello.ex") - - assert ExUnit.CaptureLog.capture_log(fn -> - {:reply, :ok, _} = Reloader.handle_call({:reload_file, path}, nil, state) - end) =~ "reloaded test/fixtures/hello.ex" - assert Hello.hi() == "hello" path = fixture_for("hello_2.ex") diff --git a/test/fixtures/hello.ex b/test/fixtures/initials/hello.ex similarity index 100% rename from test/fixtures/hello.ex rename to test/fixtures/initials/hello.ex