Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
1 change: 1 addition & 0 deletions templates/project/.env-secret.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ODOO_VERSION={{odoo_version}}
41 changes: 41 additions & 0 deletions templates/project/.gitignore
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions templates/project/README.md
Original file line number Diff line number Diff line change
@@ -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).
25 changes: 25 additions & 0 deletions templates/project/bootstrap.jinja
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions templates/project/copier.yml
Original file line number Diff line number Diff line change
@@ -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
Empty file.
2 changes: 2 additions & 0 deletions templates/project/{{_copier_conf.answers_file}}.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Changes here will be overwritten by Copier
{{ _copier_answers|to_nice_yaml -}}