Skip to content

Commit cd06d9b

Browse files
authored
Resolve umbrella project bugs (#16)
* Resolve umbrella project bugs * My inner python is coming out... explicit is better than implicit
1 parent ec0bfb6 commit cd06d9b

3 files changed

Lines changed: 28 additions & 16 deletions

File tree

.tool-versions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
erlang 27.1.2
2-
elixir 1.17.3-otp-27
1+
erlang 27.2
2+
elixir 1.18.0-otp-27

lib/exposure.ex

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ defmodule Exposure do
1515

1616
@snapshot_directory Application.compile_env(:exposure, :snapshot_directory, "_snapshots")
1717
@snapshot_test_tag Application.compile_env(:exposure, :snapshot_test_tag, :snapshot)
18-
@test_paths Keyword.get(Mix.Project.config(), :test_paths, [])
1918

2019
################################
2120
# Public API
@@ -125,18 +124,31 @@ defmodule Exposure do
125124
end
126125

127126
defp test_paths do
128-
:persistent_term.get({__MODULE__, :test_paths})
127+
key = {__MODULE__, Mix.Project.get!(), :test_paths}
128+
129+
case fetch_test_paths(key) do
130+
{:ok, paths} -> paths
131+
:error -> put_test_paths(key)
132+
end
133+
end
134+
135+
defp fetch_test_paths(key) do
136+
{:ok, :persistent_term.get(key)}
129137
rescue
130-
ArgumentError ->
131-
paths =
132-
@test_paths
133-
|> maybe_add_default_path()
134-
|> Enum.map(&Path.expand/1)
135-
|> Enum.sort()
136-
|> Enum.reduce([], &maybe_add_test_path/2)
137-
138-
:persistent_term.put({__MODULE__, :test_paths}, paths)
139-
paths
138+
ArgumentError -> :error
139+
end
140+
141+
defp put_test_paths(key) do
142+
paths =
143+
Mix.Project.config()
144+
|> Keyword.get(:test_paths, [])
145+
|> maybe_add_default_path()
146+
|> Enum.map(&Path.expand/1)
147+
|> Enum.sort()
148+
|> Enum.reduce([], &maybe_add_test_path/2)
149+
150+
:persistent_term.put(key, paths)
151+
paths
140152
end
141153

142154
defp maybe_add_default_path([]) do

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule Exposure.MixProject do
22
use Mix.Project
33

4-
@version "1.0.0"
4+
@version "1.1.0"
55

66
################################
77
# Public API
@@ -21,7 +21,7 @@ defmodule Exposure.MixProject do
2121
description: description(),
2222
dialyzer: dialyzer(),
2323
docs: docs(),
24-
elixir: "~> 1.16",
24+
elixir: "~> 1.18",
2525
name: "Exposure",
2626
package: package(),
2727
preferred_cli_env: preferred_cli_env(),

0 commit comments

Comments
 (0)