From 1a26e63ae98674d1889a284dd18e9eb054816422 Mon Sep 17 00:00:00 2001 From: sloane <1699281+sloanelybutsurely@users.noreply.github.com> Date: Fri, 1 Dec 2023 09:56:12 -0500 Subject: [PATCH] add 2023 elixir project --- 2023/elixir/.formatter.exs | 4 ++++ 2023/elixir/.gitignore | 26 ++++++++++++++++++++++ 2023/elixir/.tool-versions | 2 ++ 2023/elixir/README.md | 21 ++++++++++++++++++ 2023/elixir/lib/advent_of_code.ex | 18 +++++++++++++++ 2023/elixir/mix.exs | 28 ++++++++++++++++++++++++ 2023/elixir/test/advent_of_code_test.exs | 8 +++++++ 2023/elixir/test/test_helper.exs | 1 + 8 files changed, 108 insertions(+) create mode 100644 2023/elixir/.formatter.exs create mode 100644 2023/elixir/.gitignore create mode 100644 2023/elixir/.tool-versions create mode 100644 2023/elixir/README.md create mode 100644 2023/elixir/lib/advent_of_code.ex create mode 100644 2023/elixir/mix.exs create mode 100644 2023/elixir/test/advent_of_code_test.exs create mode 100644 2023/elixir/test/test_helper.exs diff --git a/2023/elixir/.formatter.exs b/2023/elixir/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/2023/elixir/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/2023/elixir/.gitignore b/2023/elixir/.gitignore new file mode 100644 index 0000000..44fe69c --- /dev/null +++ b/2023/elixir/.gitignore @@ -0,0 +1,26 @@ +# 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 example, from tests. +/tmp/ diff --git a/2023/elixir/.tool-versions b/2023/elixir/.tool-versions new file mode 100644 index 0000000..ff52406 --- /dev/null +++ b/2023/elixir/.tool-versions @@ -0,0 +1,2 @@ +erlang 26.1.2 +elixir 1.15.7-otp-26 diff --git a/2023/elixir/README.md b/2023/elixir/README.md new file mode 100644 index 0000000..f37846e --- /dev/null +++ b/2023/elixir/README.md @@ -0,0 +1,21 @@ +# AdventOfCode + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `advent_of_code` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:advent_of_code, "~> 0.1.0"} + ] +end +``` + +Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc) +and published on [HexDocs](https://hexdocs.pm). Once published, the docs can +be found at . + diff --git a/2023/elixir/lib/advent_of_code.ex b/2023/elixir/lib/advent_of_code.ex new file mode 100644 index 0000000..33601c2 --- /dev/null +++ b/2023/elixir/lib/advent_of_code.ex @@ -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 diff --git a/2023/elixir/mix.exs b/2023/elixir/mix.exs new file mode 100644 index 0000000..0fa234e --- /dev/null +++ b/2023/elixir/mix.exs @@ -0,0 +1,28 @@ +defmodule AdventOfCode.MixProject do + use Mix.Project + + def project do + [ + app: :advent_of_code, + version: "0.1.0", + elixir: "~> 1.15", + 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 diff --git a/2023/elixir/test/advent_of_code_test.exs b/2023/elixir/test/advent_of_code_test.exs new file mode 100644 index 0000000..8a98262 --- /dev/null +++ b/2023/elixir/test/advent_of_code_test.exs @@ -0,0 +1,8 @@ +defmodule AdventOfCodeTest do + use ExUnit.Case + doctest AdventOfCode + + test "greets the world" do + assert AdventOfCode.hello() == :world + end +end diff --git a/2023/elixir/test/test_helper.exs b/2023/elixir/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/2023/elixir/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()