Add install script for clone-first one-click deployment.
Prompt for repo URL and install directory, auto git clone, then run project setup. Keep deploy.py for in-repo updates only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+16
-7
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""LocalNav 一键部署:环境检测、生成 .env、安装依赖。"""
|
||||
"""LocalNav 项目内部署:环境检测、生成 .env、安装依赖(需已在项目目录内)。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -62,11 +62,14 @@ def check_pip(py_exe: str) -> None:
|
||||
|
||||
|
||||
def optional_tools() -> None:
|
||||
for name in ("git", "pm2"):
|
||||
if shutil.which(name):
|
||||
_ok(f"可选工具 {name} 已安装")
|
||||
else:
|
||||
_warn(f"未检测到 {name}(可选)")
|
||||
if shutil.which("git"):
|
||||
_ok("可选工具 git 已安装")
|
||||
else:
|
||||
_warn("未检测到 git(可选,首次安装请用 scripts/install.py)")
|
||||
if shutil.which("pm2"):
|
||||
_ok("可选工具 pm2 已安装")
|
||||
else:
|
||||
_warn("未检测到 pm2(可选)")
|
||||
|
||||
|
||||
def read_env_lines(path: Path) -> list[str]:
|
||||
@@ -199,7 +202,13 @@ def print_summary() -> None:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
print(f"LocalNav 一键部署 · {platform.system()} {platform.release()}")
|
||||
if not (ROOT / "app.py").is_file():
|
||||
_fail(
|
||||
"请在 LocalNav 项目目录内运行,或使用 scripts/install.py 自动克隆安装:\n"
|
||||
" python scripts/install.py"
|
||||
)
|
||||
|
||||
print(f"LocalNav 项目部署 · {platform.system()} {platform.release()}")
|
||||
print(f"项目目录: {ROOT}")
|
||||
print()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user