ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
45 lines
2.1 KiB
Bash
45 lines
2.1 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
dat=${1:-build/linux/dat}
|
|
ddat=${2:-build/linux/ddat}
|
|
root=$(mktemp -d /tmp/datgpt-cli-parity.XXXXXX)
|
|
trap 'rm -rf "$root"' EXIT HUP INT TERM
|
|
mkdir -p "$root/home" "$root/from-dat" "$root/from-ddat"
|
|
export HOME="$root/home"
|
|
|
|
test "$("$dat" --version)" = "$("$ddat" --version)"
|
|
"$dat" --help | grep -q '^dat '
|
|
"$ddat" --help | grep -q '^ddat '
|
|
"$dat" --help | sed 's/ddat/CLI/g; s/dat/CLI/g' > "$root/dat-help"
|
|
"$ddat" --help | sed 's/ddat/CLI/g; s/dat/CLI/g' > "$root/ddat-help"
|
|
cmp "$root/dat-help" "$root/ddat-help"
|
|
|
|
printf 'dat wrote this first\n' > "$root/from-dat/shared.txt"
|
|
"$dat" create "$root/from-dat" --title 'created by dat' > "$root/dat-url"
|
|
"$dat" sync "$root/from-dat" >/dev/null
|
|
"$ddat" status "$root/from-dat" | grep -q "$(cat "$root/dat-url")"
|
|
"$ddat" files "$root/from-dat" | grep -q shared.txt
|
|
old_dat_version=$("$ddat" log "$root/from-dat" | awk '/shared.txt/{print $1; exit}')
|
|
printf 'ddat updated this second\n' > "$root/from-dat/shared.txt"
|
|
"$ddat" sync "$root/from-dat" >/dev/null
|
|
test "$("$dat" cat "$old_dat_version" /shared.txt "$root/from-dat")" = 'dat wrote this first'
|
|
"$dat" verify "$root/from-dat" >/dev/null
|
|
"$dat" url "$old_dat_version" /shared.txt "$root/from-dat" | \
|
|
grep -Eq '^dat://[0-9a-f]{64}\+[0-9]+/shared.txt$'
|
|
"$ddat" status "$root/from-dat" | grep -q "$(cat "$root/dat-url")"
|
|
|
|
printf 'ddat created this first\n' > "$root/from-ddat/shared.txt"
|
|
"$ddat" create "$root/from-ddat" --title 'created by ddat' > "$root/ddat-url"
|
|
"$ddat" sync "$root/from-ddat" >/dev/null
|
|
"$dat" status "$root/from-ddat" | grep -q "$(cat "$root/ddat-url")"
|
|
"$dat" files "$root/from-ddat" | grep -q shared.txt
|
|
old_ddat_version=$("$dat" log "$root/from-ddat" | awk '/shared.txt/{print $1; exit}')
|
|
printf 'dat updated this second\n' > "$root/from-ddat/shared.txt"
|
|
"$dat" sync "$root/from-ddat" >/dev/null
|
|
test "$("$ddat" cat "$old_ddat_version" /shared.txt "$root/from-ddat")" = 'ddat created this first'
|
|
"$ddat" verify "$root/from-ddat" >/dev/null
|
|
"$dat" status "$root/from-ddat" | grep -q "$(cat "$root/ddat-url")"
|
|
|
|
echo 'dat/ddat shared archive, address, read, update, and history: PASS'
|