init gleam code
This commit is contained in:
parent
edc815842e
commit
7149273986
9 changed files with 112 additions and 3 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
*.beam
|
||||
*.ez
|
||||
/build
|
||||
erl_crash.dump
|
||||
10
README.md
10
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
|
||||
```
|
||||
|
|
|
|||
19
gleam.toml
Normal file
19
gleam.toml
Normal file
|
|
@ -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"
|
||||
11
manifest.toml
Normal file
11
manifest.toml
Normal file
|
|
@ -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" }
|
||||
5
src/weather_portal.gleam
Normal file
5
src/weather_portal.gleam
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import gleam/io
|
||||
|
||||
pub fn main() -> Nil {
|
||||
io.println("Hello from weather_portal!")
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
13
test/weather_portal_test.gleam
Normal file
13
test/weather_portal_test.gleam
Normal file
|
|
@ -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!"
|
||||
}
|
||||
23
weather_portal/.github/workflows/test.yml
vendored
Normal file
23
weather_portal/.github/workflows/test.yml
vendored
Normal file
|
|
@ -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
|
||||
24
weather_portal/README.md
Normal file
24
weather_portal/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# weather_portal
|
||||
|
||||
[](https://hex.pm/packages/weather_portal)
|
||||
[](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 <https://hexdocs.pm/weather_portal>.
|
||||
|
||||
## Development
|
||||
|
||||
```sh
|
||||
gleam run # Run the project
|
||||
gleam test # Run the tests
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue