diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..599be4e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.beam +*.ez +/build +erl_crash.dump diff --git a/README.md b/README.md index 1b7db5a..ba6b2cb 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,19 @@ This is a real-time, neighborhood-facing weather dashboard that streams sensory data from an MQTT broker (Home Assistant) to a web interface. +Gleam code started created following [this guide](https://gleam.run/writing-gleam/). + ## Tech Stack Overview - **Backend:** Gleam (Target: Erlang/OTP) - **Web Server:** Mist (HTTP & WebSockets) - **Database:** SQLite (via `sqlight`) for persistent uptime tracking - **Frontend:** SolidJS (Signals-based reactivity) + Tailwind CSS - **Infrastructure:** Nomad (Docker-based deployment) + + +## Development + +```sh +gleam run # Run the project +gleam test # Run the tests +``` diff --git a/gleam.toml b/gleam.toml new file mode 100644 index 0000000..f97524d --- /dev/null +++ b/gleam.toml @@ -0,0 +1,19 @@ +name = "weather_portal" +version = "1.0.0" + +# Fill out these fields if you intend to generate HTML documentation or publish +# your project to the Hex package manager. +# +# description = "" +# licences = ["Apache-2.0"] +# repository = { type = "github", user = "", repo = "" } +# links = [{ title = "Website", href = "" }] +# +# For a full reference of all the available options, you can have a look at +# https://gleam.run/writing-gleam/gleam-toml/. + +[dependencies] +gleam_stdlib = ">= 0.44.0 and < 2.0.0" + +[dev_dependencies] +gleeunit = ">= 1.0.0 and < 2.0.0" diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..c79796d --- /dev/null +++ b/manifest.toml @@ -0,0 +1,11 @@ +# This file was generated by Gleam +# You typically do not need to edit this file + +packages = [ + { name = "gleam_stdlib", version = "0.70.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "86949BF5D1F0E4AC0AB5B06F235D8A5CC11A2DFC33BF22F752156ED61CA7D0FF" }, + { name = "gleeunit", version = "1.9.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "DA9553CE58B67924B3C631F96FE3370C49EB6D6DC6B384EC4862CC4AAA718F3C" }, +] + +[requirements] +gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" } +gleeunit = { version = ">= 1.0.0 and < 2.0.0" } diff --git a/src/weather_portal.gleam b/src/weather_portal.gleam new file mode 100644 index 0000000..42f6964 --- /dev/null +++ b/src/weather_portal.gleam @@ -0,0 +1,5 @@ +import gleam/io + +pub fn main() -> Nil { + io.println("Hello from weather_portal!") +} diff --git a/tasks.txt b/tasks.txt index 9d6b0bc..5195faf 100644 --- a/tasks.txt +++ b/tasks.txt @@ -1,7 +1,4 @@ -task: install gleam project -task: get hello world working on local - task: get mqtt actor up and running with connection to MQTT Server task: init frontend with solid js @@ -9,3 +6,6 @@ task: dockerize and deploy app to homelab task: hookup a subdomain via reverse proxy ----------------------- + +DONE task: install gleam +DONE task: get hello world working on local diff --git a/test/weather_portal_test.gleam b/test/weather_portal_test.gleam new file mode 100644 index 0000000..fba3c88 --- /dev/null +++ b/test/weather_portal_test.gleam @@ -0,0 +1,13 @@ +import gleeunit + +pub fn main() -> Nil { + gleeunit.main() +} + +// gleeunit test functions end in `_test` +pub fn hello_world_test() { + let name = "Joe" + let greeting = "Hello, " <> name <> "!" + + assert greeting == "Hello, Joe!" +} diff --git a/weather_portal/.github/workflows/test.yml b/weather_portal/.github/workflows/test.yml new file mode 100644 index 0000000..0c036a8 --- /dev/null +++ b/weather_portal/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: test + +on: + push: + branches: + - master + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: erlef/setup-beam@v1 + with: + otp-version: "28" + gleam-version: "1.15.2" + rebar3-version: "3" + # elixir-version: "1" + - run: gleam deps download + - run: gleam test + - run: gleam format --check src test diff --git a/weather_portal/README.md b/weather_portal/README.md new file mode 100644 index 0000000..4708d36 --- /dev/null +++ b/weather_portal/README.md @@ -0,0 +1,24 @@ +# weather_portal + +[![Package Version](https://img.shields.io/hexpm/v/weather_portal)](https://hex.pm/packages/weather_portal) +[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/weather_portal/) + +```sh +gleam add weather_portal@1 +``` +```gleam +import weather_portal + +pub fn main() -> Nil { + // TODO: An example of the project in use +} +``` + +Further documentation can be found at . + +## Development + +```sh +gleam run # Run the project +gleam test # Run the tests +```