made changes to update feature

This commit is contained in:
Barunes Padhy 2024-06-21 20:33:34 +03:00
parent b8137d2cb8
commit 841345f15b
2 changed files with 26 additions and 15 deletions

View File

@ -26,15 +26,21 @@ def update_rangolio(rangolio_location):
# Update server
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/server',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server.old')
run_npm_command('npm_run', f'{rangolio_location}/frontend/viewable-ui', ['build:server'])
git_update_viewable_ui(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server', 'server.old')
git_update_viewable_ui(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server.old', 'server', False)
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/server.old',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server')
# Update ghpages
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/ghpages',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages.old')
run_npm_command('npm_run', f'{rangolio_location}/frontend/viewable-ui', ['build:ghpages'])
git_update_viewable_ui(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages', 'ghpages.old')
git_update_viewable_ui(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages.old', 'ghpages', False)
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/ghpages.old',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages')
# Update editor-ui
run_npm_command('npm_run', f'{rangolio_location}/frontend/editable-ui', ['build'])

View File

@ -72,23 +72,28 @@ def git_check_user_details(deploy_location):
return True
def git_update_viewable_ui(deploy_location, dist_folder_name):
def git_update_viewable_ui(deploy_location, dist_folder_name, copy_index_and_asset=True):
# deploy_location = server.old ; dist_folder_name = server
# server.old -> server.old.temp
shutil.move(deploy_location, f'{deploy_location}.temp')
# server -> server.old
shutil.move(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/{dist_folder_name}', f'{deploy_location}')
copy_content(
f'{deploy_location}.temp/index.html',
deploy_location,
'file',
'remove_and_copy'
)
copy_content(
f'{deploy_location}.temp/assets',
f'{deploy_location}/assets',
'folder',
'remove_and_copy'
)
if copy_index_and_asset:
copy_content(
f'{deploy_location}.temp/index.html',
deploy_location,
'file',
'remove_and_copy'
)
copy_content(
f'{deploy_location}.temp/assets',
f'{deploy_location}/assets',
'folder',
'remove_and_copy'
)
copy_content(
f'{deploy_location}.temp/data',
f'{deploy_location}/data',