From 87b5bb263c0b8f145cd3331ed8f7db8a61ffa3e6 Mon Sep 17 00:00:00 2001 From: Benjamin Chodoroff Date: Tue, 5 Jul 2016 16:04:07 -0400 Subject: [PATCH] only run elixir code ignore, for example, editor swapfiles --- lib/watcher.ex | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/watcher.ex b/lib/watcher.ex index 1b17068..4d7aac1 100644 --- a/lib/watcher.ex +++ b/lib/watcher.ex @@ -13,16 +13,18 @@ defmodule Watcher do end defp reload(file) do - try do - file - |> normalize - |> Code.load_file - |> Enum.map(&(elem(&1, 0))) - |> Enum.find(&Runner.koan?/1) - |> Runner.modules_to_run - |> Runner.run - rescue - e -> Display.show_compile_error(e) + if Path.extname(file) == ".ex" do + try do + file + |> normalize + |> Code.load_file + |> Enum.map(&(elem(&1, 0))) + |> Enum.find(&Runner.koan?/1) + |> Runner.modules_to_run + |> Runner.run + rescue + e -> Display.show_compile_error(e) + end end end