Skip to content
Snippets Groups Projects
Unverified Commit e00ef8ed authored by José Valim's avatar José Valim Committed by GitHub
Browse files

Fix Elixir warnings (#62)

parent 76e6a06e
No related tags found
No related merge requests found
use Mix.Config use Mix.Config
if :test == Mix.env do if :test == Mix.env() do
config :logger, backends: [] config :logger, backends: []
end end
...@@ -174,7 +174,7 @@ defmodule FileSystem.Backends.FSMac do ...@@ -174,7 +174,7 @@ defmodule FileSystem.Backends.FSMac do
def parse_line(line) do def parse_line(line) do
[_, _, events, path] = line |> to_string |> String.split(["\t", "="], parts: 4) [_, _, 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
end end
...@@ -9,7 +9,7 @@ defmodule FileSystem.Mixfile do ...@@ -9,7 +9,7 @@ defmodule FileSystem.Mixfile do
description: "A file system change watcher wrapper based on [fs](https://github.com/synrc/fs)", description: "A file system change watcher wrapper based on [fs](https://github.com/synrc/fs)",
source_url: "https://github.com/falood/file_system", source_url: "https://github.com/falood/file_system",
package: package(), package: package(),
compilers: [:file_system | Mix.compilers], compilers: [:file_system | Mix.compilers()],
aliases: ["compile.file_system": &file_system/1], aliases: ["compile.file_system": &file_system/1],
docs: [ docs: [
extras: ["README.md"], extras: ["README.md"],
...@@ -31,7 +31,7 @@ defmodule FileSystem.Mixfile do ...@@ -31,7 +31,7 @@ defmodule FileSystem.Mixfile do
end end
defp file_system(_args) do defp file_system(_args) do
case :os.type do case :os.type() do
{:unix, :darwin} -> compile_mac() {:unix, :darwin} -> compile_mac()
_ -> :ok _ -> :ok
end end
...@@ -45,7 +45,7 @@ defmodule FileSystem.Mixfile do ...@@ -45,7 +45,7 @@ defmodule FileSystem.Mixfile do
if Mix.Utils.stale?(Path.wildcard(source), [target]) do if Mix.Utils.stale?(Path.wildcard(source), [target]) do
Logger.info "Compiling file system watcher for Mac..." Logger.info "Compiling file system watcher for Mac..."
cmd = "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations #{source} -o #{target}" 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." Logger.error "Could not compile file system watcher for Mac, try to run #{inspect cmd} manually inside the dependency."
else else
Logger.info "Done." Logger.info "Done."
......
...@@ -22,7 +22,7 @@ defmodule FileSystemTest do ...@@ -22,7 +22,7 @@ defmodule FileSystemTest do
File.touch("#{tmp_dir}/b") File.touch("#{tmp_dir}/b")
assert_receive {:file_event, ^pid, {_path, _events}}, 5000 assert_receive {:file_event, ^pid, {_path, _events}}, 5000
Port.list Port.list()
|> Enum.reject(fn port -> |> Enum.reject(fn port ->
:undefined == port |> Port.info |> Access.get(:os_pid) :undefined == port |> Port.info |> Access.get(:os_pid)
end) end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment