From e00ef8ede804cdefb73987fa290c9aeee7a6191e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@dashbit.co> Date: Tue, 4 Feb 2020 20:29:08 +0100 Subject: [PATCH] Fix Elixir warnings (#62) --- config/config.exs | 2 +- lib/file_system/backends/fs_mac.ex | 2 +- mix.exs | 6 +++--- test/file_system_test.exs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/config.exs b/config/config.exs index fd677f1..4a99dfd 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,5 +1,5 @@ use Mix.Config -if :test == Mix.env do +if :test == Mix.env() do config :logger, backends: [] end diff --git a/lib/file_system/backends/fs_mac.ex b/lib/file_system/backends/fs_mac.ex index 4bc876c..cd0236a 100644 --- a/lib/file_system/backends/fs_mac.ex +++ b/lib/file_system/backends/fs_mac.ex @@ -174,7 +174,7 @@ defmodule FileSystem.Backends.FSMac do def parse_line(line) do [_, _, events, path] = line |> to_string |> String.split(["\t", "="], parts: 4) - {path, events |> String.split(~w|[ , ]|, trim: true) |> Enum.map(&String.to_existing_atom/1)} + {path, events |> String.split(["[", ",", "]"], trim: true) |> Enum.map(&String.to_existing_atom/1)} end end diff --git a/mix.exs b/mix.exs index 1dfd96d..c1bc425 100644 --- a/mix.exs +++ b/mix.exs @@ -9,7 +9,7 @@ defmodule FileSystem.Mixfile do description: "A file system change watcher wrapper based on [fs](https://github.com/synrc/fs)", source_url: "https://github.com/falood/file_system", package: package(), - compilers: [:file_system | Mix.compilers], + compilers: [:file_system | Mix.compilers()], aliases: ["compile.file_system": &file_system/1], docs: [ extras: ["README.md"], @@ -31,7 +31,7 @@ defmodule FileSystem.Mixfile do end defp file_system(_args) do - case :os.type do + case :os.type() do {:unix, :darwin} -> compile_mac() _ -> :ok end @@ -45,7 +45,7 @@ defmodule FileSystem.Mixfile do if Mix.Utils.stale?(Path.wildcard(source), [target]) do Logger.info "Compiling file system watcher for Mac..." cmd = "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations #{source} -o #{target}" - if Mix.shell.cmd(cmd) > 0 do + if Mix.shell().cmd(cmd) > 0 do Logger.error "Could not compile file system watcher for Mac, try to run #{inspect cmd} manually inside the dependency." else Logger.info "Done." diff --git a/test/file_system_test.exs b/test/file_system_test.exs index 750b5d3..2026933 100644 --- a/test/file_system_test.exs +++ b/test/file_system_test.exs @@ -22,7 +22,7 @@ defmodule FileSystemTest do File.touch("#{tmp_dir}/b") assert_receive {:file_event, ^pid, {_path, _events}}, 5000 - Port.list + Port.list() |> Enum.reject(fn port -> :undefined == port |> Port.info |> Access.get(:os_pid) end) -- GitLab