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 # Update server
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/server', shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/server',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server.old') f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/server.old')
run_npm_command('npm_run', f'{rangolio_location}/frontend/viewable-ui', ['build:server']) 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 # Update ghpages
shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/ghpages', shutil.move(settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]+'/ghpages',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages.old') f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/ghpages.old')
run_npm_command('npm_run', f'{rangolio_location}/frontend/viewable-ui', ['build:ghpages']) 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 # Update editor-ui
run_npm_command('npm_run', f'{rangolio_location}/frontend/editable-ui', ['build']) 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 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') 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}') shutil.move(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/{dist_folder_name}', f'{deploy_location}')
copy_content( if copy_index_and_asset:
f'{deploy_location}.temp/index.html', copy_content(
deploy_location, f'{deploy_location}.temp/index.html',
'file', deploy_location,
'remove_and_copy' 'file',
) 'remove_and_copy'
copy_content( )
f'{deploy_location}.temp/assets', copy_content(
f'{deploy_location}/assets', f'{deploy_location}.temp/assets',
'folder', f'{deploy_location}/assets',
'remove_and_copy' 'folder',
) 'remove_and_copy'
)
copy_content( copy_content(
f'{deploy_location}.temp/data', f'{deploy_location}.temp/data',
f'{deploy_location}/data', f'{deploy_location}/data',