init gleam
This commit is contained in:
parent
ac8220c015
commit
f941e6902e
10 changed files with 176 additions and 42 deletions
23
.github/workflows/test.yml
vendored
Normal file
23
.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@v4
|
||||||
|
- uses: erlef/setup-beam@v1
|
||||||
|
with:
|
||||||
|
otp-version: "27.1.2"
|
||||||
|
gleam-version: "1.10.0"
|
||||||
|
rebar3-version: "3"
|
||||||
|
# elixir-version: "1"
|
||||||
|
- run: gleam deps download
|
||||||
|
- run: gleam test
|
||||||
|
- run: gleam format --check src test
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,3 +1,7 @@
|
||||||
.direnv/
|
*.beam
|
||||||
|
*.ez
|
||||||
|
/build
|
||||||
|
erl_crash.dump
|
||||||
result
|
result
|
||||||
.env
|
.env
|
||||||
|
.direnv
|
24
README.md
Normal file
24
README.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# switcheroo
|
||||||
|
|
||||||
|
[](https://hex.pm/packages/switcheroo)
|
||||||
|
[](https://hexdocs.pm/switcheroo/)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gleam add switcheroo@1
|
||||||
|
```
|
||||||
|
```gleam
|
||||||
|
import switcheroo
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
// TODO: An example of the project in use
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Further documentation can be found at <https://hexdocs.pm/switcheroo>.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```sh
|
||||||
|
gleam run # Run the project
|
||||||
|
gleam test # Run the tests
|
||||||
|
```
|
62
flake.lock
generated
62
flake.lock
generated
|
@ -1,20 +1,35 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-parts": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1743550720,
|
"lastModified": 1731533236,
|
||||||
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
"owner": "hercules-ci",
|
"owner": "numtide",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-utils",
|
||||||
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "hercules-ci",
|
"owner": "numtide",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-gleam": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1717670865,
|
||||||
|
"narHash": "sha256-+dAPiKAwCzlKWtx3aIHXfR6jydh1JyangewqZKJx500=",
|
||||||
|
"owner": "arnarg",
|
||||||
|
"repo": "nix-gleam",
|
||||||
|
"rev": "c69abe0e57a01991654d3de63dcd93a8b91b98ff",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "arnarg",
|
||||||
|
"repo": "nix-gleam",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -34,26 +49,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nix-gleam": "nix-gleam",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1743296961,
|
"lastModified": 1681028828,
|
||||||
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-systems",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "default",
|
||||||
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-systems",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
50
flake.nix
50
flake.nix
|
@ -1,20 +1,42 @@
|
||||||
{
|
{
|
||||||
description = "plapkit";
|
description = "My gleam application";
|
||||||
|
|
||||||
inputs = {
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
inputs.nix-gleam.url = "github:arnarg/nix-gleam";
|
||||||
};
|
|
||||||
|
|
||||||
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
outputs = {
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
self,
|
||||||
perSystem = { config, self', pkgs, lib, system, ... }: rec {
|
nixpkgs,
|
||||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
flake-utils,
|
||||||
|
nix-gleam,
|
||||||
|
}: (
|
||||||
|
flake-utils.lib.eachDefaultSystem
|
||||||
|
(system: let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [
|
||||||
|
nix-gleam.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
packages.default = pkgs.buildGleamApplication {
|
||||||
|
# The pname and version will be read from the `gleam.toml`
|
||||||
|
# file generated by gleam.
|
||||||
|
# But this can be overwritten here too:
|
||||||
|
# pname = "my-app";
|
||||||
|
# version = "1.2.3";
|
||||||
|
|
||||||
|
# The target is read from the `gleam.toml` file too.
|
||||||
|
# Default is "erlang" if nothing is specified but
|
||||||
|
# this can also be overwritten here too:
|
||||||
|
# target = "javascript";
|
||||||
|
|
||||||
|
# Erlang package can be overridden but defaults to
|
||||||
|
# `pkgs.erlang`.
|
||||||
|
# erlangPackage = pkgs.erlang_nox;
|
||||||
|
|
||||||
packages.default = pkgs.buildGoModule {
|
|
||||||
name = "switcheroo";
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
vendorHash = "sha256-YY7Hj7lSq7vEoMEIu/zmweWzd7p7KF+4YCUX2SJ7kwI=";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.container = pkgs.dockerTools.buildImage {
|
packages.container = pkgs.dockerTools.buildImage {
|
||||||
|
@ -30,6 +52,6 @@
|
||||||
Cmd = [ "${packages.default}/bin/switcheroo" ];
|
Cmd = [ "${packages.default}/bin/switcheroo" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
};
|
);
|
||||||
}
|
}
|
19
gleam.toml
Normal file
19
gleam.toml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
name = "switcheroo"
|
||||||
|
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.59.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "F8FEE9B35797301994B81AF75508CF87C328FE1585558B0FFD188DC2B32EAA95" },
|
||||||
|
{ name = "gleeunit", version = "1.3.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "A7DD6C07B7DA49A6E28796058AA89E651D233B357D5607006D70619CD89DAAAB" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[requirements]
|
||||||
|
gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
|
||||||
|
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
|
|
@ -1,7 +1,5 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
|
{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
go
|
gleam
|
||||||
just
|
|
||||||
sqlite
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
5
src/switcheroo.gleam
Normal file
5
src/switcheroo.gleam
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import gleam/io
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
io.println("Hello from switcheroo!")
|
||||||
|
}
|
12
test/switcheroo_test.gleam
Normal file
12
test/switcheroo_test.gleam
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import gleeunit
|
||||||
|
import gleeunit/should
|
||||||
|
|
||||||
|
pub fn main() -> Nil {
|
||||||
|
gleeunit.main()
|
||||||
|
}
|
||||||
|
|
||||||
|
// gleeunit test functions end in `_test`
|
||||||
|
pub fn hello_world_test() {
|
||||||
|
1
|
||||||
|
|> should.equal(1)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue