diff --git a/resources/tilt/Tiltfile.mysql b/resources/tilt/Tiltfile.mysql index 7d89de0..eba8f97 100644 --- a/resources/tilt/Tiltfile.mysql +++ b/resources/tilt/Tiltfile.mysql @@ -130,3 +130,6 @@ local_resource( ), ), ) + +def on_down(): + local("docker container stop %s" % db_container_name) \ No newline at end of file diff --git a/scripts/ext/create.py b/scripts/ext/create.py index 03c047d..60224c9 100755 --- a/scripts/ext/create.py +++ b/scripts/ext/create.py @@ -49,28 +49,26 @@ def copy_partial(src, dst): return shutil.copy2(src, dst) -is_partial = template_path.startswith(resources_base_path + "partial/") - -if is_partial: +if template_path.startswith(resources_base_path + "partial/"): shutil.copytree( template_path + "/overwrite", project_path, - copy_function=copy_partial if is_partial else shutil.copy2, - dirs_exist_ok=True if is_partial else False, + copy_function=copy_partial, + dirs_exist_ok=True, ) shutil.copytree( template_path + "/append", project_path, - copy_function=copy_partial if is_partial else shutil.copy2, - dirs_exist_ok=True if is_partial else False, + copy_function=copy_partial, + dirs_exist_ok=True, ) else: shutil.copytree( template_path, project_path, - copy_function=copy_partial if is_partial else shutil.copy2, - dirs_exist_ok=True if is_partial else False, + copy_function=shutil.copy2, + dirs_exist_ok=False, ) for root, dirs, files in os.walk(project_path): diff --git a/tilt/Tiltfile b/tilt/Tiltfile index 3638486..538baaa 100644 --- a/tilt/Tiltfile +++ b/tilt/Tiltfile @@ -95,7 +95,7 @@ def process_extension( def workspace_search(pattern): find_args = [ "find /workspace/client-extensions", - "-name %s" % pattern, + "-name '%s'" % pattern, "-not -path '*/build/*'", "-not -path '*/node_modules/*'", "-not -path '*/node_modules_cache/*'", @@ -148,6 +148,11 @@ if config.tilt_subcommand == "down": local("kubectl delete cm -l lxc.liferay.com/metadataType=ext-init") local("%s/scripts/dxp-stop.sh" % repo) + # check user tiltfiles for a "extension_stop()" hook + for user_tiltfile in user_tiltfiles: + if user_tiltfile.get("on_down"): + user_tiltfile["on_down"]() + # build and launch dxp dxp_buildargs_val = ""