diff --git a/README.md b/README.md index 0a88b4e..38f3a9b 100644 --- a/README.md +++ b/README.md @@ -40,21 +40,17 @@ if you have an existing virtualenv binary: `$ virtualenv .venv. ## Setup a waft project -Clone the [waft template project](https://github.com/sunflowerit/waft) and run bootstrap: +Install [copier](https://copier.readthedocs.io): - git clone https://github.com/sunflowerit/waft - cd waft && ./bootstrap + pipx install copier -It will clone waftlib and exit with a suggestion to do more things, which we will do now. +Copy the [waft template project](https://github.com/sunflowerit/waftlib/templates/project) and run bootstrap: -Select an Odoo version that you want to use, for example 13.0 + copier copy https://github.com/sunflowerit/waftlib/templates/project -Create your secret environment variables file from default environment variables template file and rerun bootstrap: +This will ask you for the Odoo and waftlib versions to use, then set up the project. -``` -cp waftlib/templates/13.0/.env-shared .env-secret -./bootstrap -``` +Select an Odoo version that you want to use, for example 13.0. When successful, now we can prepare for building Odoo: - Take a look at default odoo config file `vi common/conf.d/odoo.conf`. diff --git a/templates/project/.env-secret.jinja b/templates/project/.env-secret.jinja new file mode 100644 index 0000000..8b82c3d --- /dev/null +++ b/templates/project/.env-secret.jinja @@ -0,0 +1 @@ +ODOO_VERSION={{odoo_version}} diff --git a/templates/project/.gitignore b/templates/project/.gitignore new file mode 100644 index 0000000..ceb48dd --- /dev/null +++ b/templates/project/.gitignore @@ -0,0 +1,41 @@ +auto +common/conf.d/test-odoo.cfg +custom/src/* +!custom/src/.gitkeep +!custom/src/addons.yaml +!custom/src/repos.yaml +datadir +.env +.env-secret +logfile +migrate-backup +migrate-logfiles +migrate-temporary +migration/*/auto +migration/*/common/conf.d/test-odoo.cfg +migration/*/custom/src/* +!migration/*/custom/src/.gitkeep +!migration/*/custom/src/addons.yaml +!migration/*/custom/src/repos.yaml +migration/*/datadir +migration/*/.env +migration/*/.env-secret +migration/*/.gitignore +migration/*/LICENSE +migration/*/logfile +migration/*/migrate-backup +migration/*/migrate-logfiles +migration/*/migrate-temporary +migration/*/progress.json +migration/*/README.md +migration/*/*.pyc +migration/*/.pyenv +migration/*/.slide +migration/*/.venv +migration/*/waftlib +progress.json +*.pyc +.pyenv +.slide +.venv +waftlib diff --git a/templates/project/README.md b/templates/project/README.md new file mode 100644 index 0000000..98bfc86 --- /dev/null +++ b/templates/project/README.md @@ -0,0 +1,5 @@ +This folder contains the template project for Waft. + +You can start your own Waft/Odoo project based on it by using [copier](https://copier.readthedocs.io). + +On how to do this, please see the [main waftlib README](https://github.com/sunflowerit/waftlib). diff --git a/templates/project/bootstrap.jinja b/templates/project/bootstrap.jinja new file mode 100755 index 0000000..c9c1f72 --- /dev/null +++ b/templates/project/bootstrap.jinja @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e + +export LIBRARIES_REPOSITORIES='https://github.com/sunflowerit/waftlib.git' +export LIBRARIES_VERSION_BRANCH=${LIBRARIES_VERSION_BRANCH:-{{waftlib_version}}} + +################################################################ +###### ###### +###### Don't change variables after this line ###### +###### ###### +################################################################ + +SCRIPT_PATH=$(cd "$(/usr/bin/dirname "$0")" && /bin/pwd) +ODOO_WORK_DIR=$(cd $SCRIPT_PATH && /bin/pwd) +cd $ODOO_WORK_DIR + +/bin/echo "INFO: Remove exist $ODOO_WORK_DIR/waftlib" +/bin/rm -fr $ODOO_WORK_DIR/waftlib +/bin/echo "INFO: Clone $LIBRARIES_REPOSITORIES to $ODOO_WORK_DIR/waftlib" +/usr/bin/git clone -b $LIBRARIES_VERSION_BRANCH $LIBRARIES_REPOSITORIES $ODOO_WORK_DIR/waftlib 2> /dev/null || \ +/usr/bin/git clone -b master $LIBRARIES_REPOSITORIES $ODOO_WORK_DIR/waftlib + +/bin/echo "INFO: Run $ODOO_WORK_DIR/waftlib/bootstrap script" +$ODOO_WORK_DIR/waftlib/bootstrap diff --git a/templates/project/copier.yml b/templates/project/copier.yml new file mode 100644 index 0000000..4d87362 --- /dev/null +++ b/templates/project/copier.yml @@ -0,0 +1,43 @@ +# questions +odoo_version: + type: str + help: What Odoo version should this project have? + choices: + - 19.0 + - 18.0 + - 17.0 + - 16.0 + - 15.0 + - 14.0 + - 19.0 + - 13.0 + - 12.0 + - 11.0 + - 10.0 + - 9.0 + - 8.0 + +waftlib_version: + type: str + help: Which version of Waftlib should this project use? + choices: + - v.22.05.30 + - v.21.09.22 + - v.21.05.10 + - master + +_message_after_copy: | + + Your Waft project with Odoo {{ odoo_version }} has been created successfully! + + Next steps: + + 1. Change directory to the project root: + + $ cd {{ _copier_conf.dst_path }} + + 2. Run bootstrap: + + $ ./bootstrap + + 3. Read the documentation on how to build Odoo diff --git a/templates/project/custom/src/.gitkeep b/templates/project/custom/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/templates/project/{{_copier_conf.answers_file}}.jinja b/templates/project/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 0000000..a96840d --- /dev/null +++ b/templates/project/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier +{{ _copier_answers|to_nice_yaml -}}