rocketdoo 1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rocketdoo-1.0/LICENSE ADDED
@@ -0,0 +1,63 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+ Copyright (C) 2024 Horacio Montaño
4
+
5
+
6
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
7
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
8
+
9
+ This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
10
+
11
+ 0. Additional Definitions.
12
+ As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
13
+
14
+ “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
15
+
16
+ An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
17
+
18
+ A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
19
+
20
+ The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
21
+
22
+ The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
23
+
24
+ 1. Exception to Section 3 of the GNU GPL.
25
+ You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
26
+
27
+ 2. Conveying Modified Versions.
28
+ If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
29
+ a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
30
+ b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
31
+
32
+ 3. Object Code Incorporating Material from Library Header Files.
33
+ The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts, and accessors, small macros, and small inline functions (ten lines or less in length), you do both of the following:
34
+ a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
35
+ b) Accompany the object code with a copy of the GNU GPL and this license document.
36
+
37
+ 4. Combined Works.
38
+ You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
39
+ a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
40
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
41
+ c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
42
+ d) Do one of the following:
43
+ 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
44
+ 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
45
+
46
+ 5. Combined Libraries.
47
+ You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
48
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
49
+ b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
50
+
51
+ 6. Revised Versions of the GNU Lesser General Public License.
52
+ The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
53
+ Each version is given a distinguishing version number. If the Library specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library does not specify a version number of the GNU Lesser General Public License, you may choose any version ever published by the Free Software Foundation.
54
+
55
+ If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
56
+
57
+ <div Rocketdoo=""></div>
58
+
59
+ Licencia: LGPL-3.0+
60
+ Versión: "1.0"
61
+ Autor: Horacio Montaño, Elias Braceras
62
+ Fecha: 16/10/2024
63
+ Descripción: Framework to development Odoo
rocketdoo-1.0/PKG-INFO ADDED
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.1
2
+ Name: rocketdoo
3
+ Version: 1.0
4
+ Summary: This library allows you to build an automated local development environment for Odoo EE and CE.
5
+ Home-page: https://github.com/HDM-soft/rocketdoo.git
6
+ Author: Horacio Montaño and Elias Braceras
7
+ Author-email: horaciomontano@hdmsoft.com.ar
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+
11
+ # HDMsoft
12
+ [visit our page](https://odoo.hdmsoft.com.ar)
13
+
14
+ ## ROCKETDOO
15
+
16
+ Base repository for Odoo development.
17
+
18
+ ## Developed by:
19
+
20
+ - "Elias Braceras"
21
+ - "Horacio Montaño"
22
+
23
+ ## Version:
24
+ - "1.0"
25
+
26
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
27
+
28
+ ### Simple Description:
29
+
30
+ This repository should be used as a template for any Odoo development. It comes equipped with a set of tools to streamline work during the development preparation process. This development environment is designed as a Python library, so it’s important to install it as such.
31
+
32
+ - This development environment is intended for those developing on Linux operating systems, such as Ubuntu, Debian, etc. However, for those who prefer to develop on Windows, we suggest installing **WSL2**, the Windows Subsystem for Linux.
33
+
34
+ - This version includes a CLI project launcher designed to make setting up your development project easier.
35
+
36
+ - Docker is used to create Odoo instances, and Docker Compose is used to spin them up along with a database.
37
+
38
+ - A set of configurations is provided for use in VSCode, including debugging and container launch configurations.
39
+
40
+ - Gitman is used for downloading and installing external repositories.
41
+
42
+ - Make sure you have **Docker** and **Docker Compose** installed on your computer. If not, you can follow the official Docker installation guide, [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/).
43
+
44
+ - This environment allows for working with private repositories. For this, the developer user needs to copy their private key and corresponding public key—those used for their GitHub repo configuration—into the **.ssh** folder in this directory.
45
+
46
+ ------------------------------------------------------------------------------------------------------------------------------------------------------------
47
+
48
+ ### INSTRUCTIONS:
49
+
50
+ 1. The first step is to use the HDMSOFT repository, our **rocketdoo** template, by creating a repository from it using the green **use this template** button at the top right corner.
51
+
52
+ 2. Decide on a name for your development repository.
53
+
54
+ 3. Once your repository is created, clone it:
55
+
56
+ ```git clone "your_repo_url"```
57
+
58
+
59
+ 4. Before running the launcher, navigate to your repository directory and install the dependencies using the command:
60
+
61
+ ```sudo pip3 install -r requirements.txt```
62
+
63
+ 5. Now you can run ROCKETDOO with the command:
64
+
65
+ ```rocketdoo```
66
+
67
+ 6. Follow the steps provided by the launch software.
68
+
69
+ 7. The second stage of the LAUNCHER offers you the option to use **GITMAN** for third-party repositories. If you say yes, you’ll need to answer some questions.
70
+
71
+ 8. Our launcher will modify the odoo.conf file in the "addons_path" line with the new repositories.
72
+
73
+ 9. Once your project is ready, you can bring up your local instance with:
74
+
75
+ ```docker compose up```
76
+
77
+ 11. RocketDoo will start building the environment image and then launch the system. Once successfully completed, you can check by entering the following URL in your web browser: **localhost:port**
78
+
79
+ 12. If your project has launched successfully, you can run the command:
80
+
81
+ ```code .```
82
+
83
+ NOW YOU CAN START DEVELOPING WITH "VISUAL STUDIO CODE"!
84
+
85
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
86
+
87
+ ### Suggestions and Considerations:
88
+
89
+ - We recommend using Visual Studio Code Extensions, such as **Docker**, **Dev Container**, and any others you find useful for working in VSCode.
90
+
91
+ - If you wish to develop in the Enterprise edition, Rocketdoo will ask you, and will make the necessary configurations. However, you should ensure that you have the "enterprise" folder with all the modules and place it in the root of this project.
92
+
93
+ ### HOW TO ADD MORE MODULES TO GITMAN IF YOU DID NOT DO IT WITH THE LAUNCHER?
94
+
95
+ - If you need to use third-party addons after setting up your development environment with our launcher, you’ll need to manually edit the **gitman.yml** file and also add lines to the **odoo.conf** addons_path using:
96
+
97
+ ```sudo nano gitman.yml```
98
+
99
+ and complete each line, starting with the repository URL and version, according to your development deployment version. You’ll need to replicate the set of lines to add more third-party repositories.
100
+
101
+ If you need help, you can refer to the [gitman official guide](https://gitman.readthedocs.io/en/latest/).
102
+
103
+ - In this example, you can see how to add your new module package paths.
104
+
105
+ Example:
106
+ ```addons_path: usr/lib/python/dist-packages/odoo/extra_addons/,usr/lib/python/dist-packages/odoo/external_addons/account-financial-tools```
107
+
108
+ - Gitman creates a folder containing all declared modules under **external_addons**, which can be found inside your Odoo web container at the path declared in **odoo.conf**.
109
+
110
+ - All paths should be separated by a comma ","
111
+ - Once third-party modules are declared in "gitman," you’ll need to rebuild your image, keeping the same image name as initially created, using the command:
112
+
113
+ ```docker build . -t my-image-name```
114
+
115
+ - Then restart the Odoo service or container with the command:
116
+
117
+ ```docker compose restart```
118
+
119
+ and once in your Odoo instance, refresh the application list in "developer" mode to see the new modules.
120
+
121
+ If you modify your **gitman.yml** file before building with the "build" command, it will be sufficient to see the modules without needing to restart your containers.
122
+
123
+ - For simpler third-party modules, as well as the module you’re developing, we recommend placing them in the **addons** folder within your working directory.
124
+
125
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
126
+
127
+ ### Technical Support
128
+
129
+ - If you have any questions or issues with our development environment, you can contact us and submit your inquiry or support ticket by clicking on the link below.
130
+
131
+ - [Support Link](https://odoo.hdmsoft.com.ar/contactus)
132
+
133
+
@@ -0,0 +1,123 @@
1
+ # HDMsoft
2
+ [visit our page](https://odoo.hdmsoft.com.ar)
3
+
4
+ ## ROCKETDOO
5
+
6
+ Base repository for Odoo development.
7
+
8
+ ## Developed by:
9
+
10
+ - "Elias Braceras"
11
+ - "Horacio Montaño"
12
+
13
+ ## Version:
14
+ - "1.0"
15
+
16
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
17
+
18
+ ### Simple Description:
19
+
20
+ This repository should be used as a template for any Odoo development. It comes equipped with a set of tools to streamline work during the development preparation process. This development environment is designed as a Python library, so it’s important to install it as such.
21
+
22
+ - This development environment is intended for those developing on Linux operating systems, such as Ubuntu, Debian, etc. However, for those who prefer to develop on Windows, we suggest installing **WSL2**, the Windows Subsystem for Linux.
23
+
24
+ - This version includes a CLI project launcher designed to make setting up your development project easier.
25
+
26
+ - Docker is used to create Odoo instances, and Docker Compose is used to spin them up along with a database.
27
+
28
+ - A set of configurations is provided for use in VSCode, including debugging and container launch configurations.
29
+
30
+ - Gitman is used for downloading and installing external repositories.
31
+
32
+ - Make sure you have **Docker** and **Docker Compose** installed on your computer. If not, you can follow the official Docker installation guide, [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/).
33
+
34
+ - This environment allows for working with private repositories. For this, the developer user needs to copy their private key and corresponding public key—those used for their GitHub repo configuration—into the **.ssh** folder in this directory.
35
+
36
+ ------------------------------------------------------------------------------------------------------------------------------------------------------------
37
+
38
+ ### INSTRUCTIONS:
39
+
40
+ 1. The first step is to use the HDMSOFT repository, our **rocketdoo** template, by creating a repository from it using the green **use this template** button at the top right corner.
41
+
42
+ 2. Decide on a name for your development repository.
43
+
44
+ 3. Once your repository is created, clone it:
45
+
46
+ ```git clone "your_repo_url"```
47
+
48
+
49
+ 4. Before running the launcher, navigate to your repository directory and install the dependencies using the command:
50
+
51
+ ```sudo pip3 install -r requirements.txt```
52
+
53
+ 5. Now you can run ROCKETDOO with the command:
54
+
55
+ ```rocketdoo```
56
+
57
+ 6. Follow the steps provided by the launch software.
58
+
59
+ 7. The second stage of the LAUNCHER offers you the option to use **GITMAN** for third-party repositories. If you say yes, you’ll need to answer some questions.
60
+
61
+ 8. Our launcher will modify the odoo.conf file in the "addons_path" line with the new repositories.
62
+
63
+ 9. Once your project is ready, you can bring up your local instance with:
64
+
65
+ ```docker compose up```
66
+
67
+ 11. RocketDoo will start building the environment image and then launch the system. Once successfully completed, you can check by entering the following URL in your web browser: **localhost:port**
68
+
69
+ 12. If your project has launched successfully, you can run the command:
70
+
71
+ ```code .```
72
+
73
+ NOW YOU CAN START DEVELOPING WITH "VISUAL STUDIO CODE"!
74
+
75
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
76
+
77
+ ### Suggestions and Considerations:
78
+
79
+ - We recommend using Visual Studio Code Extensions, such as **Docker**, **Dev Container**, and any others you find useful for working in VSCode.
80
+
81
+ - If you wish to develop in the Enterprise edition, Rocketdoo will ask you, and will make the necessary configurations. However, you should ensure that you have the "enterprise" folder with all the modules and place it in the root of this project.
82
+
83
+ ### HOW TO ADD MORE MODULES TO GITMAN IF YOU DID NOT DO IT WITH THE LAUNCHER?
84
+
85
+ - If you need to use third-party addons after setting up your development environment with our launcher, you’ll need to manually edit the **gitman.yml** file and also add lines to the **odoo.conf** addons_path using:
86
+
87
+ ```sudo nano gitman.yml```
88
+
89
+ and complete each line, starting with the repository URL and version, according to your development deployment version. You’ll need to replicate the set of lines to add more third-party repositories.
90
+
91
+ If you need help, you can refer to the [gitman official guide](https://gitman.readthedocs.io/en/latest/).
92
+
93
+ - In this example, you can see how to add your new module package paths.
94
+
95
+ Example:
96
+ ```addons_path: usr/lib/python/dist-packages/odoo/extra_addons/,usr/lib/python/dist-packages/odoo/external_addons/account-financial-tools```
97
+
98
+ - Gitman creates a folder containing all declared modules under **external_addons**, which can be found inside your Odoo web container at the path declared in **odoo.conf**.
99
+
100
+ - All paths should be separated by a comma ","
101
+ - Once third-party modules are declared in "gitman," you’ll need to rebuild your image, keeping the same image name as initially created, using the command:
102
+
103
+ ```docker build . -t my-image-name```
104
+
105
+ - Then restart the Odoo service or container with the command:
106
+
107
+ ```docker compose restart```
108
+
109
+ and once in your Odoo instance, refresh the application list in "developer" mode to see the new modules.
110
+
111
+ If you modify your **gitman.yml** file before building with the "build" command, it will be sufficient to see the modules without needing to restart your containers.
112
+
113
+ - For simpler third-party modules, as well as the module you’re developing, we recommend placing them in the **addons** folder within your working directory.
114
+
115
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
116
+
117
+ ### Technical Support
118
+
119
+ - If you have any questions or issues with our development environment, you can contact us and submit your inquiry or support ticket by clicking on the link below.
120
+
121
+ - [Support Link](https://odoo.hdmsoft.com.ar/contactus)
122
+
123
+
@@ -0,0 +1,2 @@
1
+ # __init__.py
2
+ from .rocketdoo import main
@@ -0,0 +1,396 @@
1
+
2
+ import sys
3
+ import os
4
+ import re
5
+ import yaml
6
+
7
+
8
+ docker_compose_path = "docker-compose.yml"
9
+ dockerfile_path = "Dockerfile"
10
+
11
+ # Function to modify docker-compose.yml
12
+
13
+ def modificar_docker_compose(edicion):
14
+ if edicion.lower() == 'ee':
15
+ try:
16
+ # Read docker compose at first
17
+ with open(docker_compose_path, 'r') as file:
18
+ contenido = file.readlines()
19
+
20
+ # Modify content memory
21
+ contenido_modificado = []
22
+ for linea in contenido:
23
+ # Check if the line has the specific pattern
24
+ if linea.lstrip().startswith('#- ./enterprise:/usr/lib/python3/dist-packages/odoo/enterprise'):
25
+ # Remove only the '#' symbol that appears after the spaces, without affecting the indentation.
26
+ indentacion = len(linea) - len(linea.lstrip())
27
+ linea = ' ' * indentacion + linea.lstrip().lstrip('#').lstrip()
28
+ contenido_modificado.append(linea)
29
+ else:
30
+ contenido_modificado.append(linea)
31
+
32
+ # Writes the modified content back to the file
33
+ with open(docker_compose_path, 'w') as file:
34
+ file.writelines(contenido_modificado)
35
+
36
+ print("Ambiente preparado para la edición Enterprise. Asegurese de subir a la raiz del proyecto su carpeta Enterprise.")
37
+ except FileNotFoundError:
38
+ print(f"El archivo {docker_compose_path} no se encontró.")
39
+ except Exception as e:
40
+ print(f"Error al modificar {docker_compose_path}: {e}")
41
+
42
+ # Function to modify the odoo.conf file
43
+ def modificar_odoo_conf(edicion):
44
+ odoo_conf_path = os.path.join("config", "odoo.conf")
45
+
46
+ if edicion.lower() == 'ee':
47
+ # Ensure that the file exists
48
+ if not os.path.exists(odoo_conf_path):
49
+ print(f"El archivo {odoo_conf_path} no existe.")
50
+ return
51
+
52
+ with open(odoo_conf_path, 'r') as file:
53
+ contenido = file.read()
54
+
55
+ # Add enterprise path to addons_path
56
+ addons_path = "/usr/lib/python3/dist-packages/odoo/enterprise"
57
+ contenido_modificado = re.sub(r'(addons_path\s*=\s*)(.*)', r'\1\2,{}'.format(addons_path), contenido)
58
+
59
+ with open(odoo_conf_path, 'w') as file:
60
+ file.write(contenido_modificado)
61
+
62
+ print("Archivo odoo.conf modificado para incluir el path de Enterprise.")
63
+
64
+ # Ask for the odoo edition
65
+ edicion = input("¿En qué edición de Odoo va a desarrollar? Community o Enterprise (ce/ee): ").strip().lower()
66
+
67
+ # Apply modifications if Enterprise edition
68
+ if edicion == 'ee':
69
+ modificar_docker_compose(edicion)
70
+ modificar_odoo_conf(edicion)
71
+ else:
72
+ print("Edición Community seleccionada")
73
+
74
+ # SSH lines to be searched and uncommented/commented as needed
75
+ ssh_lines = [
76
+ "#RUN mkdir -p /root/.ssh\n",
77
+ "#COPY ./.ssh/rsa /root/.ssh/id_rsa\n", # The “rsa” will be replaced with the correct key name.
78
+ "#RUN chmod 700 /root/.ssh/id_rsa\n",
79
+ '#RUN echo "StrictHostKeyChecking no" >> /root/.ssh/config\n',
80
+ ]
81
+
82
+
83
+ def get_input(prompt, required=True):
84
+ """Function that receives an input from the user, with the option of not being mandatory."""
85
+ value = input(prompt)
86
+ while required and not value:
87
+ value = input("Este campo no puede estar vacío. " + prompt)
88
+ return value
89
+
90
+
91
+ def manejar_ssh(repos_privados, dockerfile_path):
92
+ """Uncomment or comment out the SSH-related lines in the Dockerfile, and replace 'rsa' with the correct private key."""
93
+ if usar_repos_privados == 's':
94
+ manejar_claves_ssh
95
+ else:
96
+ return
97
+
98
+ # Search for the private key in the ./.ssh folder.
99
+ ssh_folder = "./.ssh"
100
+ try:
101
+ ssh_keys = [
102
+ f
103
+ for f in os.listdir(ssh_folder)
104
+ if os.path.isfile(os.path.join(ssh_folder, f))
105
+ ]
106
+ if not ssh_keys:
107
+ print(f"No se encontraron claves privadas en {ssh_folder}.")
108
+ return
109
+
110
+ # Ask the user which password to use if there is more than one.
111
+ ssh_key = ssh_keys[0]
112
+ if len(ssh_keys) > 1:
113
+ print("Se encontraron las siguientes claves privadas en ./.ssh:")
114
+ for i, key in enumerate(ssh_keys):
115
+ print(f"{i + 1}. {key}")
116
+ key_index = (
117
+ int(get_input("Selecciona el número de la clave que deseas usar: ")) - 1
118
+ )
119
+ ssh_key = ssh_keys[key_index]
120
+
121
+ # Modify Dockerfile
122
+ with open(dockerfile_path, "r") as file:
123
+ lines = file.readlines()
124
+
125
+ with open(dockerfile_path, "w") as file:
126
+ for line in lines:
127
+ # If the user wants to use private repos, we uncomment the lines related to SSH
128
+ if repos_privados and any(
129
+ ssh_line.strip().lstrip("# ") in line for ssh_line in ssh_lines
130
+ ):
131
+ # Just uncomment commented lines and modify “rsa” to the correct key name.
132
+ if line.startswith("#RUN mkdir -p /root/.ssh"):
133
+ file.write(line.lstrip("# ")) # Descomentar
134
+ elif "COPY ./.ssh/rsa" in line:
135
+ file.write(
136
+ line.replace("rsa", ssh_key).lstrip("# ")
137
+ ) # Uncomment and replace
138
+ elif "RUN chmod 700 /root/.ssh/id_rsa" in line:
139
+ file.write(
140
+ line.replace("id_rsa", ssh_key).lstrip("# ")
141
+ ) # Uncomment and replace
142
+ elif '#RUN echo "StrictHostKeyChecking no"' in line:
143
+ file.write(line.lstrip("# ")) # Uncomment
144
+ file.write(line)
145
+ # If you don't want to use private repos, keep or add comments
146
+ elif not repos_privados and any(
147
+ ssh_line.strip().lstrip("# ") in line for ssh_line in ssh_lines
148
+ ):
149
+ file.write(f"# {line.lstrip('# ')}") # Ensure to be commented
150
+ else:
151
+ file.write(line)
152
+
153
+ print(
154
+ f"Líneas relacionadas con SSH {'descomentadas' if repos_privados else 'comentadas'} en {dockerfile_path}."
155
+ )
156
+
157
+ except Exception as e:
158
+ print(f"Error al manejar las claves SSH: {e}")
159
+
160
+
161
+ def comentar_lineas():
162
+ """Comment out specific lines in the Dockerfile."""
163
+ copy_line = "COPY ./gitman.yml /usr/lib/python3/dist-packages/odoo/\n"
164
+ gitman_line = "RUN gitman install -r /usr/lib/python3/dist-packages/odoo/\n"
165
+
166
+ try:
167
+ with open(dockerfile_path, "r") as file:
168
+ lines = file.readlines()
169
+
170
+ with open(dockerfile_path, "w") as file:
171
+ for line in lines:
172
+ if line == copy_line or line == gitman_line:
173
+ file.write(f"# {line}")
174
+ else:
175
+ file.write(line)
176
+
177
+ print("Líneas comentadas correctamente en el Dockerfile.")
178
+
179
+ except FileNotFoundError:
180
+ print(f"El archivo {dockerfile_path} no se encontró.")
181
+ except Exception as e:
182
+ print(f"Error inesperado: {e}")
183
+
184
+
185
+ def manejar_claves_ssh():
186
+
187
+ "Manejar claves SSH solo si se desean utilizar repositorios privados."
188
+ try:
189
+ # Get the name of the private key in the folder ./.ssh
190
+ ssh_folder = "./.ssh"
191
+ private_key_name = ""
192
+
193
+ # Check for files in the folder ./.ssh
194
+ if os.path.exists(ssh_folder) and os.path.isdir(ssh_folder):
195
+ files = os.listdir(ssh_folder)
196
+ private_key_name = next(
197
+ (f for f in files if not f.startswith(".")), None
198
+ ) # Send hidden folders
199
+
200
+ if not private_key_name:
201
+ print("No se encontró ninguna clave privada en la carpeta ./.ssh")
202
+ return
203
+
204
+ # Modify Dockefile
205
+ dockerfile_path = "Dockerfile"
206
+ copy_ssh_line = (
207
+ f"COPY ./.ssh/{private_key_name} /root/.ssh/id_{private_key_name}\n"
208
+ )
209
+ chmod_ssh_line = f"RUN chmod 700 /root/.ssh/id_{private_key_name}\n"
210
+
211
+ with open(dockerfile_path, "r") as file:
212
+ lines = file.readlines()
213
+
214
+ # Check if the lines already exist, and uncomment if necessary.
215
+ new_lines = []
216
+ for line in lines:
217
+ if line.strip() == "#RUN mkdir -p /root/.ssh":
218
+ new_lines.append("RUN mkdir -p /root/.ssh\n")
219
+ elif line.strip() == "#COPY ./.ssh/rsa /root/.ssh/id_rsa":
220
+ new_lines.append(copy_ssh_line)
221
+ elif line.strip() == "#RUN chmod 700 /root/.ssh/id_rsa":
222
+ new_lines.append(chmod_ssh_line)
223
+ else:
224
+ new_lines.append(line)
225
+
226
+ with open(dockerfile_path, "w") as file:
227
+ file.writelines(new_lines)
228
+
229
+ print("Se ha actualizado el Dockerfile con las claves SSH privadas.")
230
+ except Exception as e:
231
+ print(f"Error al manejar las claves SSH: {e}")
232
+
233
+ # Function to validate user input
234
+ def obtener_respuesta_si_no(mensaje):
235
+ while True:
236
+ respuesta = input(mensaje).strip().lower()
237
+ if respuesta in ["s", "n"]:
238
+ return respuesta
239
+ else:
240
+ print("Por favor, ingrese 's' para sí o 'n' para no.")
241
+
242
+
243
+ # Ask if the user wants to use private repositories
244
+ usar_repos_privados = input("¿Desea utilizar repositorios privados? (s/n): ").strip().lower()
245
+
246
+
247
+ # Handle SSH in the Dockerfile based on user response
248
+ manejar_ssh(usar_repos_privados == "s", dockerfile_path)
249
+
250
+ # Ask if the user wants to user gitman with public repositorie
251
+ usar_gitman = input("¿Desea utilizar gitman, con repositorios de terceros? (s/n): ").strip().lower()
252
+
253
+ if usar_gitman != "s":
254
+ if os.path.exists("gitman.yml"):
255
+ os.remove("gitman.yml")
256
+
257
+ print("Sin cambios en gitman. Comentando líneas del Dockerfile...")
258
+ comentar_lineas()
259
+ sys.exit(0)
260
+
261
+
262
+ # Here I would follow the rest of your code to configure Gitman and modify odoo.conf...
263
+
264
+ # Define the initial structure of the configuration file
265
+ config = {
266
+ "location": "external_addons",
267
+ "sources": [],
268
+ "default_group": "",
269
+ "groups": [],
270
+ }
271
+
272
+
273
+ def agregar_repositorio():
274
+ """Functions to add new repositories"""
275
+ repo_info = {
276
+ "repo": get_input("Ingresa el repositorio (repo): "),
277
+ "name": get_input("Ingresa el nombre (name): "),
278
+ "rev": get_input("Ingresa la revisión (branch): "),
279
+ "type": "git", # keeping fixed,
280
+ "scripts": [
281
+ "sh /usr/lib/python3/dist-packages/odoo/install_dependencies.sh"
282
+ ], # keeping fixed
283
+ }
284
+
285
+ # Add the repository information to the source list
286
+ config["sources"].append(repo_info)
287
+
288
+
289
+ # Function to modify the odoo.conf file in the config folder
290
+ def modificar_odoo_conf():
291
+ """Modify the addons_path line in config/odoo.conf by adding the new repositories"""
292
+ try:
293
+ # Path to the odoo.conf file in the config folder
294
+ odoo_conf_path = os.path.join("config", "odoo.conf")
295
+
296
+ # Verifying the existence of the odoo.conf file
297
+ if not os.path.exists(odoo_conf_path):
298
+ raise FileNotFoundError(f"El archivo {odoo_conf_path} no existe.")
299
+
300
+ # We check if we have read and write permissions
301
+ if not os.access(odoo_conf_path, os.R_OK):
302
+ raise PermissionError(
303
+ f"No se puede leer el archivo {odoo_conf_path}. Verifica los permisos."
304
+ )
305
+ if not os.access(odoo_conf_path, os.W_OK):
306
+ raise PermissionError(
307
+ f"No se puede escribir en el archivo {odoo_conf_path}. Verifica los permisos."
308
+ )
309
+
310
+ print(f"Modificando el archivo {odoo_conf_path}...")
311
+
312
+ # We read the gitman.yml file to obtain the names
313
+ with open("gitman.yml", "r") as file:
314
+ gitman_data = yaml.safe_load(file)
315
+
316
+ # We extract the values of 'name' from each repository in sources, making sure not to include empty ones.
317
+ nombres_repositorios = [
318
+ repo["name"] for repo in gitman_data["sources"] if repo["name"]
319
+ ]
320
+ print(f"Repositorios extraídos: {nombres_repositorios}")
321
+
322
+ # If there are no repository names, we do nothing.
323
+ if not nombres_repositorios:
324
+ print("No se encontraron repositorios para agregar.")
325
+ return
326
+
327
+ # We create the new string for addons_path with the new paths
328
+ nuevas_rutas = ",".join(
329
+ [
330
+ f"/usr/lib/python3/dist-packages/odoo/external_addons/{nombre}"
331
+ for nombre in nombres_repositorios
332
+ ]
333
+ )
334
+
335
+ # Read the odoo.conf file
336
+ with open(odoo_conf_path, "r") as file:
337
+ lines = file.readlines()
338
+
339
+ # We look for the line containing addons_path
340
+ addons_path_encontrado = False
341
+ for i, line in enumerate(lines):
342
+ if line.startswith("addons_path ="):
343
+ # We add the new routes to the existing line, if they are not already there.
344
+ linea_actual = line.strip().split(" = ")[1]
345
+ lineas_rutas_existentes = linea_actual.split(",")
346
+
347
+ # We add the new routes to the existing ones, if they are not already there.
348
+ rutas_actualizadas = lineas_rutas_existentes + [
349
+ ruta
350
+ for ruta in nuevas_rutas.split(",")
351
+ if ruta not in lineas_rutas_existentes
352
+ ]
353
+ lines[i] = f"addons_path = {','.join(rutas_actualizadas)}\n"
354
+ addons_path_encontrado = True
355
+ print(f"Línea addons_path modificada: {lines[i]}")
356
+ break
357
+
358
+ # If addons_path is not found, we add it at the end
359
+ if not addons_path_encontrado:
360
+ lines.append(f"addons_path = {nuevas_rutas}\n")
361
+ print("Se agregó una nueva línea addons_path.")
362
+
363
+ # Save the changes in the odoo.conf file.
364
+ with open(odoo_conf_path, "w") as file:
365
+ file.writelines(lines)
366
+
367
+ print("Archivo odoo.conf actualizado exitosamente.")
368
+
369
+ except FileNotFoundError as fnf_error:
370
+ print(fnf_error)
371
+ except PermissionError as perm_error:
372
+ print(perm_error)
373
+ except Exception as e:
374
+ print(f"Error inesperado al modificar odoo.conf: {e}")
375
+
376
+
377
+ # Main to add repositories
378
+ while True:
379
+ agregar_repositorio()
380
+
381
+ # We ask if the user wants to add more repositories
382
+ agregar_mas = input("¿Deseas agregar otro repositorio? (s/n): ").strip().lower()
383
+
384
+ # Validating answer
385
+ if agregar_mas != "s":
386
+ print("Finalizó la configuración de gitman.")
387
+ break
388
+
389
+ # Save the gitman files and their configurations on a YAML format
390
+ with open("gitman.yml", "w") as file:
391
+ yaml.dump(config, file, default_flow_style=False, sort_keys=False)
392
+
393
+ print("Archivo gitman.yml generado exitosamente.")
394
+
395
+ # Calling function to modify odoo.conf
396
+ modificar_odoo_conf()
@@ -0,0 +1,44 @@
1
+ import argparse
2
+ import subprocess
3
+ import signal
4
+ import sys
5
+
6
+ # Define la versión del paquete
7
+ VERSION = "1.0"
8
+
9
+ # Maneja la interrupción con Ctrl+C
10
+ def signal_handler(sig, frame):
11
+ print("\nRocketdoo ha sido cancelado por el usuario.")
12
+ sys.exit(0)
13
+
14
+ # Registra el manejador de señal para SIGINT (Ctrl+C)
15
+ signal.signal(signal.SIGINT, signal_handler)
16
+
17
+ def main():
18
+ # Configura el analizador de argumentos
19
+ parser = argparse.ArgumentParser(description="Rocketdoo CLI")
20
+ parser.add_argument(
21
+ '--version', action='store_true', help="Muestra la versión de Rocketdoo"
22
+ )
23
+
24
+ # Parsea los argumentos
25
+ args = parser.parse_args()
26
+
27
+ # Si se pasa el argumento --version, muestra la versión y sale
28
+ if args.version:
29
+ print(f"Rocketdoo version {VERSION}")
30
+ return
31
+
32
+ # Ejecuta Copier si no se pasa --version
33
+ try:
34
+ subprocess.run(["copier", "copy", "./", "./", "--trust"])
35
+ except KeyboardInterrupt:
36
+ # Este bloque captura el Ctrl+C y permite salir limpiamente
37
+ print("\nRocketdoo ha sido cancelado por el usuario.")
38
+ except Exception as e:
39
+ # Captura cualquier otro error, sin mostrar traceback detallado
40
+ print(f"\nError inesperado: {e}")
41
+ finally:
42
+ sys.exit(0)
43
+
44
+
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.1
2
+ Name: rocketdoo
3
+ Version: 1.0
4
+ Summary: This library allows you to build an automated local development environment for Odoo EE and CE.
5
+ Home-page: https://github.com/HDM-soft/rocketdoo.git
6
+ Author: Horacio Montaño and Elias Braceras
7
+ Author-email: horaciomontano@hdmsoft.com.ar
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+
11
+ # HDMsoft
12
+ [visit our page](https://odoo.hdmsoft.com.ar)
13
+
14
+ ## ROCKETDOO
15
+
16
+ Base repository for Odoo development.
17
+
18
+ ## Developed by:
19
+
20
+ - "Elias Braceras"
21
+ - "Horacio Montaño"
22
+
23
+ ## Version:
24
+ - "1.0"
25
+
26
+ ----------------------------------------------------------------------------------------------------------------------------------------------------------
27
+
28
+ ### Simple Description:
29
+
30
+ This repository should be used as a template for any Odoo development. It comes equipped with a set of tools to streamline work during the development preparation process. This development environment is designed as a Python library, so it’s important to install it as such.
31
+
32
+ - This development environment is intended for those developing on Linux operating systems, such as Ubuntu, Debian, etc. However, for those who prefer to develop on Windows, we suggest installing **WSL2**, the Windows Subsystem for Linux.
33
+
34
+ - This version includes a CLI project launcher designed to make setting up your development project easier.
35
+
36
+ - Docker is used to create Odoo instances, and Docker Compose is used to spin them up along with a database.
37
+
38
+ - A set of configurations is provided for use in VSCode, including debugging and container launch configurations.
39
+
40
+ - Gitman is used for downloading and installing external repositories.
41
+
42
+ - Make sure you have **Docker** and **Docker Compose** installed on your computer. If not, you can follow the official Docker installation guide, [Docker Installation Guide](https://docs.docker.com/engine/install/ubuntu/).
43
+
44
+ - This environment allows for working with private repositories. For this, the developer user needs to copy their private key and corresponding public key—those used for their GitHub repo configuration—into the **.ssh** folder in this directory.
45
+
46
+ ------------------------------------------------------------------------------------------------------------------------------------------------------------
47
+
48
+ ### INSTRUCTIONS:
49
+
50
+ 1. The first step is to use the HDMSOFT repository, our **rocketdoo** template, by creating a repository from it using the green **use this template** button at the top right corner.
51
+
52
+ 2. Decide on a name for your development repository.
53
+
54
+ 3. Once your repository is created, clone it:
55
+
56
+ ```git clone "your_repo_url"```
57
+
58
+
59
+ 4. Before running the launcher, navigate to your repository directory and install the dependencies using the command:
60
+
61
+ ```sudo pip3 install -r requirements.txt```
62
+
63
+ 5. Now you can run ROCKETDOO with the command:
64
+
65
+ ```rocketdoo```
66
+
67
+ 6. Follow the steps provided by the launch software.
68
+
69
+ 7. The second stage of the LAUNCHER offers you the option to use **GITMAN** for third-party repositories. If you say yes, you’ll need to answer some questions.
70
+
71
+ 8. Our launcher will modify the odoo.conf file in the "addons_path" line with the new repositories.
72
+
73
+ 9. Once your project is ready, you can bring up your local instance with:
74
+
75
+ ```docker compose up```
76
+
77
+ 11. RocketDoo will start building the environment image and then launch the system. Once successfully completed, you can check by entering the following URL in your web browser: **localhost:port**
78
+
79
+ 12. If your project has launched successfully, you can run the command:
80
+
81
+ ```code .```
82
+
83
+ NOW YOU CAN START DEVELOPING WITH "VISUAL STUDIO CODE"!
84
+
85
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
86
+
87
+ ### Suggestions and Considerations:
88
+
89
+ - We recommend using Visual Studio Code Extensions, such as **Docker**, **Dev Container**, and any others you find useful for working in VSCode.
90
+
91
+ - If you wish to develop in the Enterprise edition, Rocketdoo will ask you, and will make the necessary configurations. However, you should ensure that you have the "enterprise" folder with all the modules and place it in the root of this project.
92
+
93
+ ### HOW TO ADD MORE MODULES TO GITMAN IF YOU DID NOT DO IT WITH THE LAUNCHER?
94
+
95
+ - If you need to use third-party addons after setting up your development environment with our launcher, you’ll need to manually edit the **gitman.yml** file and also add lines to the **odoo.conf** addons_path using:
96
+
97
+ ```sudo nano gitman.yml```
98
+
99
+ and complete each line, starting with the repository URL and version, according to your development deployment version. You’ll need to replicate the set of lines to add more third-party repositories.
100
+
101
+ If you need help, you can refer to the [gitman official guide](https://gitman.readthedocs.io/en/latest/).
102
+
103
+ - In this example, you can see how to add your new module package paths.
104
+
105
+ Example:
106
+ ```addons_path: usr/lib/python/dist-packages/odoo/extra_addons/,usr/lib/python/dist-packages/odoo/external_addons/account-financial-tools```
107
+
108
+ - Gitman creates a folder containing all declared modules under **external_addons**, which can be found inside your Odoo web container at the path declared in **odoo.conf**.
109
+
110
+ - All paths should be separated by a comma ","
111
+ - Once third-party modules are declared in "gitman," you’ll need to rebuild your image, keeping the same image name as initially created, using the command:
112
+
113
+ ```docker build . -t my-image-name```
114
+
115
+ - Then restart the Odoo service or container with the command:
116
+
117
+ ```docker compose restart```
118
+
119
+ and once in your Odoo instance, refresh the application list in "developer" mode to see the new modules.
120
+
121
+ If you modify your **gitman.yml** file before building with the "build" command, it will be sufficient to see the modules without needing to restart your containers.
122
+
123
+ - For simpler third-party modules, as well as the module you’re developing, we recommend placing them in the **addons** folder within your working directory.
124
+
125
+ ------------------------------------------------------------------------------------------------------------------------------------------------------
126
+
127
+ ### Technical Support
128
+
129
+ - If you have any questions or issues with our development environment, you can contact us and submit your inquiry or support ticket by clicking on the link below.
130
+
131
+ - [Support Link](https://odoo.hdmsoft.com.ar/contactus)
132
+
133
+
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ rocketdoo/__init__.py
5
+ rocketdoo/config.py
6
+ rocketdoo/rocketdoo.py
7
+ rocketdoo.egg-info/PKG-INFO
8
+ rocketdoo.egg-info/SOURCES.txt
9
+ rocketdoo.egg-info/dependency_links.txt
10
+ rocketdoo.egg-info/entry_points.txt
11
+ rocketdoo.egg-info/requires.txt
12
+ rocketdoo.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ rocketdoo = rocketdoo:main
@@ -0,0 +1 @@
1
+ copier
@@ -0,0 +1 @@
1
+ rocketdoo
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
rocketdoo-1.0/setup.py ADDED
@@ -0,0 +1,26 @@
1
+ from setuptools import setup, find_packages
2
+ from pathlib import Path
3
+
4
+ this_directory = Path(__file__).parent
5
+ long_description = (this_directory / "README.md").read_text()
6
+
7
+ setup(
8
+ name='rocketdoo',
9
+ version='1.0',
10
+ description='This library allows you to build an automated local development environment for Odoo EE and CE.',
11
+ long_description=long_description,
12
+ long_description_content_type='text/markdown',
13
+ author='Horacio Montaño and Elias Braceras',
14
+ author_email='horaciomontano@hdmsoft.com.ar',
15
+ url='https://github.com/HDM-soft/rocketdoo.git',
16
+ packages=find_packages(),
17
+ install_requires=[
18
+ 'copier', # Asegúrate de incluir copier en las dependencias
19
+ # Incluye aquí cualquier otra dependencia que tu proyecto necesite
20
+ ],
21
+ entry_points={
22
+ 'console_scripts': [
23
+ 'rocketdoo=rocketdoo:main',
24
+ ],
25
+ },
26
+ )