From 7106bebf24df62055f24937d21a3cb1d4c6c4933 Mon Sep 17 00:00:00 2001 From: Renzo Meister Date: Tue, 6 Nov 2018 18:00:01 +0100 Subject: [PATCH] README added --- README.md | 79 ++++++++++++++++++++++++++++++++++++++++++- migrate_repository.py | 8 ++--- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ea6edb2..46943df 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,81 @@ Usage ----- ### Easiest way - \ No newline at end of file + +If you are using docker you can follow these steps to migrate your repository: + +1. Create a base folder for conversion + + mkdir -p /tmp/convert + +2. Clone your odoo repository into folder called odoo + + git clone https://github.com/jamotion/sale-workflow.git /tmp/convert/odoo + +3. Start Conversion with following command: + + docker run --rm -ti -v /tmp/convert:/opt/migrator/data flecom/odoo2flectra --name "Sale Workflow" + +4. When conversion is finished, you will find the converted repository in folder /tmp/convert/flectra + + ls /tmp/convert/flectra + +### Manual way + +If you do not use docker (why not!?!), it is possible to run the python script manually. +For this python > 3.5 and jinja package are required. + +1. Clone this repository with: + + git clone https://gitlab.com/flectra-community/devops/odoo-2-flectra-converter.git + cd odoo-2-flectra-converter + chmod +x migrate_repository.py + +2. Clone your odoo repository into folder called odoo + + git clone https://github.com/jamotion/sale-workflow.git ./odoo + +3. Start Conversion with following command: + + ./migrate_repository --name "Sale Workflow" + +4. When conversion is finished, you will find the converted repository in folder ./flectra + + ls ./flectra + +### Command line parameters + +* **--name**: Set the name of the repository, used for generated README file +(required) +* **--company**: Set the name of your company, used on multiple places +(optional, default "Jamotion GmbH") +* **--contributor**: Set your name (e.g. "Renzo Meister, Jamotion ") +(optional, default "Jamotion ") +* **--src**: Source path of your odoo repository +(optional, default "./odoo") +* **--dest**: Destination path where the converted repository will be stored +(optional, default "./flectra") +* **--debug**: Use DEBUG as loglevel +(optional) + + +#### Full example with docker + + docker run --rm -ti \ + -v /tmp/convert:/opt/migrator/data \ + flecom/odoo2flectra \ + --name "Sale Workflow" \ + --company "Flectra Community" \ + --contributor "Flectra Community " \ + --src "./sale-workflow" \ + --dest "./flectra/sale-workflow" \ + --debug + +#### Full example with direct call + + ./migrate_repository --name "Sale Workflow" \ + --company "Flectra Community" \ + --contributor "Flectra Community " \ + --src "./sale-workflow" \ + --dest "./flectra/sale-workflow" \ + --debug diff --git a/migrate_repository.py b/migrate_repository.py index 286be4a..f8472a9 100644 --- a/migrate_repository.py +++ b/migrate_repository.py @@ -32,11 +32,9 @@ if __name__ == "__main__": _logger.error('Source folder %s not found!', args.src) exit(1) - if os.path.exists(args.dest): - _logger.debug('Removing destination folder %s', args.dest) - shutil.rmtree(args.dest) - _logger.debug('Creating destination folder %s', args.dest) - os.mkdir(args.dest) + if not os.path.exists(args.dest): + _logger.debug('Creating destination folder %s', args.dest) + os.mkdir(args.dest) repo_src_path = os.path.abspath(args.src) repo_dst_path = os.path.abspath(args.dest)