From 4da817996d55161b21153afd498ee7ba6f9a6040 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 8 Oct 2023 12:49:42 -0400 Subject: [PATCH] Doing an example mix project --- elixirschool/example/.formatter.exs | 4 +++ elixirschool/example/.gitignore | 26 +++++++++++++++++++ elixirschool/example/README.md | 21 +++++++++++++++ elixirschool/example/lib/example.ex | 18 +++++++++++++ elixirschool/example/mix.exs | 30 ++++++++++++++++++++++ elixirschool/example/mix.lock | 13 ++++++++++ elixirschool/example/test/example_test.exs | 8 ++++++ elixirschool/example/test/test_helper.exs | 1 + 8 files changed, 121 insertions(+) create mode 100644 elixirschool/example/.formatter.exs create mode 100644 elixirschool/example/.gitignore create mode 100644 elixirschool/example/README.md create mode 100644 elixirschool/example/lib/example.ex create mode 100644 elixirschool/example/mix.exs create mode 100644 elixirschool/example/mix.lock create mode 100644 elixirschool/example/test/example_test.exs create mode 100644 elixirschool/example/test/test_helper.exs diff --git a/elixirschool/example/.formatter.exs b/elixirschool/example/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/elixirschool/example/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/elixirschool/example/.gitignore b/elixirschool/example/.gitignore new file mode 100644 index 0000000..e3ca41c --- /dev/null +++ b/elixirschool/example/.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"). +example-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/elixirschool/example/README.md b/elixirschool/example/README.md new file mode 100644 index 0000000..45ffd7b --- /dev/null +++ b/elixirschool/example/README.md @@ -0,0 +1,21 @@ +# Example + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `example` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:example, "~> 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/elixirschool/example/lib/example.ex b/elixirschool/example/lib/example.ex new file mode 100644 index 0000000..0b78d2b --- /dev/null +++ b/elixirschool/example/lib/example.ex @@ -0,0 +1,18 @@ +defmodule Example do + @moduledoc """ + Documentation for `Example`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> Example.hello() + :world + + """ + def hello do + :world + end +end diff --git a/elixirschool/example/mix.exs b/elixirschool/example/mix.exs new file mode 100644 index 0000000..16f34cf --- /dev/null +++ b/elixirschool/example/mix.exs @@ -0,0 +1,30 @@ +defmodule Example.MixProject do + use Mix.Project + + def project do + [ + app: :example, + 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 + [ + {:phoenix, "~> 1.1 or ~> 1.2"}, + {:phoenix_html, "~> 2.3"}, + {:cowboy, "~> 1.0", only: [:dev, :test]}, + {:slime, "~> 0.14"} + ] + end +end diff --git a/elixirschool/example/mix.lock b/elixirschool/example/mix.lock new file mode 100644 index 0000000..6eccaa7 --- /dev/null +++ b/elixirschool/example/mix.lock @@ -0,0 +1,13 @@ +%{ + "cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "f4763bbe08233eceed6f24bc4fcc8d71c17cfeafa6439157c57349aa1bb4f17c"}, + "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm", "db622da03aa039e6366ab953e31186cc8190d32905e33788a1acb22744e6abd2"}, + "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, + "phoenix": {:hex, :phoenix, "1.4.6", "8535f4a01291f0fbc2c30c78c4ca6a2eacc148db5178ad76e8b2fc976c590115", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "17aa6f4909e41eebfa7589b61c71f0ebe8fdea997194fd85596e629bbf8d3e15"}, + "phoenix_html": {:hex, :phoenix_html, "2.14.3", "51f720d0d543e4e157ff06b65de38e13303d5778a7919bcc696599e5934271b8", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "efd697a7fff35a13eeeb6b43db884705cba353a1a41d127d118fda5f90c8e80f"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.2", "496c303bdf1b2e98a9d26e89af5bba3ab487ba3a3735f74bf1f4064d2a845a3e", [:mix], [], "hexpm", "1f13f9f0f3e769a667a6b6828d29dec37497a082d195cc52dbef401a9b69bf38"}, + "plug": {:hex, :plug, "1.15.1", "b7efd81c1a1286f13efb3f769de343236bd8b7d23b4a9f40d3002fc39ad8f74c", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "459497bd94d041d98d948054ec6c0b76feacd28eec38b219ca04c0de13c79d30"}, + "plug_crypto": {:hex, :plug_crypto, "2.0.0", "77515cc10af06645abbfb5e6ad7a3e9714f805ae118fa1a70205f80d2d70fe73", [:mix], [], "hexpm", "53695bae57cc4e54566d993eb01074e4d894b65a3766f1c43e2c61a1b0f45ea9"}, + "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm", "6e56493a862433fccc3aca3025c946d6720d8eedf6e3e6fb911952a7071c357f"}, + "slime": {:hex, :slime, "0.16.0", "4f9c677ca37b2817cd10422ecb42c524fe904d3630acf242b81dfe189900272a", [:mix], [], "hexpm", "9a8c51853302df424aea6ce590e5f67ad8ba9581dd62ecb0c685bcf462c4cd79"}, + "telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"}, +} diff --git a/elixirschool/example/test/example_test.exs b/elixirschool/example/test/example_test.exs new file mode 100644 index 0000000..c7659ae --- /dev/null +++ b/elixirschool/example/test/example_test.exs @@ -0,0 +1,8 @@ +defmodule ExampleTest do + use ExUnit.Case + doctest Example + + test "greets the world" do + assert Example.hello() == :world + end +end diff --git a/elixirschool/example/test/test_helper.exs b/elixirschool/example/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/elixirschool/example/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()