feat: configure public HTTPS installer URL for universal access

- Update install.sh to use public HTTPS git URL without requiring SSH credentials
- Update README.md with exact 1-line curl installer command for any developer
- Fix argument parsing for flags like --force

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 09:07:23 +07:00
parent 3e1314a3e1
commit 4da2d45af3
2 changed files with 35 additions and 25 deletions
+20 -5
View File
@@ -23,11 +23,11 @@ CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m'
# Remote Repository URL (Có thể override qua biến môi trường LARAVEL_TEST_REPO)
DEFAULT_REPO="ssh://git@ssh-git.smartgift.io.vn:2222/Smartgift-AI/agent-unit-testing.git"
# Remote Repository URL công khai qua HTTPS (ai cũng truy cập được không cần SSH key)
DEFAULT_REPO="https://git.smartgift.io.vn/Smartgift-AI/agent-unit-testing.git"
REPO_URL="${LARAVEL_TEST_REPO:-$DEFAULT_REPO}"
TARGET_DIR="${1:-.}"
TARGET_DIR=""
GLOBAL_MODE=false
FORCE_MODE=false
@@ -54,14 +54,19 @@ for arg in "$@"; do
echo -e " ${YELLOW}curl -fsSL <URL>/install.sh | bash -s -- . --force${NC}"
exit 0
;;
-*)
# Bỏ qua các flag khác
;;
*)
if [ "$arg" != "." ] && [ ! -d "$arg" ] && [ "$GLOBAL_MODE" = false ]; then
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR="$arg"
fi
;;
esac
done
TARGET_DIR="${TARGET_DIR:-.}"
echo -e "${BLUE}===================================================================${NC}"
echo -e "${CYAN}${BOLD} 🚀 SMARTGIFT AI - LARAVEL UNIT TESTING TOOLKIT INSTALLER${NC}"
echo -e "${BLUE}===================================================================${NC}"
@@ -82,7 +87,17 @@ if [ -n "$SCRIPT_DIR" ] && [ -d "$SCRIPT_DIR/.claude/skills" ]; then
else
echo -e "${YELLOW}📥 Đang tải bộ công cụ từ remote repository...${NC}"
TMP_DIR="$(mktemp -d 2>/dev/null || mktemp -d -t 'sg_unit_testing')"
git clone --depth 1 "$REPO_URL" "$TMP_DIR" --quiet
# Thử clone qua git
if ! git clone --depth 1 "$REPO_URL" "$TMP_DIR" --quiet 2>/dev/null; then
echo -e "${RED}❌ Không thể clone từ repository: $REPO_URL${NC}"
echo -e "${YELLOW}💡 Lưu ý dành cho người dùng bên ngoài:${NC}"
echo -e " Nếu bạn không phải thành viên có SSH key nội bộ, hãy chạy với URL HTTPS công khai:"
echo -e " ${CYAN}LARAVEL_TEST_REPO=https://github.com/<OWNER>/<REPO>.git curl -fsSL <URL>/install.sh | bash${NC}"
rm -rf "$TMP_DIR"
exit 1
fi
PACKAGE_ROOT="$TMP_DIR"
CLEANUP_TEMP=true
echo -e "${GREEN}✓ Tải thành công!${NC}"