Merge branch 'dev_mobile_generator'
- ADD ERPLibre Home Mobile installation, compilation and deployment
This commit is contained in:
commit
c37d7dddef
11 changed files with 163 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -49,3 +49,4 @@ screenshots
|
||||||
screencasts
|
screencasts
|
||||||
private/todo/todo_override_private.json
|
private/todo/todo_override_private.json
|
||||||
.erplibre.error.txt
|
.erplibre.error.txt
|
||||||
|
/mobile/technolibre_home_mobile/
|
||||||
|
|
|
||||||
3
conf/git_manifest_mobile.csv
Normal file
3
conf/git_manifest_mobile.csv
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
"filepath"
|
||||||
|
manifest/git_manifest_erplibre.xml
|
||||||
|
manifest/git_manifest_mobile_home.xml
|
||||||
|
12
manifest/git_manifest_mobile_home.xml
Normal file
12
manifest/git_manifest_mobile_home.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<manifest>
|
||||||
|
<remote name="TechnoLibre" fetch="https://github.com/TechnoLibre/" />
|
||||||
|
|
||||||
|
<project
|
||||||
|
name="technolibre_home_mobile.git"
|
||||||
|
path="mobile/technolibre_home_mobile"
|
||||||
|
remote="TechnoLibre"
|
||||||
|
revision="main"
|
||||||
|
groups="mobile"
|
||||||
|
/>
|
||||||
|
</manifest>
|
||||||
19
mobile/compile_and_run.sh
Executable file
19
mobile/compile_and_run.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ ! -d "./mobile/technolibre_home_mobile" ]]; then
|
||||||
|
echo "Please, run installation ./mobile/install_mobile_dev.sh before run this script ./mobile/compile_and_run.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d "./mobile/technolibre_home_mobile/technolibre_home" ]]; then
|
||||||
|
echo "Please, check repo is working."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd mobile/technolibre_home_mobile/technolibre_home
|
||||||
|
|
||||||
|
npm install
|
||||||
|
npm run build && npx cap sync
|
||||||
|
npx cap run android
|
||||||
|
|
||||||
|
cd -
|
||||||
4
mobile/install_and_run.sh
Executable file
4
mobile/install_and_run.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
./mobile/install_mobile_dev.sh
|
||||||
|
./mobile/compile_and_run.sh
|
||||||
5
mobile/install_mobile_dev.sh
Executable file
5
mobile/install_mobile_dev.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
./script/install/install_erplibre.sh
|
||||||
|
./script/install/install_git_repo.sh
|
||||||
|
./script/manifest/update_manifest_local_mobile.sh
|
||||||
|
|
@ -24,6 +24,7 @@ openai
|
||||||
humanize
|
humanize
|
||||||
requests
|
requests
|
||||||
urwid
|
urwid
|
||||||
|
python-dotenv
|
||||||
python-dateutil
|
python-dateutil
|
||||||
unidecode
|
unidecode
|
||||||
sshconf
|
sshconf
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ _logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_PATH_MANIFEST_CONF = os.path.join("conf", "git_manifest.csv")
|
DEFAULT_PATH_MANIFEST_CONF = os.path.join("conf", "git_manifest.csv")
|
||||||
|
DEFAULT_PATH_MANIFEST_MOBILE_CONF = os.path.join(
|
||||||
|
"conf", "git_manifest_mobile.csv"
|
||||||
|
)
|
||||||
DEFAULT_PATH_MANIFEST_ODOO_CONF = os.path.join("conf", "git_manifest_odoo.csv")
|
DEFAULT_PATH_MANIFEST_ODOO_CONF = os.path.join("conf", "git_manifest_odoo.csv")
|
||||||
DEFAULT_PATH_MANIFEST_PRIVATE_CONF = os.path.join(
|
DEFAULT_PATH_MANIFEST_PRIVATE_CONF = os.path.join(
|
||||||
"private", "default_git_manifest.csv"
|
"private", "default_git_manifest.csv"
|
||||||
|
|
@ -59,6 +62,11 @@ def get_config():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--with_OCA", action="store_true", help="Add OCA manifest"
|
"--with_OCA", action="store_true", help="Add OCA manifest"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--with_mobile",
|
||||||
|
action="store_true",
|
||||||
|
help="Add mobile project manifest",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
@ -117,6 +125,10 @@ def main():
|
||||||
if os.path.exists(path_manifest_odoo_version):
|
if os.path.exists(path_manifest_odoo_version):
|
||||||
lst_input.append(path_manifest_odoo_version)
|
lst_input.append(path_manifest_odoo_version)
|
||||||
|
|
||||||
|
elif config.with_mobile:
|
||||||
|
append_file_path_manifest(
|
||||||
|
lst_input, DEFAULT_PATH_MANIFEST_MOBILE_CONF
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
append_file_path_manifest(lst_input, DEFAULT_PATH_MANIFEST_CONF)
|
append_file_path_manifest(lst_input, DEFAULT_PATH_MANIFEST_CONF)
|
||||||
append_file_path_manifest(
|
append_file_path_manifest(
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,4 @@
|
||||||
python3 -m venv .venv.erplibre
|
python3 -m venv .venv.erplibre
|
||||||
source .venv.erplibre/bin/activate
|
source .venv.erplibre/bin/activate
|
||||||
pip3 install -r requirement/erplibre_require-ments.txt
|
pip3 install -r requirement/erplibre_require-ments.txt
|
||||||
|
npm install
|
||||||
|
|
|
||||||
23
script/manifest/update_manifest_local_mobile.sh
Executable file
23
script/manifest/update_manifest_local_mobile.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
. ./env_var.sh
|
||||||
|
#EL_MANIFEST_PROD="./default.xml"
|
||||||
|
#EL_MANIFEST_DEV="./manifest/default.dev.xml"
|
||||||
|
|
||||||
|
# Update git-repo
|
||||||
|
git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose &
|
||||||
|
DAEMON_PID=$!
|
||||||
|
|
||||||
|
if [ -L "$EL_MANIFEST_DEV" ]; then
|
||||||
|
MANIFEST_TARGET=$(readlink -f "$EL_MANIFEST_DEV")
|
||||||
|
else
|
||||||
|
MANIFEST_TARGET="$EL_MANIFEST_DEV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate local manifest
|
||||||
|
.venv.erplibre/bin/python ./script/git/git_merge_repo_manifest.py --output .repo/local_manifests/erplibre_manifest.xml --with_mobile
|
||||||
|
|
||||||
|
.venv.erplibre/bin/repo init -u git://127.0.0.1:9418/ -b $(git rev-parse --verify HEAD) -m ${MANIFEST_TARGET} "$@"
|
||||||
|
.venv.erplibre/bin/repo sync -c -j $(nproc --all) -v -m ${MANIFEST_TARGET}
|
||||||
|
|
||||||
|
kill ${DAEMON_PID}
|
||||||
|
|
@ -35,6 +35,7 @@ try:
|
||||||
from tkinter import filedialog
|
from tkinter import filedialog
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
import dotenv
|
||||||
import humanize
|
import humanize
|
||||||
import openai
|
import openai
|
||||||
import todo_file_browser
|
import todo_file_browser
|
||||||
|
|
@ -65,6 +66,7 @@ _logger = logging.getLogger(__name__)
|
||||||
CONFIG_FILE = "./script/todo/todo.json"
|
CONFIG_FILE = "./script/todo/todo.json"
|
||||||
CONFIG_OVERRIDE_FILE = "./private/todo/todo.json"
|
CONFIG_OVERRIDE_FILE = "./private/todo/todo.json"
|
||||||
LOGO_ASCII_FILE = "./script/todo/logo_ascii.txt"
|
LOGO_ASCII_FILE = "./script/todo/logo_ascii.txt"
|
||||||
|
PATH_MOBILE_PROJECT_HOME = "./mobile/technolibre_home_mobile/technolibre_home"
|
||||||
|
|
||||||
|
|
||||||
class TODO:
|
class TODO:
|
||||||
|
|
@ -323,6 +325,11 @@ class TODO:
|
||||||
"w: Install all Odoo version with ERPLibre",
|
"w: Install all Odoo version with ERPLibre",
|
||||||
"make install_odoo_all_version",
|
"make install_odoo_all_version",
|
||||||
),
|
),
|
||||||
|
"m": (
|
||||||
|
"m",
|
||||||
|
"m: ERPLibre with mobile home",
|
||||||
|
"./mobile/install_and_run.sh",
|
||||||
|
),
|
||||||
"0": (
|
"0": (
|
||||||
"0",
|
"0",
|
||||||
"0: Quitter",
|
"0: Quitter",
|
||||||
|
|
@ -435,6 +442,10 @@ class TODO:
|
||||||
command=command, extra_cmd_web_login=extra_cmd_web_login
|
command=command, extra_cmd_web_login=extra_cmd_web_login
|
||||||
)
|
)
|
||||||
|
|
||||||
|
callback = dct_instance.get("callback")
|
||||||
|
if callback:
|
||||||
|
callback(dct_instance)
|
||||||
|
|
||||||
def fill_help_info(self, lst_instance):
|
def fill_help_info(self, lst_instance):
|
||||||
help_info = "Commande :\n"
|
help_info = "Commande :\n"
|
||||||
help_end = "[0] Retour\n"
|
help_end = "[0] Retour\n"
|
||||||
|
|
@ -450,6 +461,14 @@ class TODO:
|
||||||
# TODO proposer l'exécution de docker
|
# TODO proposer l'exécution de docker
|
||||||
# TODO proposer la création de docker
|
# TODO proposer la création de docker
|
||||||
lst_instance = self.config_file.get_config("instance")
|
lst_instance = self.config_file.get_config("instance")
|
||||||
|
init_len = len(lst_instance)
|
||||||
|
|
||||||
|
if os.path.exists(PATH_MOBILE_PROJECT_HOME):
|
||||||
|
dct_upgrade_odoo_database = {
|
||||||
|
"prompt_description": "Mobile - Compile and run software",
|
||||||
|
"callback": self.callback_make_mobile_home,
|
||||||
|
}
|
||||||
|
lst_instance.append(dct_upgrade_odoo_database)
|
||||||
help_info = self.fill_help_info(lst_instance)
|
help_info = self.fill_help_info(lst_instance)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -461,7 +480,7 @@ class TODO:
|
||||||
cmd_no_found = True
|
cmd_no_found = True
|
||||||
try:
|
try:
|
||||||
int_cmd = int(status)
|
int_cmd = int(status)
|
||||||
if 0 < int_cmd <= len(lst_instance):
|
if 0 < int_cmd <= init_len:
|
||||||
cmd_no_found = False
|
cmd_no_found = False
|
||||||
status = click.confirm(
|
status = click.confirm(
|
||||||
"Voulez-vous une nouvelle instance?"
|
"Voulez-vous une nouvelle instance?"
|
||||||
|
|
@ -472,6 +491,12 @@ class TODO:
|
||||||
exec_run_db=True,
|
exec_run_db=True,
|
||||||
ignore_makefile=not bool(status),
|
ignore_makefile=not bool(status),
|
||||||
)
|
)
|
||||||
|
elif int_cmd <= len(lst_instance):
|
||||||
|
# Execute dynamic instance
|
||||||
|
dct_instance = lst_instance[int_cmd - 1]
|
||||||
|
self.execute_from_configuration(
|
||||||
|
dct_instance,
|
||||||
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if cmd_no_found:
|
if cmd_no_found:
|
||||||
|
|
@ -1121,6 +1146,62 @@ class TODO:
|
||||||
self.dir_path = dir_path
|
self.dir_path = dir_path
|
||||||
todo_file_browser.exit_program()
|
todo_file_browser.exit_program()
|
||||||
|
|
||||||
|
def callback_make_mobile_home(self, dct_config):
|
||||||
|
default_project_name = "ERPLibre"
|
||||||
|
default_project_url_name = "https://erplibre.ca"
|
||||||
|
default_debug = False
|
||||||
|
project_name = default_project_name
|
||||||
|
project_url_name = default_project_url_name
|
||||||
|
do_debug = default_debug
|
||||||
|
|
||||||
|
do_personalize = input(
|
||||||
|
"Do you want to personalize the mobile application (Y) : "
|
||||||
|
)
|
||||||
|
if do_personalize.strip().lower() == "y":
|
||||||
|
project_name = (
|
||||||
|
input(
|
||||||
|
f"Your project name, default {default_project_name} : "
|
||||||
|
).strip()
|
||||||
|
or default_project_name
|
||||||
|
)
|
||||||
|
project_url_name = (
|
||||||
|
input(
|
||||||
|
f"Your project url website, default {default_project_url_name} : "
|
||||||
|
).strip()
|
||||||
|
or default_project_url_name
|
||||||
|
)
|
||||||
|
do_debug = (
|
||||||
|
input("Do you want debug information (Y) :").strip().lower()
|
||||||
|
== "y"
|
||||||
|
)
|
||||||
|
|
||||||
|
dotenv_file = dotenv.find_dotenv(
|
||||||
|
filename=os.path.join(
|
||||||
|
PATH_MOBILE_PROJECT_HOME, "src", ".env.production"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
# dotenv_mobile = dotenv.dotenv_values(dotenv_file)
|
||||||
|
# dotenv_mobile["VITE_TITLE"] = project_name
|
||||||
|
# dotenv_mobile["VITE_WEBSITE_URL"] = project_url_name
|
||||||
|
dotenv.set_key(
|
||||||
|
dotenv_file, "VITE_TITLE", project_name, quote_mode="always"
|
||||||
|
)
|
||||||
|
dotenv.set_key(
|
||||||
|
dotenv_file,
|
||||||
|
"VITE_WEBSITE_URL",
|
||||||
|
project_url_name,
|
||||||
|
quote_mode="always",
|
||||||
|
)
|
||||||
|
dotenv.set_key(
|
||||||
|
dotenv_file,
|
||||||
|
"VITE_DEBUG_DEV",
|
||||||
|
"true" if do_debug else "false",
|
||||||
|
quote_mode="never",
|
||||||
|
)
|
||||||
|
status = self.executer_commande_live(
|
||||||
|
"./mobile/compile_and_run.sh", source_erplibre=False
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue