1010import typer
1111from typing_extensions import Annotated
1212
13+ import otoolbox
1314from otoolbox import env
1415from otoolbox import utils
1516from otoolbox .constants import RESOURCE_PRIORITY_DEFAULT
1617
1718
1819LINUX_SCRIPTS = [
19- "bulk-add-repos.sh" ,
20- "bulk-clone-al.sh" ,
21- "bulk-commit.sh" ,
22- "bulk-init-tests.sh" ,
23- "bulk-pre-commit.sh" ,
24- "bulk-pull.sh" ,
25- "bulk-push-shielded.sh" ,
26- "bulk-push.sh" ,
27- "bulk-repo-init.sh" ,
28- "bulk-sync-shielded.sh" ,
29- "ubuntu-install-apps.sh" ,
30- "ubuntu-office-conf.sh" ,
20+ "bulk-common" ,
21+ "bulk-add-repos" ,
22+ "bulk-clone-al" ,
23+ "bulk-commit" ,
24+ "bulk-init-tests" ,
25+ "bulk-pre-commit" ,
26+ "bulk-pull" ,
27+ "bulk-push-shielded" ,
28+ "bulk-push" ,
29+ "bulk-repo-init" ,
30+ "bulk-sync-shielded" ,
31+ "ubuntu-install-apps" ,
32+ "ubuntu-office-conf" ,
33+ ]
34+
35+ PIPX_APPLICATIONS = [
36+ "copier" ,
37+ "pre-commit" ,
3138]
3239
3340
@@ -43,6 +50,16 @@ def install():
4350 env .console .print ("Run ./ubuntu-install-apps.sh in terminal." )
4451
4552
53+
54+ @app .command (name = "init" )
55+ def init ():
56+ env .console .print ("Update working directory to the current workspace." )
57+ otoolbox .command_run (
58+ steps = ["init" , "update" , "verify" ],
59+ tags = ["ubuntu" ],
60+ ssh_auth = True ,
61+ )
62+
4663###################################################################
4764# init
4865###################################################################
@@ -52,19 +69,20 @@ def init():
5269 """Init the resources for the workspace"""
5370 env .add_resource (
5471 priority = RESOURCE_PRIORITY_DEFAULT ,
55- path = ".bin" ,
56- title = "Workspace configuration directory" ,
57- description = "All configuration related to current workspace are located in this folder" ,
72+ path = ".venv/bin" ,
73+ title = "Workspace binary tools directory" ,
74+ description = "All binary tools related to the current workspace are located in this folder" ,
75+ destroy = [],
5876 init = [utils .makedir ],
59- destroy = [utils .delete_dir ],
6077 verify = [utils .is_dir , utils .is_readable ],
78+ tags = ["ubuntu" , "folder" , ".venv/bin" ],
6179 )
6280
6381
6482 for script in LINUX_SCRIPTS :
6583 env .add_resource (
6684 priority = RESOURCE_PRIORITY_DEFAULT ,
67- path = script ,
85+ path = f".venv/bin/ { script } " ,
6886 title = f"Ubuntu utility script { script } " ,
6987 description = "Install all required application in ubuntu." ,
7088 init = [
@@ -79,32 +97,22 @@ def init():
7997 ],
8098 destroy = [utils .delete_file ],
8199 verify = [utils .is_file , utils .is_executable ],
82- tags = ["bash " , "utility " , "ubuntu" ],
100+ tags = ["ubuntu " , "tools " , script ],
83101 )
84102
85- env .add_resource (
86- priority = RESOURCE_PRIORITY_DEFAULT ,
87- path = "application://copier" ,
88- title = "Copier tool" ,
89- description = "Copier" ,
90- init = [utils .pipx_install , utils .pipx_ensurepath ],
91- update = [],
92- destroy = [utils .pipx_remove ],
93- verify = [utils .pipx_is_install , utils .pipx_ensurepath ],
94- tags = ["application" , "oca" , "maintainer" ],
95- )
103+ for app in PIPX_APPLICATIONS :
104+ env .add_resource (
105+ priority = RESOURCE_PRIORITY_DEFAULT ,
106+ path = f"application://{ app } " ,
107+ title = f"{ app } tool" ,
108+ description = f"{ app } tool installed via pipx" ,
109+ init = [utils .pipx_install , utils .pipx_ensurepath ],
110+ update = [utils .pipx_update , utils .pipx_ensurepath ],
111+ destroy = [utils .pipx_remove ],
112+ verify = [utils .pipx_is_install , utils .pipx_ensurepath ],
113+ tags = ["ubuntu" , "tools" , app ],
114+ )
96115
97- env .add_resource (
98- priority = RESOURCE_PRIORITY_DEFAULT ,
99- path = "application://pre-commit" ,
100- title = "pre-commit tool" ,
101- description = "pre-commit" ,
102- init = [utils .pipx_install , utils .pipx_ensurepath ],
103- update = [utils .pipx_update , utils .pipx_ensurepath ],
104- destroy = [utils .pipx_remove ],
105- verify = [utils .pipx_is_install , utils .pipx_ensurepath ],
106- tags = ["application" , "oca" , "maintainer" ],
107- )
108116
109117
110118###################################################################
0 commit comments