-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
66 lines (52 loc) · 1.77 KB
/
sync.sh
File metadata and controls
66 lines (52 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -euo pipefail
plugin_src="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "$(uname -s)" in
Linux*)
PLUGINS_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/tabularis/plugins"
;;
Darwin*)
PLUGINS_DIR="$HOME/Library/Application Support/com.debba.tabularis/plugins"
;;
MINGW*|MSYS*|CYGWIN*)
PLUGINS_DIR="${APPDATA}/com.debba.tabularis/plugins"
;;
*)
echo "Unsupported OS: $(uname -s)" >&2
exit 1
;;
esac
echo "Target plugins directory: $PLUGINS_DIR"
manifest="$plugin_src/manifest.json"
if [[ ! -f "$manifest" ]]; then
echo "manifest.json not found in $plugin_src" >&2
exit 1
fi
plugin_id=$(grep -o '"id"\s*:\s*"[^"]*"' "$manifest" | head -1 | sed 's/.*: *"\(.*\)"/\1/')
executable=$(grep -o '"executable"\s*:\s*"[^"]*"' "$manifest" | head -1 | sed 's/.*: *"\(.*\)"/\1/')
if [[ -z "$plugin_id" || -z "$executable" ]]; then
echo "Could not parse manifest.json" >&2
exit 1
fi
echo ""
echo "==> Plugin: $plugin_id"
echo " Building (cargo build --release)..."
cargo build --release --manifest-path "$plugin_src/Cargo.toml"
dest_dir="$PLUGINS_DIR/$plugin_id"
mkdir -p "$dest_dir"
cp "$manifest" "$dest_dir/manifest.json"
echo " Copied manifest.json"
bin_path="$plugin_src/target/release/$executable"
if [[ ! -f "$bin_path" && -f "$plugin_src/target/release/$executable.exe" ]]; then
bin_path="$plugin_src/target/release/$executable.exe"
fi
if [[ ! -f "$bin_path" ]]; then
echo " [WARN] Executable '$executable' not found. Build may have failed." >&2
exit 1
fi
cp "$bin_path" "$dest_dir/$(basename "$bin_path")"
chmod +x "$dest_dir/$(basename "$bin_path")" || true
echo " Copied executable: $(basename "$bin_path")"
echo " Installed to: $dest_dir"
echo ""
echo "Sync complete. Restart Tabularis to load the updated plugin."