Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades Elixir and dependencies #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
sudo: required

services:
- docker
language: elixir
elixir:
- 1.5.1
otp_release:
- 20.0

before_install:
- docker build -t operable/probe-testing -f Dockerfile.ci .

# Need the job ID in order to upload the Coveralls data
- mix do local.hex --force, local.rebar --force
- MIX_ENV=test mix deps.get
script:
- docker run -it --rm --env="TRAVIS_JOB_ID=${TRAVIS_JOB_ID}" operable/probe-testing mix coveralls.travis
- "MIX_ENV=test mix coveralls.travis"

notifications:
slack:
Expand Down
4 changes: 1 addition & 3 deletions lib/probe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ defmodule Probe do
@doc """
Send an event to be logged.
"""
def notify(event),
do: GenEvent.sync_notify(Probe.EventManager, event)

def notify(event), do: GenEvent.sync_notify(Probe.EventManager, event)
end
8 changes: 4 additions & 4 deletions lib/probe/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ defmodule Probe.Configuration do
Probe's logs (`:probe/:log_directory`). Defaults to `audit_logs` in
the current directory.
"""
def log_directory,
do: Path.absname(Application.get_env(:probe, :log_directory, "audit_logs"))
def log_directory do
Path.absname(Application.get_env(:probe, :log_directory, "audit_logs"))
end

@doc """
Raises a `Probe.ConfigurationError` if the log directory exists and
Expand All @@ -19,7 +20,7 @@ defmodule Probe.Configuration do
Does _not_ perform any checks that the directory can be written to.
"""
def ensure_log_directory! do
dir = log_directory
dir = log_directory()
if File.exists?(dir) do
if File.dir?(dir) do
:ok
Expand All @@ -38,5 +39,4 @@ defmodule Probe.Configuration do
Logger.info("Writing audit logs to the `#{dir}` directory")
:ok
end

end
4 changes: 1 addition & 3 deletions lib/probe/event_manager.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
defmodule Probe.EventManager do

@doc """
Starts the GenEvent manager and adds the `Probe.JSONLogHandler` to
it.
"""
def start_link() do
Probe.Configuration.ensure_log_directory!
Probe.Configuration.ensure_log_directory!()
{:ok, pid} = GenEvent.start_link(name: __MODULE__)
:ok = GenEvent.add_handler(__MODULE__, Probe.JSONLogHandler, [])
{:ok, pid}
end

end
5 changes: 2 additions & 3 deletions lib/probe/json_log_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Probe.JSONLogHandler do
defstruct [log_file: nil]

def init(_) do
path = log_path
path = log_path()
Logger.info("Attempting to open JSON-formatted event log file `#{path}`")
case TolerantFile.open(path) do
{:ok, file} ->
Expand Down Expand Up @@ -55,7 +55,6 @@ defmodule Probe.JSONLogHandler do
end
end

defp log_path,
do: Path.join(Probe.Configuration.log_directory, @log_file)
defp log_path, do: Path.join(Probe.Configuration.log_directory, @log_file)

end
7 changes: 2 additions & 5 deletions lib/probe/tolerant_file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ defmodule Probe.TolerantFile do
@doc """
Closes the underlying file descriptor of `file`.
"""
def close(%__MODULE__{}=file),
do: File.close(file.fd)
def close(%__MODULE__{}=file), do: File.close(file.fd)

@doc """
Appends `content` to `file`, respecting underlying file closings. A
Expand Down Expand Up @@ -109,8 +108,7 @@ defmodule Probe.TolerantFile do
end

# Ensure unicode and intervening newlines
defp do_put(fd, content),
do: :file.write(fd, to_string(content <> "\n"))
defp do_put(fd, content), do: :file.write(fd, to_string(content <> "\n"))

@doc """
Heuristically determine whether or not a TolerantFile still points
Expand All @@ -131,5 +129,4 @@ defmodule Probe.TolerantFile do
true
end
end

end
13 changes: 6 additions & 7 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ defmodule Probe.Mixfile do
def project do
[app: :probe,
version: "1.1.0",
elixir: "~> 1.3.1",
elixir: "~> 1.5.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: ["coveralls": :test,
"coveralls.html": :test,
"coveralls.travis": :test],
deps: deps]
deps: deps()]
end

def application do
Expand All @@ -20,10 +20,9 @@ defmodule Probe.Mixfile do
end

defp deps do
[{:poison, "~> 2.0"},
{:ex_doc, "~> 0.13", only: :dev},
{:earmark, "~> 1.0", only: :dev},
{:mix_test_watch, "~> 0.2", only: :dev},
{:excoveralls, "~> 0.6", only: :test}]
[{:poison, "~> 3.1"},
{:ex_doc, "~> 0.16", only: :dev},
{:earmark, "~> 1.2", only: :dev},
{:excoveralls, "~> 0.7", only: :test}]
end
end
21 changes: 11 additions & 10 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
%{"certifi": {:hex, :certifi, "1.0.0", "1c787a85b1855ba354f0b8920392c19aa1d06b0ee1362f9141279620a5be2039", [:rebar3], []},
"earmark": {:hex, :earmark, "1.0.1", "2c2cd903bfdc3de3f189bd9a8d4569a075b88a8981ded9a0d95672f6e2b63141", [:mix], []},
"ex_doc": {:hex, :ex_doc, "0.13.0", "aa2f8fe4c6136a2f7cfc0a7e06805f82530e91df00e2bff4b4362002b43ada65", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
"excoveralls": {:hex, :excoveralls, "0.6.2", "0e993d096f1fbb6e70a3daced5c89aac066bda6bce57829622aa2d1e2b338cfb", [:mix], [{:exjsx, "~> 3.0", [hex: :exjsx, optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, optional: false]}]},
"exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d2a1e976f4b428d347614f0f", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, optional: false]}]},
%{"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.3", "206eb2e2ac1a794aa5256f3982de7a76bf4579ff91cb28d0e17ea2c9491e46a4", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.16.4", "4bf6b82d4f0a643b500366ed7134896e8cccdbab4d1a7a35524951b25b1ec9f0", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"excoveralls": {:hex, :excoveralls, "0.7.3", "6c05cc452e6ebfc347fccc0de7339e9bc1ed8678c52765353303fa0d2c44c70d", [:mix], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
"fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []},
"hackney": {:hex, :hackney, "1.7.1", "e238c52c5df3c3b16ce613d3a51c7220a784d734879b1e231c9babd433ac1cb4", [:rebar3], [{:certifi, "1.0.0", [hex: :certifi, optional: false]}, {:idna, "4.0.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
"idna": {:hex, :idna, "4.0.0", "10aaa9f79d0b12cf0def53038547855b91144f1bfcc0ec73494f38bb7b9c4961", [:rebar3], []},
"hackney": {:hex, :hackney, "1.9.0", "51c506afc0a365868469dcfc79a9d0b94d896ec741cfd5bd338f49a5ec515bfe", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
"jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [:mix, :rebar3], []},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
"mix_test_watch": {:hex, :mix_test_watch, "0.2.6", "9fcc2b1b89d1594c4a8300959c19d50da2f0ff13642c8f681692a6e507f92cab", [:mix], [{:fs, "~> 0.9.1", [hex: :fs, optional: false]}]},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []}}
"mix_test_watch": {:hex, :mix_test_watch, "0.5.0", "2c322d119a4795c3431380fca2bca5afa4dc07324bd3c0b9f6b2efbdd99f5ed3", [:mix], [{:fs, "~> 0.9.1", [hex: :fs, repo: "hexpm", optional: false]}], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [], [], "hexpm"}}