Spaces:
Runtime error
Runtime error
Greg
Claude Opus 4.7 (1M context)
Preparar despliegue en fly.io: monolito dockerizado + seeder demo
6aa6081 Download init.sh from Talosware/talos-access: direct link, hf CLI and curl.
- Browser
- Download file 3.18 kB
-
https://huggingface.co/spaces/Talosware/talos-access/resolve/main/init.sh
- Command line
-
hf download hf://spaces/Talosware/talos-access/init.sh
-
curl -L -o init.sh https://huggingface.co/spaces/Talosware/talos-access/resolve/main/init.sh
3.18 kB
| set -euo pipefail | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| detect_os() { | |
| case "$(uname -s)" in | |
| MINGW*|MSYS*|CYGWIN*) echo "windows" ;; | |
| Darwin|Linux|*BSD*) echo "unix" ;; | |
| *) echo "unix" ;; | |
| esac | |
| } | |
| OS=$(detect_os) | |
| echo "============================================" | |
| echo " Talos Access — init.sh" | |
| echo " OS: $OS" | |
| echo "============================================" | |
| check_dep() { | |
| local dep="$1" | |
| if ! command -v "$dep" &> /dev/null 2>&1; then | |
| echo "ERROR: Required dependency '$dep' is not installed or not in PATH." | |
| return 1 | |
| fi | |
| } | |
| validate_deps() { | |
| local failed=0 | |
| echo "[init.sh] Validating dependencies..." | |
| PYTHON="" | |
| for candidate in python3 python; do | |
| if command -v "$candidate" &> /dev/null && "$candidate" --version &> /dev/null; then | |
| PYTHON="$candidate" | |
| break | |
| fi | |
| done | |
| if [ -z "$PYTHON" ]; then | |
| echo "ERROR: A working Python runtime is required." | |
| failed=1 | |
| fi | |
| check_dep node || failed=1 | |
| check_dep docker || failed=1 | |
| if [ "$failed" -ne 0 ]; then | |
| echo "[init.sh] Dependency validation FAILED." | |
| return 1 | |
| fi | |
| echo " Python: $($PYTHON --version 2>&1)" | |
| echo " Node: $(node --version 2>&1)" | |
| echo " Docker: $(docker --version 2>&1)" | |
| echo "[init.sh] All dependencies OK." | |
| return 0 | |
| } | |
| run_tests() { | |
| local tests_dir="$SCRIPT_DIR/tests" | |
| local overall_exit=0 | |
| if [ ! -d "$tests_dir" ]; then | |
| echo "[init.sh] WARNING: tests/ directory not found at $tests_dir" | |
| return 0 | |
| fi | |
| echo "[init.sh] Running test suites..." | |
| if [ -n "$PYTHON" ]; then | |
| if "$PYTHON" -m pytest --version &> /dev/null; then | |
| echo "[init.sh] Running pytest..." | |
| "$PYTHON" -m pytest "$tests_dir" -v --tb=short || overall_exit=$? | |
| else | |
| echo "[init.sh] Running Python test scripts (pytest not available)..." | |
| for test_file in "$tests_dir"/*.py; do | |
| if [ -f "$test_file" ]; then | |
| echo " Running: $(basename "$test_file")" | |
| "$PYTHON" "$test_file" || overall_exit=$? | |
| fi | |
| done | |
| fi | |
| fi | |
| for test_script in "$tests_dir"/*.sh; do | |
| if [ -f "$test_script" ] && [ "$(basename "$test_script")" != "init.sh" ]; then | |
| echo " Running: $(basename "$test_script")" | |
| bash "$test_script" || overall_exit=$? | |
| fi | |
| done | |
| if [ "$overall_exit" -eq 0 ]; then | |
| echo "[init.sh] All tests PASSED." | |
| else | |
| echo "[init.sh] Some tests FAILED (exit code: $overall_exit)." | |
| fi | |
| return $overall_exit | |
| } | |
| validate_deps || exit 1 | |
| run_tests | |
| exit_code=$? | |
| if [ "$exit_code" -eq 0 ]; then | |
| echo "============================================" | |
| echo " STATUS: ALL TESTS GREEN (exit 0)" | |
| echo "============================================" | |
| else | |
| echo "============================================" | |
| echo " STATUS: TESTS FAILED (exit $exit_code)" | |
| echo "============================================" | |
| fi | |
| exit $exit_code | |