From cd1691fa515b1d737d557d045c315f5058af892a Mon Sep 17 00:00:00 2001 From: James Harton Date: Fri, 13 Nov 2020 18:46:34 +1300 Subject: [PATCH] First post. --- .formatter.exs | 4 ++++ .gitignore | 27 +++++++++++++++++++++ .gitlab-ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 21 +++++++++++++++++ lib/upshot.ex | 18 ++++++++++++++ mix.exs | 46 ++++++++++++++++++++++++++++++++++++ mix.lock | 12 ++++++++++ test/test_helper.exs | 1 + test/upshot_test.exs | 8 +++++++ 9 files changed, 193 insertions(+) create mode 100644 .formatter.exs create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 README.md create mode 100644 lib/upshot.ex create mode 100644 mix.exs create mode 100644 mix.lock create mode 100644 test/test_helper.exs create mode 100644 test/upshot_test.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec589b3 --- /dev/null +++ b/.gitignore @@ -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"). +upshot-*.tar + + +# Temporary files for e.g. tests +/tmp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..347833f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,56 @@ +image: elixir:latest + +cache: + key: "$CI_JOB_NAME" + paths: + - deps + - _build + - /root/.mix + +variables: + MIX_ENV: "test" + +before_script: + - mix local.hex --force + - mix local.rebar --force + - mix deps.get --only test + +test: + stage: test + script: + - mix test + +credo: + stage: test + script: + - mix credo + +audit: + stage: test + script: + - mix hex.audit + +format: + stage: test + script: + - mix format --check-formatted + +pages: + stage: deploy + script: + - mix docs -o public + artifacts: + paths: + - public + only: + - master + +package: + stage: deploy + only: + - /^v[0-9]+\.[0-9]+\.[0-9]+$/ + script: + - mix hex.build + artifacts: + paths: + - "upshot-*.tar" diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd28da2 --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Upshot + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `upshot` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:upshot, "~> 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 [https://hexdocs.pm/upshot](https://hexdocs.pm/upshot). + diff --git a/lib/upshot.ex b/lib/upshot.ex new file mode 100644 index 0000000..0ceddec --- /dev/null +++ b/lib/upshot.ex @@ -0,0 +1,18 @@ +defmodule Upshot do + @moduledoc """ + Documentation for `Upshot`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> Upshot.hello() + :world + + """ + def hello do + :world + end +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..52c6880 --- /dev/null +++ b/mix.exs @@ -0,0 +1,46 @@ +defmodule Upshot.MixProject do + use Mix.Project + + def project do + [ + app: :upshot, + version: "0.1.0", + elixir: "~> 1.11", + elixirc_paths: elixirc_paths(Mix.env()), + start_permanent: Mix.env() == :prod, + deps: deps(), + package: package(), + consolidate_protocols: Mix.env() != :test + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger] + ] + end + + def package do + [ + maintainers: ["James Harton "], + licenses: ["Hippocratic"], + links: %{ + "Source" => "https://gitlab.com/jimsy/upshot" + } + ] + end + + # Specifies which paths to compile per environment. + defp elixirc_paths(:test), do: ["lib", "test/support"] + defp elixirc_paths(_), do: ["lib"] + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + {:credo, "~> 1.5.0-rc.2", only: [:dev, :test], runtime: false}, + {:earmark, ">= 0.0.0", only: [:dev, :test], runtime: false}, + {:ex_doc, ">= 0.0.0", only: [:dev, :test], runtime: false} + ] + end +end diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..58332f3 --- /dev/null +++ b/mix.lock @@ -0,0 +1,12 @@ +%{ + "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, + "credo": {:hex, :credo, "1.5.1", "4fe303cc828412b9d21eed4eab60914c401e71f117f40243266aafb66f30d036", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "0b219ca4dcc89e4e7bc6ae7e6539c313e738e192e10b85275fa1e82b5203ecd7"}, + "earmark": {:hex, :earmark, "1.4.10", "bddce5e8ea37712a5bfb01541be8ba57d3b171d3fa4f80a0be9bcf1db417bcaf", [:mix], [{:earmark_parser, ">= 1.4.10", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "12dbfa80810478e521d3ffb941ad9fbfcbbd7debe94e1341b4c4a1b2411c1c27"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, + "ex_doc": {:hex, :ex_doc, "0.23.0", "a069bc9b0bf8efe323ecde8c0d62afc13d308b1fa3d228b65bca5cf8703a529d", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "f5e2c4702468b2fd11b10d39416ddadd2fcdd173ba2a0285ebd92c39827a5a16"}, + "file_system": {:hex, :file_system, "0.2.9", "545b9c9d502e8bfa71a5315fac2a923bd060fd9acb797fe6595f54b0f975fd32", [:mix], [], "hexpm", "3cf87a377fe1d93043adeec4889feacf594957226b4f19d5897096d6f61345d8"}, + "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, + "makeup": {:hex, :makeup, "1.0.5", "d5a830bc42c9800ce07dd97fa94669dfb93d3bf5fcf6ea7a0c67b2e0e4a7f26c", [:mix], [{:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cfa158c02d3f5c0c665d0af11512fed3fba0144cf1aadee0f2ce17747fba2ca9"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.15.0", "98312c9f0d3730fde4049985a1105da5155bfe5c11e47bdc7406d88e01e4219b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.1", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "75ffa34ab1056b7e24844c90bfc62aaf6f3a37a15faa76b07bc5eba27e4a8b4a"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.1.0", "3a6fca1550363552e54c216debb6a9e95bd8d32348938e13de5eda962c0d7f89", [:mix], [], "hexpm", "08eb32d66b706e913ff748f11694b17981c0b04a33ef470e33e11b3d3ac8f54b"}, +} diff --git a/test/test_helper.exs b/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start() diff --git a/test/upshot_test.exs b/test/upshot_test.exs new file mode 100644 index 0000000..ab9d917 --- /dev/null +++ b/test/upshot_test.exs @@ -0,0 +1,8 @@ +defmodule UpshotTest do + use ExUnit.Case + doctest Upshot + + test "greets the world" do + assert Upshot.hello() == :world + end +end