Ensure that watcher does not try to run a module that is not a koan
This commit is contained in:
@@ -14,6 +14,10 @@ defmodule Runner do
|
|||||||
Tasks,
|
Tasks,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def koan?(module) do
|
||||||
|
Enum.member?(@modules, module)
|
||||||
|
end
|
||||||
|
|
||||||
def run do
|
def run do
|
||||||
Options.initial_koan
|
Options.initial_koan
|
||||||
|>run
|
|>run
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ defmodule Watcher do
|
|||||||
def callback(file, events) do
|
def callback(file, events) do
|
||||||
if Enum.member?(events, :modified) do
|
if Enum.member?(events, :modified) do
|
||||||
try do
|
try do
|
||||||
[{mod, _} | _] = Code.load_file(file)
|
Code.load_file(file)
|
||||||
Runner.run(mod)
|
|> Enum.map(&(elem(&1, 0)))
|
||||||
|
|> Enum.find(&Runner.koan?/1)
|
||||||
|
|> Runner.run
|
||||||
rescue
|
rescue
|
||||||
e -> Display.show_compile_error(e)
|
e -> Display.show_compile_error(e)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user