Packages

A configurable mix task to watch file changes Watch file changes in a project and run the corresponding command when a change happens.

Current section

Files

Jump to
eye_drops lib tasks path.ex
Raw

lib/tasks/path.ex

defmodule EyeDrops.Tasks.Path do
def exists?(path) do
Enum.count(Path.wildcard(path)) > 0
end
def spotted?(changed_file, path_pattern) when is_list(path_pattern) do
Enum.any?(path_pattern, fn(path) ->
String.contains?(changed_file, Path.wildcard(path))
end)
end
def spotted?(changed_file, path_pattern) when is_binary(path_pattern) do
cond do
String.contains?(path_pattern, "*") ->
pattern = Path.wildcard(path_pattern)
true ->
pattern = path_pattern
end
String.contains?(changed_file, pattern)
end
end