Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
njavilas2015 committed Nov 11, 2024
1 parent 4a5f41d commit fbea0aa
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/commit-msg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running commit-msg.sh hook..."
2 changes: 2 additions & 0 deletions .devcontainer/post-checkout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running post-checkout.sh hook..."
2 changes: 2 additions & 0 deletions .devcontainer/post-merge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running post-merge.sh hook..."
2 changes: 2 additions & 0 deletions .devcontainer/post-rebase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running post-rebase.sh hook..."
2 changes: 2 additions & 0 deletions .devcontainer/post-rewrite.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running post-rewrite.sh hook..."
2 changes: 2 additions & 0 deletions .devcontainer/pre-rebase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "🔄 Running pre-rebase.sh hook..."
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

## Instalación

Para instalar `gohtpasswd`, puedes descargar el binario desde el siguiente enlace:
Para instalar `githooks`, puedes descargar el binario desde el siguiente enlace:

- [Descargar gohtpasswd](https://github.com/njavilas2015/gohtpasswd/releases/download/1.0.1/gohtpasswd)
- [Descargar githooks](https://github.com/njavilas2015/githooks/releases/download/1.0.1/githooks)

```bash
curl -s https://api.github.com/repos/njavilas2015/gohtpasswd/releases/latest | jq -r .assets[0].browser_download_url | wget -i -
curl -s https://api.github.com/repos/njavilas2015/githooks/releases/latest | jq -r .assets[0].browser_download_url | wget -i -
```


Después de descargar, asegúrate de que el binario sea ejecutable y mueve el archivo a un directorio en tu `PATH`:

```bash
chmod +x gohtpasswd
sudo mv gohtpasswd /usr/local/bin/
chmod +x githooks
sudo mv githooks /usr/local/bin/
```

## Uso
Para usar `gohtpasswd`, puedes ejecutar el siguiente comando en la terminal:
Para usar `githooks`, puedes ejecutar el siguiente comando en la terminal:

```bash
gohtpasswd --username njavilas --password holaconfig --print
githooks path/script
```

## Hooks del Lado del Cliente
Expand All @@ -47,6 +47,10 @@ pre-applypatch: Se ejecuta antes de aplicar un parche, útil para ejecutar prueb
- [] **pre-auto-gc**: Se ejecuta antes de que Git realice una recolección de basura automática, útil para limpiar o preparar datos.
- [x] **post-rewrite**: Se ejecuta después de comandos que reescriben el historial (como git commit --amend y git rebase), permite realizar acciones en los commits reescritos.

## Build

go build -o githooks

## Contacto
Si tienes alguna pregunta o necesitas soporte, no dudes en contactarme:

Expand Down
11 changes: 11 additions & 0 deletions hooks_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"pre-commit": "#!/bin/bash\necho \"🔄 Running pre-commit hook...\"\n# Formatea el código Go\ngo fmt .\n# Verifica estilo de código\ngolint .\n# Realiza chequeos estáticos en el código\ngo vet .\n# Ejecuta las pruebas\ngo test .",
"post-commit": "#!/bin/bash\necho \"🔄 Running post-commit hook...\"",
"commit-msg": "",
"pre-rebase": "",
"post-rebase": "",
"post-checkout": "",
"post-merge": "",
"post-rewrite": "",
"pre-push": "#!/bin/bash\necho \"🔄 Running pre-push hook...\"\n# Verifica si el código está correctamente formateado\ngo fmt ./...\n# Realiza chequeos estáticos en el código\ngolint ./...\n# Realiza análisis estático de posibles errores\ngo vet ./...\n# Ejecuta las pruebas\ngo test ./...\nif [ $? -ne 0 ]; then\n echo \"❌ Las pruebas fallaron. Por favor, revisa los errores antes de hacer push.\"\n exit 1\nfi"
}

0 comments on commit fbea0aa

Please sign in to comment.