Skip to content

Commit

Permalink
Add mix test.watch
Browse files Browse the repository at this point in the history
  • Loading branch information
rwdaigle committed Jun 12, 2024
1 parent cf29fac commit 975c0c9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
5 changes: 3 additions & 2 deletions lib/context.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
defmodule Metrix.Context do

use Agent

@doc """
Expand All @@ -8,6 +7,7 @@ defmodule Metrix.Context do
def start_link(initial_context) when is_list(initial_context) do
Enum.into(initial_context, %{}) |> start_link
end

def start_link(initial_context) when is_map(initial_context) do
Agent.start_link(fn -> initial_context end, name: __MODULE__)
end
Expand All @@ -16,13 +16,14 @@ defmodule Metrix.Context do
Gets current context
"""
def get do
Agent.get(__MODULE__, &(&1))
Agent.get(__MODULE__, & &1)
end

@doc """
Adds the `metadata` to the context
"""
def put(metadata) when is_list(metadata), do: Enum.into(metadata, %{}) |> put

def put(metadata) when is_map(metadata) do
Agent.update(__MODULE__, &Map.merge(&1, metadata))
end
Expand Down
25 changes: 14 additions & 11 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ defmodule Metrix.Mixfile do
use Mix.Project

def project do
[app: :metrix,
version: "1.0.0",
description: description(),
elixir: ">= 1.3.0",
deps: deps(),
package: package(),
source_url: "https://github.com/rwdaigle/metrix"]
[
app: :metrix,
version: "1.0.0",
description: description(),
elixir: ">= 1.3.0",
deps: deps(),
package: package(),
source_url: "https://github.com/rwdaigle/metrix"
]
end

# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[applications: [:logger, :logfmt],
mod: {Metrix, []}]
[applications: [:logger, :logfmt], mod: {Metrix, []}]
end

# Dependencies can be Hex packages:
Expand All @@ -30,7 +31,8 @@ defmodule Metrix.Mixfile do
# Type `mix help deps` for more examples and options
defp deps do
[
{:logfmt, "~> 3.3"}
{:logfmt, "~> 3.3"},
{:mix_test_watch, "~> 1.0", only: [:dev, :test], runtime: false}
]
end

Expand All @@ -50,7 +52,8 @@ defmodule Metrix.Mixfile do
"Kevin Lewis <kevin@spreedly.com>",
"Emanuel Evans <mail@emanuel.industries>",
"Stephen Ball <sdball@gmail.com>",
"David Santoso"],
"David Santoso"
],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/rwdaigle/metrix"},
files: ~w(mix.exs lib README.md)
Expand Down
4 changes: 3 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%{
"logfmt": {:hex, :logfmt, "3.3.3", "6521ee4a5c532088e15d487fab9f736c07bdd161d643560c73cd4b10685deb65", [:mix], [], "hexpm", "dbd51cd3fe37c3429b9bd687bad1f531a533505f4a641592129e7a47e24104d1"}
"file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"},
"logfmt": {:hex, :logfmt, "3.3.3", "6521ee4a5c532088e15d487fab9f736c07bdd161d643560c73cd4b10685deb65", [:mix], [], "hexpm", "dbd51cd3fe37c3429b9bd687bad1f531a533505f4a641592129e7a47e24104d1"},
"mix_test_watch": {:hex, :mix_test_watch, "1.2.0", "1f9acd9e1104f62f280e30fc2243ae5e6d8ddc2f7f4dc9bceb454b9a41c82b42", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "278dc955c20b3fb9a3168b5c2493c2e5cffad133548d307e0a50c7f2cfbf34f6"},
}

0 comments on commit 975c0c9

Please sign in to comment.