Skip to content

Commit bb4dbb4

Browse files
committed
feat: Generate user modules using modkit mounts
1 parent 0f8a54b commit bb4dbb4

File tree

10 files changed

+35
-659
lines changed

10 files changed

+35
-659
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import Config
5656

5757
# The prefix is used when creating solutions and test modules with
5858
# `mix aoc.create`.
59-
config :aoc, prefix: MyApp
59+
config :aoc, prefix: MyApp.Solutions
6060
```
6161

6262

@@ -319,7 +319,7 @@ be called by `mix aoc.run` and the generated tests.
319319
(Note: You can generate modules without the help comments by passing the `-C` flag in `mix aoc.create`.)
320320

321321
```elixir
322-
defmodule MyApp.Y24.Day01 do
322+
defmodule MyApp.Solutions.Y24.Day01 do
323323
alias AoC.Input
324324

325325
def parse(input, _part) do

lib/aoc/grid.ex

Lines changed: 0 additions & 165 deletions
This file was deleted.

lib/aoc/mod.ex

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,30 @@ defmodule AoC.Mod do
1818
defp prefix do
1919
Application.fetch_env!(:aoc, :prefix)
2020
end
21+
22+
def module_path(module) do
23+
modkit_mount = Modkit.load_current_project().mount
24+
25+
case Modkit.Mount.preferred_path(modkit_mount, module) do
26+
{:ok, path} ->
27+
path
28+
29+
{:error, :not_mounted} ->
30+
raise """
31+
invalid modkit configuration
32+
33+
If you use Modkit in your project, make sure that the configured prefix
34+
for AoC is defined in your mount points.
35+
36+
# Module
37+
#{inspect(module)}
38+
39+
# AoC config
40+
config :aoc, prefix: #{inspect(prefix())}
41+
42+
# Modkit config
43+
#{inspect(modkit_mount)}
44+
"""
45+
end
46+
end
2147
end

lib/aoc/permutations.ex

Lines changed: 0 additions & 37 deletions
This file was deleted.

lib/aoc/rect.ex

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)