Queer European MD passionate about IT
Browse Source

Script to update image-editor submodule and copy its `src` to `static`

Davte 5 years ago
parent
commit
8fcbd5c73d
2 changed files with 14 additions and 3 deletions
  1. 3 3
      dynamic/app.py
  2. 11 0
      update_image_editor.sh

+ 3 - 3
dynamic/app.py

@@ -87,8 +87,8 @@ async def pull_image_editor_project(request):
     """Git pull at request."""
     """Git pull at request."""
     try:
     try:
         _subprocess = await asyncio.create_subprocess_shell(
         _subprocess = await asyncio.create_subprocess_shell(
-            'bash {path}/pull_image_editor.sh'.format(
-                path=path
+            'bash {path}/update_image_editor.sh'.format(
+                path=os.path.dirname(path)
             )
             )
         )
         )
         stdout, stderr = await _subprocess.communicate()
         stdout, stderr = await _subprocess.communicate()
@@ -103,7 +103,7 @@ async def pull_image_editor_project(request):
     return web.Response(
     return web.Response(
         status=302,
         status=302,
         headers={
         headers={
-            'location': 'https://www.davte.it/michele/image-editor/src/',
+            'location': 'https://michele.davte.it/image-editor/',
         },
         },
     )
     )
 
 

+ 11 - 0
update_image_editor.sh

@@ -0,0 +1,11 @@
+# Get current directory
+this_script_directory=$(cd `dirname $0` && pwd);
+
+# Update git submodules merging remote version into local one
+git submodule update --remote --merge;
+
+# Delete the outdated folder
+rm -r $this_script_directory/static/image-editor;
+
+# Copy the updated folder
+cp -r $this_script_directory/image-editor/src $this_script_directory/static/image-editor;