mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
add script to migrate to version 5
This commit is contained in:
parent
ce23b2319d
commit
6fdd49b214
@ -18,6 +18,7 @@ from .app import new_app as _new_app
|
||||
from .app import pull_all_apps
|
||||
from .config import generate_nginx_config, generate_supervisor_config
|
||||
from .production_setup import setup_production as _setup_production
|
||||
from .migrate_to_v5 import migrate_to_v5
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
@ -176,7 +177,6 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
||||
|
||||
def restart_update(kwargs):
|
||||
args = ['--'+k for k, v in kwargs.items() if v]
|
||||
print 'restarting '
|
||||
os.execv(sys.argv[0], sys.argv[:2] + args)
|
||||
|
||||
@click.command('restart')
|
||||
@ -198,6 +198,11 @@ def migrate_3to4(path):
|
||||
migrate_3to4=os.path.join(os.path.dirname(__file__), 'migrate3to4.py'),
|
||||
site=path))
|
||||
|
||||
@click.command('migrate-to-v5')
|
||||
def _migrate_to_v5(bench='.'):
|
||||
"Migrate to Version 5"
|
||||
migrate_to_v5(bench=bench)
|
||||
|
||||
@click.command('set-nginx-port')
|
||||
@click.argument('site')
|
||||
@click.argument('port', type=int)
|
||||
@ -444,3 +449,4 @@ bench.add_command(_prime_wheel_cache)
|
||||
bench.add_command(_release)
|
||||
bench.add_command(patch)
|
||||
bench.add_command(set_url_root)
|
||||
bench.add_command(_migrate_to_v5)
|
||||
|
33
bench/migrate_to_v5.py
Normal file
33
bench/migrate_to_v5.py
Normal file
@ -0,0 +1,33 @@
|
||||
from .utils import exec_cmd, get_frappe
|
||||
import os
|
||||
from .release import get_current_version
|
||||
|
||||
repos = ('frappe', 'erpnext')
|
||||
|
||||
def migrate_to_v5(bench='.'):
|
||||
.cli import restart_update
|
||||
validate_v4(bench=bench)
|
||||
for repo in repos:
|
||||
checkout_v5(repo, bench=bench)
|
||||
exec_cmd("{pip} --no-input uninstall -y shopping_cart".format(pip=os.path.join(bench, 'env', 'bin', 'pip')))
|
||||
exec_cmd("{frappe} --remove_from_installed_apps shopping_cart".format(frappe=get_frappe(bench=bench)))
|
||||
restart_update({
|
||||
'patch': True,
|
||||
'build': True,
|
||||
'requirements': True,
|
||||
'restart-supervisor': True
|
||||
})
|
||||
|
||||
|
||||
def validate_v4(bench='.'):
|
||||
for repo in repos:
|
||||
path = os.path.join(bench, 'apps', repo)
|
||||
current_version = get_current_version(path)
|
||||
if not current_version.startswith('4'):
|
||||
raise Exception("{} is not v4.x.x")
|
||||
|
||||
def checkout_v5(repo, bench='.'):
|
||||
cwd = os.path.join(bench, 'apps', repo)
|
||||
exec_cmd("git fetch upstream", cwd=cwd)
|
||||
exec_cmd("git checkout v5.0", cwd=cwd)
|
||||
|
Loading…
Reference in New Issue
Block a user