Skip to content

Commit

Permalink
Merge branch 'staging' into v5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Feb 7, 2024
2 parents 6829f14 + ba90700 commit 84b230d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
10 changes: 6 additions & 4 deletions bench/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def prune_app_directory(self):
remove_unused_node_modules(app_path)


def coerce_url_to_name_if_possible(git_url: str, cache_key:str) -> str:
def coerce_url_to_name_if_possible(git_url: str, cache_key: str) -> str:
app_name = os.path.basename(git_url)
if can_get_cached(app_name, cache_key):
return app_name
Expand All @@ -435,7 +435,7 @@ def can_get_cached(app_name: str, cache_key: str) -> bool:
Used before App is initialized if passed `git_url` is a
file URL as opposed to the app name.
If True then `git_url` can be coerced into the `app_name` and
If True then `git_url` can be coerced into the `app_name` and
checking local remote and fetching can be skipped while keeping
get-app command params the same.
"""
Expand Down Expand Up @@ -671,7 +671,7 @@ def get_app(
import bench.cli as bench_cli
from bench.bench import Bench
from bench.utils.app import check_existing_dir

if urlparse(git_url).scheme == "file" and cache_key:
git_url = coerce_url_to_name_if_possible(git_url, cache_key)

Expand Down Expand Up @@ -908,7 +908,9 @@ def install_app(
install_python_dev_dependencies(apps=app, bench_path=bench_path, verbose=verbose)

if not using_cached and os.path.exists(os.path.join(app_path, "package.json")):
yarn_install = "yarn install --verbose" if verbose else "yarn install"
yarn_install = "yarn install --check-files"
if verbose:
yarn_install += " --verbose"
bench.run(yarn_install, cwd=app_path)

bench.apps.sync(app_name=app, required=resolution, branch=tag, app_dir=app_path)
Expand Down
19 changes: 15 additions & 4 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
# imports - module imports
import bench
from bench.exceptions import PatchError, ValidationError
from bench.utils import (exec_cmd, get_bench_cache_path, get_bench_name,
get_cmd_output, log, which)
from bench.utils import (
exec_cmd,
get_bench_cache_path,
get_bench_name,
get_cmd_output,
log,
which,
)

logger = logging.getLogger(bench.PROJECT_NAME)

Expand Down Expand Up @@ -132,7 +138,9 @@ def update_yarn_packages(bench_path=".", apps=None, verbose=None):
app_path = os.path.join(apps_dir, app)
if os.path.exists(os.path.join(app_path, "package.json")):
click.secho(f"\nInstalling node dependencies for {app}", fg="yellow")
yarn_install = "yarn install --verbose" if verbose else "yarn install"
yarn_install = "yarn install --check-files"
if verbose:
yarn_install += " --verbose"
bench.run(yarn_install, cwd=app_path)


Expand Down Expand Up @@ -329,7 +337,10 @@ def restart_supervisor_processes(bench_path=".", web_workers=False, _raise=False
for group in groups:
failure = bench.run(f"{sudo}supervisorctl restart {group}", _raise=_raise)
if failure:
log(f"restarting supervisor group `{group}` failed. Use `bench restart` to retry.", level=3)
log(
f"restarting supervisor group `{group}` failed. Use `bench restart` to retry.",
level=3,
)


def restart_systemd_processes(bench_path=".", web_workers=False, _raise=True):
Expand Down

0 comments on commit 84b230d

Please sign in to comment.