chore: scaffold project
This commit is contained in:
parent
57403e9e34
commit
25b4401910
11 changed files with 154 additions and 0 deletions
4
2021/.formatter.exs
Normal file
4
2021/.formatter.exs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Used by "mix format"
|
||||||
|
[
|
||||||
|
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|
||||||
|
]
|
27
2021/.gitignore
vendored
Normal file
27
2021/.gitignore
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# The directory Mix will write compiled artifacts to.
|
||||||
|
/_build/
|
||||||
|
|
||||||
|
# If you run "mix test --cover", coverage assets end up here.
|
||||||
|
/cover/
|
||||||
|
|
||||||
|
# The directory Mix downloads your dependencies sources to.
|
||||||
|
/deps/
|
||||||
|
|
||||||
|
# Where third-party dependencies like ExDoc output generated docs.
|
||||||
|
/doc/
|
||||||
|
|
||||||
|
# Ignore .fetch files in case you like to edit your project deps locally.
|
||||||
|
/.fetch
|
||||||
|
|
||||||
|
# If the VM crashes, it generates a dump, let's ignore it too.
|
||||||
|
erl_crash.dump
|
||||||
|
|
||||||
|
# Also ignore archive artifacts (built via "mix archive.build").
|
||||||
|
*.ez
|
||||||
|
|
||||||
|
# Ignore package tarball (built via "mix hex.build").
|
||||||
|
advent_of_code-*.tar
|
||||||
|
|
||||||
|
|
||||||
|
# Temporary files for e.g. tests
|
||||||
|
/tmp
|
2
2021/.tool-versions
Normal file
2
2021/.tool-versions
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
erlang 24.1.4
|
||||||
|
elixir 1.12.3-otp-24
|
22
2021/README.md
Normal file
22
2021/README.md
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# Advent of Code 2021
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Setup</summary>
|
||||||
|
|
||||||
|
Using [asdf]:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
asdf plugin add erlang
|
||||||
|
asdf plugin add elixir
|
||||||
|
asdf install
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
| S | M | T | W | T | F | S |
|
||||||
|
| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
|
||||||
|
| | | | 1 | 2 | 3 | 4 |
|
||||||
|
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
|
||||||
|
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
|
||||||
|
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
|
||||||
|
|
||||||
|
[asdf]: https://asdf-vm.com/#/
|
18
2021/lib/advent_of_code.ex
Normal file
18
2021/lib/advent_of_code.ex
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
defmodule AdventOfCode do
|
||||||
|
@moduledoc """
|
||||||
|
Documentation for `AdventOfCode`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Hello world.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> AdventOfCode.hello()
|
||||||
|
:world
|
||||||
|
|
||||||
|
"""
|
||||||
|
def hello do
|
||||||
|
:world
|
||||||
|
end
|
||||||
|
end
|
5
2021/lib/mix/advent_of_code.ex
Normal file
5
2021/lib/mix/advent_of_code.ex
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
defmodule Mix.AdventOfCode do
|
||||||
|
@moduledoc """
|
||||||
|
Helpers for `AdventOfCode` mix tasks.
|
||||||
|
"""
|
||||||
|
end
|
21
2021/lib/mix/tasks/advent_of_code.gen.solution.exs
Normal file
21
2021/lib/mix/tasks/advent_of_code.gen.solution.exs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
defmodule Mix.Tasks.AdventOfCode.Gen.Solution do
|
||||||
|
use Mix.Task
|
||||||
|
import Mix.Generator
|
||||||
|
|
||||||
|
@shortdoc "Generate a new solution module"
|
||||||
|
|
||||||
|
@moduledoc """
|
||||||
|
#{@shortdoc}.
|
||||||
|
|
||||||
|
Includes new solution module, test, and empty problem input.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
# Generate solution modules, tests, and empty input for Day 2
|
||||||
|
$ mix advent_of_code.gen.solution 2
|
||||||
|
"""
|
||||||
|
|
||||||
|
@impl Mix.Task
|
||||||
|
def run(_args) do
|
||||||
|
end
|
||||||
|
end
|
18
2021/lib/mix/tasks/advent_of_code.solve.exs
Normal file
18
2021/lib/mix/tasks/advent_of_code.solve.exs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
defmodule Mix.Tasks.AdventOfCode.Solve do
|
||||||
|
use Mix.Task
|
||||||
|
|
||||||
|
@shortdoc "Runs solution code with problem input"
|
||||||
|
|
||||||
|
@moduledoc """
|
||||||
|
#{@shortdoc}.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
# Run Day 2, Part 1 solution program
|
||||||
|
$ mix advent_of_code.solve 2.1
|
||||||
|
"""
|
||||||
|
|
||||||
|
@impl Mix.Task
|
||||||
|
def run(_args) do
|
||||||
|
end
|
||||||
|
end
|
28
2021/mix.exs
Normal file
28
2021/mix.exs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
defmodule AdventOfCode.MixProject do
|
||||||
|
use Mix.Project
|
||||||
|
|
||||||
|
def project do
|
||||||
|
[
|
||||||
|
app: :advent_of_code,
|
||||||
|
version: "0.1.0",
|
||||||
|
elixir: "~> 1.11",
|
||||||
|
start_permanent: Mix.env() == :prod,
|
||||||
|
deps: deps()
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run "mix help compile.app" to learn about applications.
|
||||||
|
def application do
|
||||||
|
[
|
||||||
|
extra_applications: [:logger]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
# Run "mix help deps" to learn about dependencies.
|
||||||
|
defp deps do
|
||||||
|
[
|
||||||
|
# {:dep_from_hexpm, "~> 0.3.0"},
|
||||||
|
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
8
2021/test/advent_of_code_test.exs
Normal file
8
2021/test/advent_of_code_test.exs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
defmodule AdventOfCodeTest do
|
||||||
|
use ExUnit.Case
|
||||||
|
doctest AdventOfCode
|
||||||
|
|
||||||
|
test "greets the world" do
|
||||||
|
assert AdventOfCode.hello() == :world
|
||||||
|
end
|
||||||
|
end
|
1
2021/test/test_helper.exs
Normal file
1
2021/test/test_helper.exs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ExUnit.start()
|
Loading…
Reference in a new issue