From 70923eebfa2732488610bde224c409a2c6084546 Mon Sep 17 00:00:00 2001 From: Carsten Date: Tue, 21 Apr 2026 22:05:49 +0200 Subject: [PATCH] feat(agent): otp app scaffold with slipstream + toml deps --- agent/.formatter.exs | 4 +++ agent/.gitignore | 24 ++++++++++++++++++ agent/README.md | 21 ++++++++++++++++ agent/lib/proxmox_agent.ex | 18 ++++++++++++++ agent/lib/proxmox_agent/application.ex | 20 +++++++++++++++ agent/mix.exs | 34 ++++++++++++++++++++++++++ agent/mix.lock | 10 ++++++++ agent/test/proxmox_agent_test.exs | 8 ++++++ agent/test/test_helper.exs | 1 + 9 files changed, 140 insertions(+) create mode 100644 agent/.formatter.exs create mode 100644 agent/.gitignore create mode 100644 agent/README.md create mode 100644 agent/lib/proxmox_agent.ex create mode 100644 agent/lib/proxmox_agent/application.ex create mode 100644 agent/mix.exs create mode 100644 agent/mix.lock create mode 100644 agent/test/proxmox_agent_test.exs create mode 100644 agent/test/test_helper.exs diff --git a/agent/.formatter.exs b/agent/.formatter.exs new file mode 100644 index 0000000..d2cda26 --- /dev/null +++ b/agent/.formatter.exs @@ -0,0 +1,4 @@ +# Used by "mix format" +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/agent/.gitignore b/agent/.gitignore new file mode 100644 index 0000000..42a0086 --- /dev/null +++ b/agent/.gitignore @@ -0,0 +1,24 @@ +# 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/ + +# Temporary files, for example, from tests. +/tmp/ + +# 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"). +agent-*.tar + diff --git a/agent/README.md b/agent/README.md new file mode 100644 index 0000000..2cdc083 --- /dev/null +++ b/agent/README.md @@ -0,0 +1,21 @@ +# ProxmoxAgent + +**TODO: Add description** + +## Installation + +If [available in Hex](https://hex.pm/docs/publish), the package can be installed +by adding `agent` to your list of dependencies in `mix.exs`: + +```elixir +def deps do + [ + {:agent, "~> 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/agent/lib/proxmox_agent.ex b/agent/lib/proxmox_agent.ex new file mode 100644 index 0000000..8e72081 --- /dev/null +++ b/agent/lib/proxmox_agent.ex @@ -0,0 +1,18 @@ +defmodule ProxmoxAgent do + @moduledoc """ + Documentation for `ProxmoxAgent`. + """ + + @doc """ + Hello world. + + ## Examples + + iex> ProxmoxAgent.hello() + :world + + """ + def hello do + :world + end +end diff --git a/agent/lib/proxmox_agent/application.ex b/agent/lib/proxmox_agent/application.ex new file mode 100644 index 0000000..4a7a876 --- /dev/null +++ b/agent/lib/proxmox_agent/application.ex @@ -0,0 +1,20 @@ +defmodule ProxmoxAgent.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: ProxmoxAgent.Worker.start_link(arg) + # {ProxmoxAgent.Worker, arg} + ] + + # See https://hexdocs.pm/elixir/Supervisor.html + # for other strategies and supported options + opts = [strategy: :one_for_one, name: ProxmoxAgent.Supervisor] + Supervisor.start_link(children, opts) + end +end diff --git a/agent/mix.exs b/agent/mix.exs new file mode 100644 index 0000000..67bb78a --- /dev/null +++ b/agent/mix.exs @@ -0,0 +1,34 @@ +defmodule ProxmoxAgent.MixProject do + use Mix.Project + + @version "0.1.0" + + def project do + [ + app: :agent, + version: @version, + elixir: "~> 1.17", + start_permanent: Mix.env() == :prod, + deps: deps(), + elixirc_paths: elixirc_paths(Mix.env()) + ] + end + + def application do + [ + extra_applications: [:logger, :crypto], + mod: {ProxmoxAgent.Application, []} + ] + end + + defp deps do + [ + {:slipstream, "~> 1.1"}, + {:jason, "~> 1.4"}, + {:toml, "~> 0.7"} + ] + end + + defp elixirc_paths(:test), do: ["lib", "test/support"] + defp elixirc_paths(_), do: ["lib"] +end diff --git a/agent/mix.lock b/agent/mix.lock new file mode 100644 index 0000000..eff3e91 --- /dev/null +++ b/agent/mix.lock @@ -0,0 +1,10 @@ +%{ + "hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "mint": {:hex, :mint, "1.7.1", "113fdb2b2f3b59e47c7955971854641c61f378549d73e829e1768de90fc1abf1", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "fceba0a4d0f24301ddee3024ae116df1c3f4bb7a563a731f45fdfeb9d39a231b"}, + "mint_web_socket": {:hex, :mint_web_socket, "1.0.5", "60354efeb49b1eccf95dfb75f55b08d692e211970fe735a5eb3188b328be2a90", [:mix], [{:mint, ">= 1.4.1 and < 2.0.0-0", [hex: :mint, repo: "hexpm", optional: false]}], "hexpm", "04b35663448fc758f3356cce4d6ac067ca418bbafe6972a3805df984b5f12e61"}, + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, + "slipstream": {:hex, :slipstream, "1.2.2", "6b07124ac5f62a50327aa38c84edd0284920ac8aba548e04738827838f233ed0", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mint_web_socket, "~> 0.2 or ~> 1.0", [hex: :mint_web_socket, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.1 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ccb873ddb21aadb37c5c7745014febe6da0aa2cef0c4e73e7d08ce11d18aacd0"}, + "telemetry": {:hex, :telemetry, "1.4.1", "ab6de178e2b29b58e8256b92b382ea3f590a47152ca3651ea857a6cae05ac423", [:rebar3], [], "hexpm", "2172e05a27531d3d31dd9782841065c50dd5c3c7699d95266b2edd54c2dafa1c"}, + "toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"}, +} diff --git a/agent/test/proxmox_agent_test.exs b/agent/test/proxmox_agent_test.exs new file mode 100644 index 0000000..0b364b3 --- /dev/null +++ b/agent/test/proxmox_agent_test.exs @@ -0,0 +1,8 @@ +defmodule ProxmoxAgentTest do + use ExUnit.Case + doctest ProxmoxAgent + + test "greets the world" do + assert ProxmoxAgent.hello() == :world + end +end diff --git a/agent/test/test_helper.exs b/agent/test/test_helper.exs new file mode 100644 index 0000000..869559e --- /dev/null +++ b/agent/test/test_helper.exs @@ -0,0 +1 @@ +ExUnit.start()