Loading go_port/AGENTS.md→AGENTS.md +0 −0 File moved. View file go_port/LISEZMOI.md→LISEZMOI.md +0 −0 File moved. View file Makefile +82 −59 Original line number Diff line number Diff line install: ## Installation en développement, à n'exécuter qu'une fois uv sync uv run pre-commit install .PHONY:install locales: ## générer les fichiers de traductions msgfmt -o src/climax/locales/fr/LC_MESSAGES/messages.mo src/climax/locales/fr/LC_MESSAGES/messages.po msgfmt -o src/climax/locales/en/LC_MESSAGES/messages.mo src/climax/locales/en/LC_MESSAGES/messages.po .PHONY:locales clean: rm -rf dist rm -rf build .PHONY:clean build:locales ## construire les paquets pour pypi rm -rf dist rm -rf build uv build .PHONY:build publish:build ## distribuer le paquet sur pypi uv publish .PHONY:publish macos:locales ## construire le paquet pour MacOS rm -rf dist rm -rf build uv run pyinstaller src/climax.py --strip --noconfirm --collect-submodules shellingham --collect-submodules urllib mkdir dist/climax/_internal/climax mkdir dist/climax/_internal/climax/locales cp -r src/climax/locales/* dist/climax/_internal/climax/locales/ cp src/climax/max_releases.json dist/climax/_internal/climax/max_releases.json cp src/env dist/climax/env tar -cvzf dist/climax-macos_arm.tar.gz -C dist/climax . .PHONY:macos macosdistro:macos ## distribuer la version pour macos scp dist/climax-macos_arm.tar.gz climaxdistro:/var/www/climax/climax-macos_arm.tar.gz .PHONY:macosdistro macosinstall:macos ## installer le paquet macos localement mkdir -p "${HOME}/.climax/" cp -r dist/climax/* "${HOME}/.climax/" .PHONY:macosinstall format: ## Formatage des sources avec uv uv run ruff check --fix ./src/ uv run ruff format ./src/ .PHONY: format tests: ## Lancer les tests uv run python tests.py .PHONY: tests help: ## afficher l'aide @echo "\nChoisissez une commande. Les choix sont:\n" @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-12s\033[m %s\n", $$1, $$2}' APP_NAME := climax DIST_DIR := dist VERSION ?= $(shell sed -nE 's/^const version = "([^"]+)"/\1/p' main.go | head -n1) GO_LDFLAGS := -s -w -buildid= GO_FLAGS := -trimpath -ldflags '$(GO_LDFLAGS)' PKG_IDENTIFIER ?= fr.unicaen.climax MACOS_EXE := $(DIST_DIR)/$(APP_NAME)-darwin-arm64 MACOS_INSTALLER := $(DIST_DIR)/$(APP_NAME)-macos-arm64-unsigned-v$(VERSION).pkg WINDOWS_EXE := $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe WINDOWS_INSTALLER := $(DIST_DIR)/$(APP_NAME)-windows-amd64-setup-v$(VERSION).exe DEB_PACKAGE := $(DIST_DIR)/$(APP_NAME)_$(VERSION)_amd64.deb NSIS_SCRIPT := packaging/windows-installer.nsi SCP_DEST := climaxdistro:/var/www/climax/ RELEASE_ARTIFACTS := \ $(DIST_DIR)/$(APP_NAME)-linux-amd64 \ $(DIST_DIR)/$(APP_NAME)-darwin-arm64 \ $(WINDOWS_EXE) \ $(MACOS_INSTALLER) \ $(WINDOWS_INSTALLER) \ $(DEB_PACKAGE) \ server_install_scripts/linux_amd64_install.sh \ server_install_scripts/macos_arm64_install.sh \ server_install_scripts/env .PHONY: build test installer-macos installer-windows installer-deb release-upload clean help build: ## Build cross-platform binaries into dist (linux/amd64, darwin/arm64, windows/amd64) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-linux-amd64 . CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-darwin-arm64 . CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o $(WINDOWS_EXE) . test: ## Run Go tests (including main_test.go explicitly) go test -mod=vendor ./... go test -mod=vendor main.go i18n.go main_test.go installer-macos: ## Build an unsigned macOS pkg installer (.pkg) for arm64 using pkgbuild mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o $(MACOS_EXE) . @command -v pkgbuild >/dev/null 2>&1 || { echo "pkgbuild not found. Install Xcode Command Line Tools."; exit 1; } @TMP_DIR=$$(mktemp -d); \ trap 'rm -rf "$$TMP_DIR"' EXIT; \ mkdir -p "$$TMP_DIR/usr/local/bin"; \ cp "$(MACOS_EXE)" "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ chmod 0755 "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ pkgbuild --root "$$TMP_DIR" \ --identifier "$(PKG_IDENTIFIER)" \ --version "$(VERSION)" \ --install-location "/" \ "$(MACOS_INSTALLER)"; \ echo "Created $(MACOS_INSTALLER)" installer-windows: ## Build a Windows installer (.exe) with NSIS (requires makensis) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o $(WINDOWS_EXE) . @command -v makensis >/dev/null 2>&1 || { echo "makensis not found. Install NSIS first (e.g. brew install nsis)."; exit 1; } makensis -DAPP_NAME="$(APP_NAME)" -DAPP_VERSION="$(VERSION)" -DAPP_EXE_PATH="$(abspath $(WINDOWS_EXE))" -DOUT_PATH="$(abspath $(WINDOWS_INSTALLER))" $(NSIS_SCRIPT) @echo "Created $(WINDOWS_INSTALLER)" installer-deb: ## Build a Debian package (.deb) for linux/amd64 (requires dpkg-deb) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-linux-amd64 . @command -v dpkg-deb >/dev/null 2>&1 || { echo "dpkg-deb not found. Install dpkg tooling first."; exit 1; } @TMP_DIR=$$(mktemp -d); \ trap 'rm -rf "$$TMP_DIR"' EXIT; \ mkdir -p "$$TMP_DIR/DEBIAN" "$$TMP_DIR/usr/local/bin"; \ cp "$(DIST_DIR)/$(APP_NAME)-linux-amd64" "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ chmod 0755 "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ printf "Package: $(APP_NAME)\nVersion: $(VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: Climax Maintainers\nDescription: Climax CLI for MaX projects\n" > "$$TMP_DIR/DEBIAN/control"; \ dpkg-deb --build "$$TMP_DIR" "$(DEB_PACKAGE)"; \ echo "Created $(DEB_PACKAGE)" release-upload: build installer-macos installer-windows installer-deb ## Build all binaries/installers and upload them via scp scp $(RELEASE_ARTIFACTS) $(SCP_DEST) clean: ## Remove build artifacts rm -rf $(DIST_DIR) help: ## Show available Makefile commands @echo "\nAvailable commands:\n" @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-12s\033[m %s\n", $$1, $$2}' @echo "" .PHONY: help README.md +83 −5 Original line number Diff line number Diff line # CLIMAX # Climax Climax est un utilitaire en ligne de commande pour la gestion des projets [MaX v2](https://www.certic.unicaen.fr/max-v2/). This directory contains the implementation of `climax`, the CLI used to manage [MaX v2](https://www.certic.unicaen.fr/max-v2/) projects. Pour la documentation utilisateur, voir https://www.certic.unicaen.fr/max-v2/climax/ ## What Climax Is Pour les développeurs, voir le [Makefile](https://git.unicaen.fr/pdn-certic/climax/-/blob/main/Makefile?ref_type=heads) (pré-requis: [uv](https://docs.astral.sh/uv/) et [gettext](https://www.gnu.org/software/gettext/) / msgfmt). No newline at end of file `climax` is a developer/operator CLI for MaX projects. It helps you: - create and initialize MaX projects (`new`, `sync`, `demo`) - run and stop the MaX/BaseX stack (`start`, `stop`, `basex`) - inspect configuration (`info`, `projects`) - manage bundles (`bundles-list`, `bundles-add`, `bundles-remove`) - feed XML content (`feed`) - export a static site snapshot (`freeze`) - inspect bundle assets (`templates-list`, `static-list`) ## Scope and Notes - Project registry data is stored in `~/.climax/projects.json`. - `templates-list` and `static-list` intentionally keep plain output. - `info`, `projects`, and bundle commands use styled table output. ## Development prerequisites - Go `1.25+` (see [`go.mod`](./go.mod)) - Optional packagers: - `pkgbuild` (macOS installer target) - `makensis` (Windows installer target) - `dpkg-deb` (Debian package target) ## Getting Started (Developer) From repository root: ```bash make test make build ``` Useful targets: - `make test`: runs Go tests (including `main_test.go`) - `make build`: cross-builds binaries into `dist` - `make installer-macos`: builds an unsigned macOS `.pkg` - `make installer-windows`: builds a Windows `.exe` installer (NSIS) - `make help`: lists all Makefile targets ## Local Run Example: ```bash go run . --help go run . info --directory /path/to/max-project ``` Tip: use `CLIMAX_HOME` to isolate local state while developing: ```bash CLIMAX_HOME=/tmp/climax-dev-home go run . projects ``` ## Code Layout - [`main.go`](./main.go): command definitions + implementation - [`main_test.go`](./main_test.go): functional unit tests - [`cli_commands_test.go`](./cli_commands_test.go): command wiring/flags/help tests - [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi): NSIS installer script - [`Makefile`](./Makefile): build, test, and packaging workflows ## Dependency Workflow Use the standard Go workflow: ```bash go mod tidy go mod vendor make test ``` For update checks: ```bash go list -mod=mod -m -u all ``` go_port/cli_commands_test.go→cli_commands_test.go +0 −0 File moved. View file Loading
Makefile +82 −59 Original line number Diff line number Diff line install: ## Installation en développement, à n'exécuter qu'une fois uv sync uv run pre-commit install .PHONY:install locales: ## générer les fichiers de traductions msgfmt -o src/climax/locales/fr/LC_MESSAGES/messages.mo src/climax/locales/fr/LC_MESSAGES/messages.po msgfmt -o src/climax/locales/en/LC_MESSAGES/messages.mo src/climax/locales/en/LC_MESSAGES/messages.po .PHONY:locales clean: rm -rf dist rm -rf build .PHONY:clean build:locales ## construire les paquets pour pypi rm -rf dist rm -rf build uv build .PHONY:build publish:build ## distribuer le paquet sur pypi uv publish .PHONY:publish macos:locales ## construire le paquet pour MacOS rm -rf dist rm -rf build uv run pyinstaller src/climax.py --strip --noconfirm --collect-submodules shellingham --collect-submodules urllib mkdir dist/climax/_internal/climax mkdir dist/climax/_internal/climax/locales cp -r src/climax/locales/* dist/climax/_internal/climax/locales/ cp src/climax/max_releases.json dist/climax/_internal/climax/max_releases.json cp src/env dist/climax/env tar -cvzf dist/climax-macos_arm.tar.gz -C dist/climax . .PHONY:macos macosdistro:macos ## distribuer la version pour macos scp dist/climax-macos_arm.tar.gz climaxdistro:/var/www/climax/climax-macos_arm.tar.gz .PHONY:macosdistro macosinstall:macos ## installer le paquet macos localement mkdir -p "${HOME}/.climax/" cp -r dist/climax/* "${HOME}/.climax/" .PHONY:macosinstall format: ## Formatage des sources avec uv uv run ruff check --fix ./src/ uv run ruff format ./src/ .PHONY: format tests: ## Lancer les tests uv run python tests.py .PHONY: tests help: ## afficher l'aide @echo "\nChoisissez une commande. Les choix sont:\n" @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-12s\033[m %s\n", $$1, $$2}' APP_NAME := climax DIST_DIR := dist VERSION ?= $(shell sed -nE 's/^const version = "([^"]+)"/\1/p' main.go | head -n1) GO_LDFLAGS := -s -w -buildid= GO_FLAGS := -trimpath -ldflags '$(GO_LDFLAGS)' PKG_IDENTIFIER ?= fr.unicaen.climax MACOS_EXE := $(DIST_DIR)/$(APP_NAME)-darwin-arm64 MACOS_INSTALLER := $(DIST_DIR)/$(APP_NAME)-macos-arm64-unsigned-v$(VERSION).pkg WINDOWS_EXE := $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe WINDOWS_INSTALLER := $(DIST_DIR)/$(APP_NAME)-windows-amd64-setup-v$(VERSION).exe DEB_PACKAGE := $(DIST_DIR)/$(APP_NAME)_$(VERSION)_amd64.deb NSIS_SCRIPT := packaging/windows-installer.nsi SCP_DEST := climaxdistro:/var/www/climax/ RELEASE_ARTIFACTS := \ $(DIST_DIR)/$(APP_NAME)-linux-amd64 \ $(DIST_DIR)/$(APP_NAME)-darwin-arm64 \ $(WINDOWS_EXE) \ $(MACOS_INSTALLER) \ $(WINDOWS_INSTALLER) \ $(DEB_PACKAGE) \ server_install_scripts/linux_amd64_install.sh \ server_install_scripts/macos_arm64_install.sh \ server_install_scripts/env .PHONY: build test installer-macos installer-windows installer-deb release-upload clean help build: ## Build cross-platform binaries into dist (linux/amd64, darwin/arm64, windows/amd64) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-linux-amd64 . CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-darwin-arm64 . CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o $(WINDOWS_EXE) . test: ## Run Go tests (including main_test.go explicitly) go test -mod=vendor ./... go test -mod=vendor main.go i18n.go main_test.go installer-macos: ## Build an unsigned macOS pkg installer (.pkg) for arm64 using pkgbuild mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(GO_FLAGS) -o $(MACOS_EXE) . @command -v pkgbuild >/dev/null 2>&1 || { echo "pkgbuild not found. Install Xcode Command Line Tools."; exit 1; } @TMP_DIR=$$(mktemp -d); \ trap 'rm -rf "$$TMP_DIR"' EXIT; \ mkdir -p "$$TMP_DIR/usr/local/bin"; \ cp "$(MACOS_EXE)" "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ chmod 0755 "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ pkgbuild --root "$$TMP_DIR" \ --identifier "$(PKG_IDENTIFIER)" \ --version "$(VERSION)" \ --install-location "/" \ "$(MACOS_INSTALLER)"; \ echo "Created $(MACOS_INSTALLER)" installer-windows: ## Build a Windows installer (.exe) with NSIS (requires makensis) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(GO_FLAGS) -o $(WINDOWS_EXE) . @command -v makensis >/dev/null 2>&1 || { echo "makensis not found. Install NSIS first (e.g. brew install nsis)."; exit 1; } makensis -DAPP_NAME="$(APP_NAME)" -DAPP_VERSION="$(VERSION)" -DAPP_EXE_PATH="$(abspath $(WINDOWS_EXE))" -DOUT_PATH="$(abspath $(WINDOWS_INSTALLER))" $(NSIS_SCRIPT) @echo "Created $(WINDOWS_INSTALLER)" installer-deb: ## Build a Debian package (.deb) for linux/amd64 (requires dpkg-deb) mkdir -p $(DIST_DIR) CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(GO_FLAGS) -o $(DIST_DIR)/$(APP_NAME)-linux-amd64 . @command -v dpkg-deb >/dev/null 2>&1 || { echo "dpkg-deb not found. Install dpkg tooling first."; exit 1; } @TMP_DIR=$$(mktemp -d); \ trap 'rm -rf "$$TMP_DIR"' EXIT; \ mkdir -p "$$TMP_DIR/DEBIAN" "$$TMP_DIR/usr/local/bin"; \ cp "$(DIST_DIR)/$(APP_NAME)-linux-amd64" "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ chmod 0755 "$$TMP_DIR/usr/local/bin/$(APP_NAME)"; \ printf "Package: $(APP_NAME)\nVersion: $(VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: Climax Maintainers\nDescription: Climax CLI for MaX projects\n" > "$$TMP_DIR/DEBIAN/control"; \ dpkg-deb --build "$$TMP_DIR" "$(DEB_PACKAGE)"; \ echo "Created $(DEB_PACKAGE)" release-upload: build installer-macos installer-windows installer-deb ## Build all binaries/installers and upload them via scp scp $(RELEASE_ARTIFACTS) $(SCP_DEST) clean: ## Remove build artifacts rm -rf $(DIST_DIR) help: ## Show available Makefile commands @echo "\nAvailable commands:\n" @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-12s\033[m %s\n", $$1, $$2}' @echo "" .PHONY: help
README.md +83 −5 Original line number Diff line number Diff line # CLIMAX # Climax Climax est un utilitaire en ligne de commande pour la gestion des projets [MaX v2](https://www.certic.unicaen.fr/max-v2/). This directory contains the implementation of `climax`, the CLI used to manage [MaX v2](https://www.certic.unicaen.fr/max-v2/) projects. Pour la documentation utilisateur, voir https://www.certic.unicaen.fr/max-v2/climax/ ## What Climax Is Pour les développeurs, voir le [Makefile](https://git.unicaen.fr/pdn-certic/climax/-/blob/main/Makefile?ref_type=heads) (pré-requis: [uv](https://docs.astral.sh/uv/) et [gettext](https://www.gnu.org/software/gettext/) / msgfmt). No newline at end of file `climax` is a developer/operator CLI for MaX projects. It helps you: - create and initialize MaX projects (`new`, `sync`, `demo`) - run and stop the MaX/BaseX stack (`start`, `stop`, `basex`) - inspect configuration (`info`, `projects`) - manage bundles (`bundles-list`, `bundles-add`, `bundles-remove`) - feed XML content (`feed`) - export a static site snapshot (`freeze`) - inspect bundle assets (`templates-list`, `static-list`) ## Scope and Notes - Project registry data is stored in `~/.climax/projects.json`. - `templates-list` and `static-list` intentionally keep plain output. - `info`, `projects`, and bundle commands use styled table output. ## Development prerequisites - Go `1.25+` (see [`go.mod`](./go.mod)) - Optional packagers: - `pkgbuild` (macOS installer target) - `makensis` (Windows installer target) - `dpkg-deb` (Debian package target) ## Getting Started (Developer) From repository root: ```bash make test make build ``` Useful targets: - `make test`: runs Go tests (including `main_test.go`) - `make build`: cross-builds binaries into `dist` - `make installer-macos`: builds an unsigned macOS `.pkg` - `make installer-windows`: builds a Windows `.exe` installer (NSIS) - `make help`: lists all Makefile targets ## Local Run Example: ```bash go run . --help go run . info --directory /path/to/max-project ``` Tip: use `CLIMAX_HOME` to isolate local state while developing: ```bash CLIMAX_HOME=/tmp/climax-dev-home go run . projects ``` ## Code Layout - [`main.go`](./main.go): command definitions + implementation - [`main_test.go`](./main_test.go): functional unit tests - [`cli_commands_test.go`](./cli_commands_test.go): command wiring/flags/help tests - [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi): NSIS installer script - [`Makefile`](./Makefile): build, test, and packaging workflows ## Dependency Workflow Use the standard Go workflow: ```bash go mod tidy go mod vendor make test ``` For update checks: ```bash go list -mod=mod -m -u all ```