-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-testdata.sh
More file actions
executable file
·67 lines (55 loc) · 2.01 KB
/
setup-testdata.sh
File metadata and controls
executable file
·67 lines (55 loc) · 2.01 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
66
67
#!/bin/bash
# setup-testdata.sh - Creates test data structure for manual and automated testing
set -e # Exit on error
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}Setting up test data...${NC}"
# Get the project root directory (parent of scripts/)
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# Create directory structure
echo "Creating directory structure..."
mkdir -p "$PROJECT_ROOT/test/testdata/dotfiles/home/.config/nvim"
mkdir -p "$PROJECT_ROOT/test/testdata/dotfiles/private/home/.ssh"
mkdir -p "$PROJECT_ROOT/test/testdata/target"
# Create sample files
echo "Creating sample dotfiles..."
echo "# Test bashrc - generated by setup-testdata.sh" >"$PROJECT_ROOT/test/testdata/dotfiles/home/.bashrc"
echo "alias ll='ls -la'" >>"$PROJECT_ROOT/test/testdata/dotfiles/home/.bashrc"
echo "export EDITOR=vim" >>"$PROJECT_ROOT/test/testdata/dotfiles/home/.bashrc"
cat >"$PROJECT_ROOT/test/testdata/dotfiles/home/.gitconfig" <<EOF
[user]
name = Test User
email = [email protected]
[core]
editor = vim
EOF
cat >"$PROJECT_ROOT/test/testdata/dotfiles/home/.config/nvim/init.vim" <<EOF
" Test vim config
set number
set autoindent
set expandtab
set tabstop=2
EOF
cat >"$PROJECT_ROOT/test/testdata/dotfiles/private/home/.ssh/config" <<EOF
Host test
HostName example.com
User testuser
Port 22
Host *.test.local
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
EOF
# Create .gitkeep
touch "$PROJECT_ROOT/test/testdata/target/.gitkeep"
echo -e "${GREEN}✓ Test data setup complete!${NC}"
echo
echo "Test environment created at: $PROJECT_ROOT/test/testdata/"
echo
echo "You can now test lnk commands safely:"
echo " cd test/testdata/dotfiles/home && lnk --target $PROJECT_ROOT/test/testdata/target status"
echo " cd test/testdata/dotfiles/home && lnk --target $PROJECT_ROOT/test/testdata/target create"
echo " cd test/testdata/dotfiles/home && lnk --target $PROJECT_ROOT/test/testdata/target remove"
echo
echo "To reset: rm -rf test/testdata/target/* && ./scripts/setup-testdata.sh"