blob: c28e0a6c4b4deec9bc93ebb5b1b8beed80732f3b (
plain)
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
66
67
68
69
70
71
|
#!/usr/bin/env bash
# Setup reveal.js for org-reveal presentations (offline, pinned version)
# Usage: setup-reveal.sh [--yes] # --yes for non-interactive mode
set -euo pipefail
REVEAL_VERSION="5.1.0"
REVEAL_DIR="$HOME/.emacs.d/reveal.js"
# Non-interactive mode
ASSUME_YES=false
if [[ "${1:-}" == "--yes" ]] || [[ "${1:-}" == "-y" ]]; then
ASSUME_YES=true
fi
echo "=== reveal.js Setup for org-reveal ==="
echo
# Check if correct version already installed
if [[ -d "$REVEAL_DIR" ]]; then
if [[ -f "$REVEAL_DIR/dist/reveal.js" ]]; then
INSTALLED_VERSION=$(cd "$REVEAL_DIR" && git describe --tags 2>/dev/null || echo "unknown")
if [[ "$INSTALLED_VERSION" == "$REVEAL_VERSION" ]]; then
echo "✓ reveal.js $REVEAL_VERSION already installed at $REVEAL_DIR"
exit 0
else
echo "Found reveal.js $INSTALLED_VERSION, need $REVEAL_VERSION"
if [[ "$ASSUME_YES" == false ]]; then
read -p "Replace with correct version? [Y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "Aborted."
exit 1
fi
fi
echo "Removing old version..."
rm -rf "$REVEAL_DIR"
fi
else
echo "Found incomplete reveal.js directory, removing..."
rm -rf "$REVEAL_DIR"
fi
fi
# Clone reveal.js at pinned version (shallow clone for speed)
echo "Step 1/2: Cloning reveal.js $REVEAL_VERSION..."
git clone --depth 1 --branch "$REVEAL_VERSION" \
https://github.com/hakimel/reveal.js.git "$REVEAL_DIR"
echo "✓ Cloned reveal.js $REVEAL_VERSION"
# Verify installation
echo
echo "Step 2/2: Verifying installation..."
if [[ -f "$REVEAL_DIR/dist/reveal.js" ]]; then
echo "✓ reveal.js $REVEAL_VERSION installed at $REVEAL_DIR"
echo
echo "=== Setup Complete! ==="
echo
echo "Usage in Emacs:"
echo " C-; p n Create new presentation"
echo " C-; p e Export to HTML and open"
echo " C-; p p Start live preview"
else
echo "✗ Installation failed - dist/reveal.js not found"
echo
echo "Troubleshooting:"
echo "1. Check git access to github.com"
echo "2. Verify disk space at $REVEAL_DIR"
echo "3. Try manual clone: git clone https://github.com/hakimel/reveal.js.git $REVEAL_DIR"
exit 1
fi
|