From 946365196a7098afbe87b94a0a57d1f0588345e8 Mon Sep 17 00:00:00 2001 From: Ameya Shenoy Date: Sun, 15 Apr 2018 05:00:16 +0530 Subject: [PATCH] set repo-url and branch for frappe and erpnext --- playbooks/install.py | 25 +++++++++++++++++-- playbooks/roles/bench/tasks/main.yml | 4 +-- playbooks/roles/bench/tasks/setup_erpnext.yml | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/playbooks/install.py b/playbooks/install.py index 4d557373..52d14ed6 100644 --- a/playbooks/install.py +++ b/playbooks/install.py @@ -103,8 +103,17 @@ def install_bench(args): if args.production: extra_vars.update(max_worker_connections=multiprocessing.cpu_count() * 1024) - branch = 'master' if args.production else 'develop' - extra_vars.update(branch=branch) + if args.frappe_branch: + frappe_branch = args.frappe_branch + else: + frappe_branch = 'master' if args.production else 'develop' + extra_vars.update(frappe_branch=frappe_branch) + + if args.erpnext_branch: + erpnext_branch = args.erpnext_branch + else: + erpnext_branch = 'master' if args.production else 'develop' + extra_vars.update(erpnext_branch=erpnext_branch) bench_name = 'frappe-bench' if not args.bench_name else args.bench_name extra_vars.update(bench_name=bench_name) @@ -359,6 +368,18 @@ def parse_commandline_args(): parser.add_argument('--repo-url', dest='repo_url', help='Clone bench from the given url') + parser.add_argument('--frappe-repo-url', dest='frappe_repo_url', action='store', default='https://github.com/frappe/frappe', + help='Clone frappe from the given url') + + parser.add_argument('--frappe-branch', dest='frappe_branch', action='store', + help='Clone a particular branch of frappe') + + parser.add_argument('--erpnext-repo-url', dest='erpnext_repo_url', action='store', default='https://github.com/frappe/erpnext', + help='Clone erpnext from the given url') + + parser.add_argument('--erpnext-branch', dest='erpnext_branch', action='store', + help='Clone a particular branch of erpnext') + # To enable testing of script using Travis, this should skip the prompt parser.add_argument('--run-travis', dest='run_travis', action='store_true', default=False, help=argparse.SUPPRESS) diff --git a/playbooks/roles/bench/tasks/main.yml b/playbooks/roles/bench/tasks/main.yml index 0a963b30..0a9afa6e 100644 --- a/playbooks/roles/bench/tasks/main.yml +++ b/playbooks/roles/bench/tasks/main.yml @@ -29,13 +29,13 @@ register: bench_stat - name: python3 bench init for develop - command: bench init {{ bench_path }} --frappe-branch {{ branch }} --python {{ python }} + command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} --python {{ python }} args: creates: "{{ bench_path }}" when: not bench_stat.stat.exists and not production - name: python2 bench init for production - command: bench init {{ bench_path }} --frappe-branch {{ branch }} + command: bench init {{ bench_path }} --frappe-path {{ frappe_repo_url }} --frappe-branch {{ frappe_branch }} args: creates: "{{ bench_path }}" when: not bench_stat.stat.exists and production diff --git a/playbooks/roles/bench/tasks/setup_erpnext.yml b/playbooks/roles/bench/tasks/setup_erpnext.yml index b7f83691..2e49219c 100644 --- a/playbooks/roles/bench/tasks/setup_erpnext.yml +++ b/playbooks/roles/bench/tasks/setup_erpnext.yml @@ -4,7 +4,7 @@ register: app - name: Get the ERPNext app - command: bench get-app erpnext https://github.com/frappe/erpnext --branch {{ branch }} + command: bench get-app erpnext {{ erpnext_repo_url }} --branch {{ erpnext_branch }} args: creates: "{{ bench_path }}/apps/erpnext" chdir: "{{ bench_path }}"