From bee6d50018422a244d45d03b3fed8545412847ba Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Thu, 12 Mar 2026 05:40:22 -0400 Subject: [PATCH] [ADD] todo: add deploy menu with git clone Allow users to deploy ERPLibre to a local directory via git clone from the TODO interactive menu, making onboarding simpler for new developers. Generated by Claude Code 2.1.74 model claude-opus-4-6 Co-Authored-By: Mathieu Benoit --- script/todo/todo.py | 60 ++++++++++++++++++++++++++++++++++++++++ script/todo/todo_i18n.py | 33 ++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/script/todo/todo.py b/script/todo/todo.py index d9a9790..5fdfedd 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -208,6 +208,7 @@ class TODO: [12] {t("Security - Dependency security audit")} [13] {t("Test - Test an Odoo module")} [14] {t("Update - Update all developed staging source code")} +[15] {t("Deploy - Deploy ERPLibre locally")} [0] {t("Back")} """ while True: @@ -271,6 +272,10 @@ class TODO: status = self.prompt_execute_update() if status is not False: return + elif status == "15": + status = self.prompt_execute_deploy() + if status is not False: + return else: print(t("Command not found !")) @@ -606,6 +611,61 @@ class TODO: if cmd_no_found: print(t("Command not found !")) + def prompt_execute_deploy(self): + print( + f"🤖 {t('Deploy ERPLibre to a local directory!')}" + ) + choices = [ + { + "prompt_description": t( + "Clone ERPLibre locally (git clone)" + ) + }, + ] + help_info = self.fill_help_info(choices) + + while True: + status = click.prompt(help_info) + print() + if status == "0": + return False + elif status == "1": + self._deploy_clone_erplibre() + else: + print(t("Command not found !")) + + def _deploy_clone_erplibre(self): + default_path = os.path.expanduser("~/erplibre") + target_path = ( + input( + t("Target directory path (default: ~/erplibre): ") + ).strip() + or default_path + ) + target_path = os.path.expanduser(target_path) + if os.path.exists(target_path): + print( + f"{t('Directory already exists: ')}{target_path}" + ) + return + print(t("Cloning ERPLibre...")) + cmd = ( + "git clone" + " https://github.com/erplibre/erplibre" + f" {target_path}" + ) + print(f"{t('Will execute:')} {cmd}") + try: + self.execute.exec_command_live( + cmd, source_erplibre=False + ) + print( + f"{t('ERPLibre cloned successfully to: ')}" + f"{target_path}" + ) + except Exception as e: + print(f"{t('Error cloning ERPLibre: ')}{e}") + def prompt_execute_code(self): print(f"🤖 {t('What do you need for development?')}") # help_info = """Commande : diff --git a/script/todo/todo_i18n.py b/script/todo/todo_i18n.py index 28c5726..1e9846e 100644 --- a/script/todo/todo_i18n.py +++ b/script/todo/todo_i18n.py @@ -104,6 +104,39 @@ TRANSLATIONS = { "fr": "Langue - Changer la langue / Change language", "en": "Language - Change language / Changer la langue", }, + # Deploy section + "Deploy - Deploy ERPLibre locally": { + "fr": "Déploiement - Déployer ERPLibre localement", + "en": "Deploy - Deploy ERPLibre locally", + }, + "Deploy ERPLibre to a local directory!": { + "fr": "Déployer ERPLibre dans un répertoire local!", + "en": "Deploy ERPLibre to a local directory!", + }, + "Clone ERPLibre locally (git clone)": { + "fr": "Cloner ERPLibre localement (git clone)", + "en": "Clone ERPLibre locally (git clone)", + }, + "Target directory path (default: ~/erplibre): ": { + "fr": "Chemin du répertoire cible (défaut: ~/erplibre) : ", + "en": "Target directory path (default: ~/erplibre): ", + }, + "Directory already exists: ": { + "fr": "Le répertoire existe déjà : ", + "en": "Directory already exists: ", + }, + "Cloning ERPLibre...": { + "fr": "Clonage d'ERPLibre en cours...", + "en": "Cloning ERPLibre...", + }, + "ERPLibre cloned successfully to: ": { + "fr": "ERPLibre cloné avec succès dans : ", + "en": "ERPLibre cloned successfully to: ", + }, + "Error cloning ERPLibre: ": { + "fr": "Erreur lors du clonage d'ERPLibre : ", + "en": "Error cloning ERPLibre: ", + }, # RTK (Rust Token Killer) "Manage RTK (Rust Token Killer) for token optimization!": { "fr": "Gérer RTK (Rust Token Killer) pour optimiser les tokens!",