From 669e06d09b213a63995c3d11869fa0d1e67c21bc Mon Sep 17 00:00:00 2001 From: Guilhem Saurel <guilhem.saurel@laas.fr> Date: Wed, 26 Jun 2024 12:21:42 +0200 Subject: [PATCH] greet newcomers -> onboarding --- flake.nix | 6 +++--- {newcomers => onboarding}/.gitignore | 0 {newcomers => onboarding}/README.md | 6 +++--- {newcomers => onboarding}/check_matrix.py | 2 +- {newcomers => onboarding}/default.nix | 12 ++++++------ .../greet_newcomers.py => onboarding/onboarding.py | 4 ++-- {newcomers => onboarding}/template.txt | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) rename {newcomers => onboarding}/.gitignore (100%) rename {newcomers => onboarding}/README.md (75%) rename {newcomers => onboarding}/check_matrix.py (93%) rename {newcomers => onboarding}/default.nix (66%) rename newcomers/greet_newcomers.py => onboarding/onboarding.py (96%) rename {newcomers => onboarding}/template.txt (94%) diff --git a/flake.nix b/flake.nix index 7a30221..cf158d4 100644 --- a/flake.nix +++ b/flake.nix @@ -31,16 +31,16 @@ ... }: { - apps.newcomers = { + apps.onboarding = { type = "app"; - program = self'.packages.newcomers; + program = self'.packages.onboarding; }; devShells.default = pkgs.mkShell { nativeBuildInputs = [ config.treefmt.build.wrapper ]; packages = [ self'.packages.python ]; }; packages = { - newcomers = pkgs.python3Packages.callPackage ./newcomers { }; + onboarding = pkgs.python3Packages.callPackage ./onboarding { }; python = pkgs.python3.withPackages ( p: with p; [ beautifulsoup4 diff --git a/newcomers/.gitignore b/onboarding/.gitignore similarity index 100% rename from newcomers/.gitignore rename to onboarding/.gitignore diff --git a/newcomers/README.md b/onboarding/README.md similarity index 75% rename from newcomers/README.md rename to onboarding/README.md index 402cf82..5a67cc3 100644 --- a/newcomers/README.md +++ b/onboarding/README.md @@ -1,4 +1,4 @@ -# Greet Newcomers +# Onboarding ## Get dependencies @@ -6,7 +6,7 @@ This project is packaged with a nix flake ## Go ! -- `./greet_newcomers.py` +- `./onboarding.py` On the first time, it will construct a database of the members already here. @@ -18,5 +18,5 @@ The template of this mail is in `template.txt`. To run this script everyday at 5 AM: ```bash -(crontab -l; echo "0 5 * * * cd $(pwd); nix run .#newcomers") | crontab - +(crontab -l; echo "0 5 * * * cd $(pwd); nix run .#onboarding") | crontab - ``` diff --git a/newcomers/check_matrix.py b/onboarding/check_matrix.py similarity index 93% rename from newcomers/check_matrix.py rename to onboarding/check_matrix.py index f94fd1b..c2115e1 100755 --- a/newcomers/check_matrix.py +++ b/onboarding/check_matrix.py @@ -4,7 +4,7 @@ import getpass from matrix_client.client import MatrixClient -from greet_newcomers import get_gepetto +from onboarding import get_gepetto HOME = "https://matrix.laas.fr" ROOM = "#gepetto:laas.fr" diff --git a/newcomers/default.nix b/onboarding/default.nix similarity index 66% rename from newcomers/default.nix rename to onboarding/default.nix index 91308f3..4aaef57 100644 --- a/newcomers/default.nix +++ b/onboarding/default.nix @@ -4,7 +4,7 @@ buildPythonApplication, }: buildPythonApplication { - pname = "greet-newcomers"; + pname = "onboarding"; version = "1.0.0"; pyproject = false; dependencies = [ ldap3 ]; @@ -12,21 +12,21 @@ buildPythonApplication { src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ - ./greet_newcomers.py + ./onboarding.py ./template.txt ]; }; installPhase = '' - install -D -m 755 greet_newcomers.py $out/bin/greet-newcomers - install -D -m 644 template.txt $out/share/greet-newcomers/template.txt + install -D -m 755 onboarding.py $out/bin/onboarding + install -D -m 644 template.txt $out/share/onboarding/template.txt ''; meta = { description = "Greet gepetto newcomers"; - homepage = "https://github.com/gepetto/gepetto-utils/tree/master/newcomers"; + homepage = "https://github.com/gepetto/gepetto-utils/tree/master/onboarding"; license = lib.licenses.bsd2; maintainers = [ lib.maintainers.nim65s ]; - mainProgram = "greet-newcomers"; + mainProgram = "onboarding"; }; } diff --git a/newcomers/greet_newcomers.py b/onboarding/onboarding.py similarity index 96% rename from newcomers/greet_newcomers.py rename to onboarding/onboarding.py index fde6db2..4c7d5bc 100755 --- a/newcomers/greet_newcomers.py +++ b/onboarding/onboarding.py @@ -10,7 +10,7 @@ from smtplib import SMTP from ldap3 import Connection HERE = Path(__file__).resolve().parent -SHELF = Path(environ.get("XDG_CACHE_HOME", Path.home() / ".cache")) / "greet-newcomers" +SHELF = Path(environ.get("XDG_CACHE_HOME", Path.home() / ".cache")) / "onboarding" def get_gepetto(): @@ -56,7 +56,7 @@ def greet(to, sender): template = HERE / "template.txt" if not template.exists(): - template = HERE.parent / "share" / "greet-newcomers" / "template.txt" + template = HERE.parent / "share" / "onboarding" / "template.txt" if not template.exists(): err = f"can't find template.txt around {HERE}" raise RuntimeError(err) diff --git a/newcomers/template.txt b/onboarding/template.txt similarity index 94% rename from newcomers/template.txt rename to onboarding/template.txt index cd08a94..048c5da 100644 --- a/newcomers/template.txt +++ b/onboarding/template.txt @@ -17,5 +17,5 @@ You will find information about: See you soon ! -- -This is an automatic email from https://github.com/gepetto/gepetto-utils/tree/master/newcomers +This is an automatic email from https://github.com/gepetto/gepetto-utils/tree/master/onboarding Feel free to answer to it if you have any question ! -- GitLab