#!/usr/bin/env bash # Gera a pagina de jogos de Bitsy (o exportador de HTML unico do motor Bitsy, MIT, ja embutido na pagina de cada jogo) dos # repositorios dos proprios autores: Left Undetected (mildmojo, GGJ 2018), The King Is Back (Victor Enrique) e A Cozy Winterwalk # (Rick / tinyworlds), todos MIT. O HTML vem do commit pinado e conferido pelo sha256; as mudancas nossas ficam em bitsy/make.py: # - Left Undetected: sem o rodape com links (repositorio, itch, Twitter e site do autor) e sem o @ e o site do autor na tela final; # - A Cozy Winterwalk: sem a trilha de fundo, que o jogo tocava de um video do YouTube (script e iframe externos); # - CSP que bloqueia qualquer requisicao fora da pagina. # O texto da licenca do Bitsy (LICENSE.md de le-doux/bitsy no commit ee412fa) sai junto, para o LICENSE.txt. # # src/FredGames.Bundler/Builds/build-bitsy-games.sh # # Saida: artifacts/build/bitsy-games/.html (+ .bitsydata onde houver, .LICENSE e bitsy.LICENSE). Roda duas vezes com o mesmo resultado. set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(git -C "$here" rev-parse --show-toplevel 2>/dev/null || pwd)" out="$root/artifacts/build/bitsy-games" cache="$root/artifacts/build/cache" mkdir -p "$cache" "$out" fetch() { # url destino sha256 if [ ! -f "$2" ]; then curl -fsSL --retry 4 "$1" -o "$2.partial" && mv "$2.partial" "$2"; fi echo "$3 $2" | shasum -a 256 -c - >/dev/null } fetch "https://raw.githubusercontent.com/le-doux/bitsy/ee412fa8c072d16af4aedd90d4ad3fb7306911b0/LICENSE.md" "$cache/bitsy-ee412fa-LICENSE.md" \ d680407dd64ddf37fd1b7aef13a628c27ee7a1e5da4f61514ef4495179399cf9 cp "$cache/bitsy-ee412fa-LICENSE.md" "$out/bitsy.LICENSE" # slug repositorio commit arquivo-html sha256 licenca-sha256 [arquivo-bitsydata sha256] while read -r slug repo commit file sha licsha data datasha; do c="$cache/bitsy-$slug" base="https://raw.githubusercontent.com/$repo/$commit" fetch "$base/$file" "$c.html" "$sha" fetch "$base/LICENSE" "$c.LICENSE" "$licsha" cp "$c.LICENSE" "$out/$slug.LICENSE" if [ -n "${data:-}" ]; then fetch "$base/$data" "$c.bitsydata" "$datasha" python3 -I "$here/bitsy/make.py" "$slug" "$c.html" "$out/$slug.html" "$c.bitsydata" "$out/$slug.bitsydata" else python3 -I "$here/bitsy/make.py" "$slug" "$c.html" "$out/$slug.html" fi done <<'LIST' left-undetected mildmojo/undetect 7809d3daa7085554a7fbecb6aa360ea0f7d4a7a7 docs/index.html 1e973b8f349fb185d9a4a865bf5ddbcecf8ae316875015c6b90d85dee1ecffd2 4bd8cb88623226e81f244b5779bb387ed0dfaeaec2c3df35450298b810c9f284 docs/undetect.bitsydata 8f93f940d7d56144c1bd2c4369d9040def551b33644dcc3deca5a9a84e1034f4 the-king-is-back tofumarinado/the-king-is-back 0cc69e2228f7c9c11f8668458e9a3781fbd2a5b2 index.html 2646dd43df74014998b1ab253aefc970f0b935b840fb6cae698506224b75fc7e 183243e475cd6b637ed27a1a05f1e707648012fd1ed3248c136471ab2db4052f a-cozy-winterwalk tinyworlds/winterwalk-game 53756aa85316a13ce95cbafe382dfaf68e2b2442 index.html b5866b91b81644a8c1137f5a6b06f9e8665669352c0ed439f2b536e86e25f2c6 b69af08f4cc972fc80e9d98dce0524f263fd1c59306c5e69f1f9785246bd5ab9 LIST shasum -a 256 "$out"/*.html "$out"/*.bitsydata