From 072c5f85b8f8711b893775c166f18018611a0d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro?= Date: Tue, 30 Apr 2024 22:42:31 +0200 Subject: [PATCH] Create scrapper app --- apps/scrapper/.formatter.exs | 4 +++ apps/scrapper/.gitignore | 26 +++++++++++++++++ apps/scrapper/README.md | 21 ++++++++++++++ apps/scrapper/lib/scrapper.ex | 18 ++++++++++++ apps/scrapper/lib/scrapper/application.ex | 20 +++++++++++++ apps/scrapper/mix.exs | 34 +++++++++++++++++++++++ apps/scrapper/test/scrapper_test.exs | 8 ++++++ apps/scrapper/test/test_helper.exs | 1 + 8 files changed, 132 insertions(+) create mode 100644 apps/scrapper/.formatter.exs create mode 100644 apps/scrapper/.gitignore create mode 100644 apps/scrapper/README.md create mode 100644 apps/scrapper/lib/scrapper.ex create mode 100644 apps/scrapper/lib/scrapper/application.ex create mode 100644 apps/scrapper/mix.exs create mode 100644 apps/scrapper/test/scrapper_test.exs create mode 100644 apps/scrapper/test/test_helper.exs diff --git a/apps/scrapper/.formatter.exs b/apps/scrapper/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/apps/scrapper/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/apps/scrapper/.gitignore b/apps/scrapper/.gitignore new file mode 100644 index 0000000..b04970e --- /dev/null +++ b/apps/scrapper/.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"). +scrapper-*.tar + +# Temporary files, for example, from tests. +/tmp/ diff --git a/apps/scrapper/README.md b/apps/scrapper/README.md new file mode 100644 index 0000000..44321c8 --- /dev/null +++ b/apps/scrapper/README.md @@ -0,0 +1,21 @@ +# Scrapper + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `scrapper` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:scrapper, "~> 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/apps/scrapper/lib/scrapper.ex b/apps/scrapper/lib/scrapper.ex new file mode 100644 index 0000000..6b454cf --- /dev/null +++ b/apps/scrapper/lib/scrapper.ex @@ -0,0 +1,18 @@ +defmodule Scrapper do + @moduledoc """ + Documentation for `Scrapper`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> Scrapper.hello() + :world + + """ + def hello do + :world + end +end diff --git a/apps/scrapper/lib/scrapper/application.ex b/apps/scrapper/lib/scrapper/application.ex new file mode 100644 index 0000000..f62bd76 --- /dev/null +++ b/apps/scrapper/lib/scrapper/application.ex @@ -0,0 +1,20 @@ +defmodule Scrapper.Application do + # See https://hexdocs.pm/elixir/Application.html + # for more information on OTP Applications + @moduledoc false + + use Application + + @impl true + def start(_type, _args) do + children = [ + # Starts a worker by calling: Scrapper.Worker.start_link(arg) + # {Scrapper.Worker, arg} + ] + + # See https://hexdocs.pm/elixir/Supervisor.html + # for other strategies and supported options + opts = [strategy: :one_for_one, name: Scrapper.Supervisor] + Supervisor.start_link(children, opts) + end +end diff --git a/apps/scrapper/mix.exs b/apps/scrapper/mix.exs new file mode 100644 index 0000000..f0c1b8c --- /dev/null +++ b/apps/scrapper/mix.exs @@ -0,0 +1,34 @@ +defmodule Scrapper.MixProject do + use Mix.Project + + def project do + [ + app: :scrapper, + version: "0.1.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.16", + start_permanent: Mix.env() == :prod, + deps: deps() + ] + end + + # Run "mix help compile.app" to learn about applications. + def application do + [ + extra_applications: [:logger], + mod: {Scrapper.Application, []} + ] + 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"}, + # {:sibling_app_in_umbrella, in_umbrella: true} + ] + end +end diff --git a/apps/scrapper/test/scrapper_test.exs b/apps/scrapper/test/scrapper_test.exs new file mode 100644 index 0000000..e25f19e --- /dev/null +++ b/apps/scrapper/test/scrapper_test.exs @@ -0,0 +1,8 @@ +defmodule ScrapperTest do + use ExUnit.Case + doctest Scrapper + + test "greets the world" do + assert Scrapper.hello() == :world + end +end diff --git a/apps/scrapper/test/test_helper.exs b/apps/scrapper/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/apps/scrapper/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()