From 9db28e7277dbbe30a7dc8629dba56663cf2becc7 Mon Sep 17 00:00:00 2001 From: Danylo Negrienko Date: Tue, 10 Dec 2024 00:20:08 -0500 Subject: [PATCH] Library skeleton --- .formatter.exs | 4 ++ .gitignore | 36 +++++++++++----- .iex.exs | 24 +++++++++++ README.md | 20 ++++++++- lib/ukraine_taxid_ex.ex | 18 ++++++++ mix.exs | 78 ++++++++++++++++++++++++++++++++++ mix.lock | 25 +++++++++++ test/test_helper.exs | 1 + test/ukraine_taxid_ex_test.exs | 8 ++++ 9 files changed, 201 insertions(+), 13 deletions(-) create mode 100644 .formatter.exs create mode 100644 .iex.exs create mode 100644 lib/ukraine_taxid_ex.ex create mode 100644 mix.exs create mode 100644 mix.lock create mode 100644 test/test_helper.exs create mode 100644 test/ukraine_taxid_ex_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 index fc5d8e3..1540dc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,26 @@ -# ---> Elixir -/_build -/cover -/deps -/doc -/.fetch -erl_crash.dump -*.ez -*.beam -/config/*.secret.exs -.elixir_ls/ +# 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"). +ukraine_tax_id-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/.iex.exs b/.iex.exs new file mode 100644 index 0000000..b3249c4 --- /dev/null +++ b/.iex.exs @@ -0,0 +1,24 @@ +IEx.configure( + colors: [ + enabled: true, + eval_result: [:cyan, :bright], + eval_error: [:light_magenta] + ], + default_prompt: + [ + "%prefix", + :white, + "(", + :blue, + "%counter", + :white, + ")", + # plain string + "›", + :reset + ] + |> IO.ANSI.format() + |> IO.chardata_to_string() +) + +alias UkraineTaxidEx.{Itin, Edrpou} diff --git a/README.md b/README.md index 2ed9914..58735a5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ -# ukraine-taxid-ex +# UkraineTaxidEx -Library to parse and validate EDRPOU (unique 8-digit number that identifies legal entities in Ukraine registered in the official business register) and ITIN (unique identification number assigned to individuals for tax purposes) \ No newline at end of file +Library to parse and validate EDRPOU (unique 8-digit number that identifies legal entities in Ukraine registered in the official business register) and ITIN (unique identification number assigned to individuals for tax purposes) + +## Installation + +The package can be installed by adding `ukraine_tax_id` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:ukraine_tax_id, "~> 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/lib/ukraine_taxid_ex.ex b/lib/ukraine_taxid_ex.ex new file mode 100644 index 0000000..611104e --- /dev/null +++ b/lib/ukraine_taxid_ex.ex @@ -0,0 +1,18 @@ +defmodule UkraineTaxidEx do + @moduledoc """ + Documentation for `UkraineTaxidEx`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> UkraineTaxidEx.hello() + :world + + """ + def hello do + :world + end +end diff --git a/mix.exs b/mix.exs new file mode 100644 index 0000000..64e1560 --- /dev/null +++ b/mix.exs @@ -0,0 +1,78 @@ +defmodule UkraineTaxidEx.MixProject do + use Mix.Project + + @app :ukraine_tax_id + @module UkraineTaxidEx + @source_url "https://g.tulz.dev/opensource/ukraine-taxid-ex" + @docs_url "https://hexdocs.pm/#{@app}" + @version "0.1.0" + + def project do + [ + app: @app, + version: @version, + elixir: "~> 1.17", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: description(), + dialyzer: dialyzer(), + docs: docs(), + package: package() + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger] + ] + end + + defp description() do + """ + Library to parse and validate EDRPOU (unique 8-digit number that identifies legal entities in Ukraine registered in the official business register) and ITIN (unique identification number assigned to individuals for tax purposes) + """ + end + + defp dialyzer() do + [ + plt_add_apps: [@app] + ] + end + + defp package() do + [ + maintainers: ["Danylo Negrienko"], + licenses: ["Apache-2.0"], + links: %{"Git Repository" => @source_url, "Author's Blog" => "https://negrienko.com"} + ] + end + + defp docs() do + [ + main: "readme", + name: "#{@module}", + source_ref: "v#{@version}", + canonical: @docs_url, + source_url: @source_url, + extras: ["README.md"] + ] + end + + # Run "mix help deps" to learn about dependencies. + defp deps do + [ + # Checks + {:lettuce, "~> 0.3.0", only: :dev}, + {:ex_check, "~> 0.14.0", only: ~w(dev test)a, runtime: false}, + {:credo, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:dialyxir, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:doctor, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:ex_doc, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:sobelow, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:mix_audit, ">= 0.0.0", only: ~w(dev test)a, runtime: false}, + {:observer_cli, "~> 1.7.4", only: :dev, runtime: false}, + {:elixir_sense, github: "elixir-lsp/elixir_sense", only: ~w(dev)a} + ] + end +end diff --git a/mix.lock b/mix.lock new file mode 100644 index 0000000..a16c69c --- /dev/null +++ b/mix.lock @@ -0,0 +1,25 @@ +%{ + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, + "credo": {:hex, :credo, "1.7.10", "6e64fe59be8da5e30a1b96273b247b5cf1cc9e336b5fd66302a64b25749ad44d", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "71fbc9a6b8be21d993deca85bf151df023a3097b01e09a2809d460348561d8cd"}, + "decimal": {:hex, :decimal, "2.2.0", "df3d06bb9517e302b1bd265c1e7f16cda51547ad9d99892049340841f3e15836", [:mix], [], "hexpm", "af8daf87384b51b7e611fb1a1f2c4d4876b65ef968fa8bd3adf44cff401c7f21"}, + "dialyxir": {:hex, :dialyxir, "1.4.5", "ca1571ac18e0f88d4ab245f0b60fa31ff1b12cbae2b11bd25d207f865e8ae78a", [:mix], [{:erlex, ">= 0.2.7", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b0fb08bb8107c750db5c0b324fa2df5ceaa0f9307690ee3c1f6ba5b9eb5d35c3"}, + "doctor": {:hex, :doctor, "0.22.0", "223e1cace1f16a38eda4113a5c435fa9b10d804aa72d3d9f9a71c471cc958fe7", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "96e22cf8c0df2e9777dc55ebaa5798329b9028889c4023fed3305688d902cd5b"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, + "elixir_sense": {:git, "https://github.com/elixir-lsp/elixir_sense.git", "67f6974dedb33846a060031d5afd5430a3f583f0", []}, + "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, + "ex_check": {:hex, :ex_check, "0.14.0", "d6fbe0bcc51cf38fea276f5bc2af0c9ae0a2bb059f602f8de88709421dae4f0e", [:mix], [], "hexpm", "8a602e98c66e6a4be3a639321f1f545292042f290f91fa942a285888c6868af0"}, + "ex_doc": {:hex, :ex_doc, "0.35.1", "de804c590d3df2d9d5b8aec77d758b00c814b356119b3d4455e4b8a8687aecaf", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "2121c6402c8d44b05622677b761371a759143b958c6c19f6558ff64d0aed40df"}, + "file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "lettuce": {:hex, :lettuce, "0.3.0", "823198f053714282f980acc68c7157b9c78c740910cb4f572a642e020417a850", [:mix], [], "hexpm", "a47479d94ac37460481133213f08c8283dabbe762f4f8f8028456500d1fca9c4"}, + "makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"}, + "makeup_elixir": {:hex, :makeup_elixir, "1.0.0", "74bb8348c9b3a51d5c589bf5aebb0466a84b33274150e3b6ece1da45584afc82", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "49159b7d7d999e836bedaf09dcf35ca18b312230cf901b725a64f3f42e407983"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"}, + "mix_audit": {:hex, :mix_audit, "2.1.4", "0a23d5b07350cdd69001c13882a4f5fb9f90fbd4cbf2ebc190a2ee0d187ea3e9", [:make, :mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.11", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "fd807653cc8c1cada2911129c7eb9e985e3cc76ebf26f4dd628bb25bbcaa7099"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, + "observer_cli": {:hex, :observer_cli, "1.7.5", "cf73407c40ba3933a4be8be5cdbfcd647a7ec24b49f1d75e912ae1f2e58bc5d4", [:mix, :rebar3], [{:recon, "~> 2.5.5", [hex: :recon, repo: "hexpm", optional: false]}], "hexpm", "872cf8e833a3a71ebd05420692678ec8aaede8fd96c805a4687398f6b23a3014"}, + "recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"}, + "sobelow": {:hex, :sobelow, "0.13.0", "218afe9075904793f5c64b8837cc356e493d88fddde126a463839351870b8d1e", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cd6e9026b85fc35d7529da14f95e85a078d9dd1907a9097b3ba6ac7ebbe34a0d"}, + "yamerl": {:hex, :yamerl, "0.10.0", "4ff81fee2f1f6a46f1700c0d880b24d193ddb74bd14ef42cb0bcf46e81ef2f8e", [:rebar3], [], "hexpm", "346adb2963f1051dc837a2364e4acf6eb7d80097c0f53cbdc3046ec8ec4b4e6e"}, + "yaml_elixir": {:hex, :yaml_elixir, "2.11.0", "9e9ccd134e861c66b84825a3542a1c22ba33f338d82c07282f4f1f52d847bd50", [:mix], [{:yamerl, "~> 0.10", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "53cc28357ee7eb952344995787f4bb8cc3cecbf189652236e9b163e8ce1bc242"}, +} 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/ukraine_taxid_ex_test.exs b/test/ukraine_taxid_ex_test.exs new file mode 100644 index 0000000..203e61c --- /dev/null +++ b/test/ukraine_taxid_ex_test.exs @@ -0,0 +1,8 @@ +defmodule UkraineTaxidExTest do + use ExUnit.Case + doctest UkraineTaxidEx + + test "greets the world" do + assert UkraineTaxidEx.hello() == :world + end +end