Commit 50ebc3a5 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

add readme in go port

parent b6d0a610
Loading
Loading
Loading
Loading

go_port/LISEZMOI.md

0 → 100644
+84 −0
Original line number Diff line number Diff line
# Port Go de Climax

Ce dossier contient l'implémentation de `climax`, la CLI utilisée pour gérer les projets [MaX v2](https://www.certic.unicaen.fr/max-v2/).

## Qu'est-ce que Climax ?

`climax` est une CLI pour les developpeurs/operateurs de projets MaX. Elle permet de :

- créer et initialiser des projets MaX (`new`, `sync`, `demo`)
- lancer et arrêter la stack MaX/BaseX (`start`, `stop`, `basex`)
- inspecter la configuration (`info`, `projects`)
- gérer les bundles (`bundles-list`, `bundles-add`, `bundles-remove`)
- importer du contenu XML (`feed`)
- exporter une copie statique du site (`freeze`)
- inspecter les ressources de bundles (`templates-list`, `static-list`)

## Périmètre et notes

- Les donnees de registre des projets sont stockées dans `~/.climax/projects.json`.
- `templates-list` et `static-list` gardent volontairement une sortie texte simple.
- `info`, `projects` et les commandes de bundles utilisent des tableaux stylisés.

## Prérequis

- Go `1.25+` (voir [`go.mod`](./go.mod))
- Outils de packaging optionnels :
  - `pkgbuild` (cible installeur macOS)
  - `makensis` (cible installeur Windows)

## Démarrage (Développeur)

Depuis la racine du repository :

```bash
make test
make build
```

Cibles utiles :

- `make test` : execute les tests Go (y compris `main_test.go`)
- `make build` : construit des binaires multi-plateformes dans `dist`
- `make installer-macos` : construit un `.pkg` macOS non signe
- `make installer-windows` : construit un installeur Windows `.exe` (NSIS)
- `make help` : liste toutes les cibles du Makefile

## Execution locale

Exemple :

```bash
go run . --help
go run . info --directory /path/to/max-project
```

Conseil : utilisez `CLIMAX_HOME` pour isoler l'état local pendant le développement :

```bash
CLIMAX_HOME=/tmp/climax-dev-home go run . projects
```

## Organisation du code

- [`main.go`](./main.go) : definitions des commandes + implementation
- [`main_test.go`](./main_test.go) : tests unitaires/fonctionnels
- [`cli_commands_test.go`](./cli_commands_test.go) : tests des commandes/flags/help
- [`packaging/windows-installer.nsi`](./packaging/windows-installer.nsi) : script NSIS d'installeur
- [`Makefile`](./Makefile) : workflows de build, test et packaging

## Workflow des dépendances

Utilisez le workflow Go standard :

```bash
go mod tidy
go mod vendor
make test
```

Pour verifier les mises a jour :

```bash
go list -mod=mod -m -u all
```

go_port/README.md

0 → 100644
+85 −0
Original line number Diff line number Diff line
# Climax Go Port

This directory contains the implementation of `climax`, the CLI used to manage [MaX v2](https://www.certic.unicaen.fr/max-v2/) projects.

## What Climax Is

`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.

## Prerequisites

- Go `1.25+` (see [`go.mod`](./go.mod))
- Optional packagers:
  - `pkgbuild` (macOS installer target)
  - `makensis` (Windows installer 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
```