forked from driesvints/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·109 lines (94 loc) · 2.59 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·109 lines (94 loc) · 2.59 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
check_command() {
if command -v "$1" >/dev/null 2>&1; then
echo -e "${GREEN}✓ $1 is installed${NC}"
return 0
else
echo -e "${RED}✗ $1 is not installed${NC}"
return 1
fi
}
check_symlink() {
if [ -L "$1" ]; then
echo -e "${GREEN}✓ Symlink $1 exists${NC}"
return 0
else
echo -e "${RED}✗ Symlink $1 does not exist${NC}"
return 1
fi
}
check_directory() {
if [ -d "$1" ]; then
echo -e "${GREEN}✓ Directory $1 exists${NC}"
return 0
else
echo -e "${RED}✗ Directory $1 does not exist${NC}"
return 1
fi
}
echo -e "${YELLOW}Starting dotfiles verification...${NC}\n"
echo -e "${YELLOW}Checking essential commands:${NC}"
check_command zsh
check_command brew
check_command git
check_command node
check_command php
check_command composer
check_command phpcs
check_command phpcbf
# NVM is a shell function, not a binary — source it before checking
echo -e "${YELLOW}Checking NVM:${NC}"
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
if type nvm >/dev/null 2>&1; then
echo -e "${GREEN}✓ nvm is available${NC}"
else
echo -e "${RED}✗ nvm is not available${NC}"
fi
echo -e "\n${YELLOW}Checking symlinks:${NC}"
check_symlink "$HOME/.zshrc"
check_symlink "$HOME/.gitconfig"
check_symlink "$HOME/.gitignore_global"
echo -e "\n${YELLOW}Checking directories:${NC}"
check_directory "$HOME/Code"
check_directory "$HOME/.nvm"
echo -e "\n${YELLOW}Checking Homebrew packages:${NC}"
if command -v brew >/dev/null 2>&1; then
echo "Installed formulae:"
brew list --formula
else
echo -e "${RED}Homebrew is not installed${NC}"
fi
echo -e "\n${YELLOW}Checking Node.js:${NC}"
if command -v node >/dev/null 2>&1; then
echo "Node.js version: $(node --version)"
echo "npm version: $(npm --version)"
else
echo -e "${RED}Node.js is not installed${NC}"
fi
echo -e "\n${YELLOW}Checking PHP tools:${NC}"
if command -v phpcs >/dev/null 2>&1; then
echo "PHP_CodeSniffer version: $(phpcs --version)"
echo "Installed standards:"
phpcs -i
else
echo -e "${RED}PHP_CodeSniffer is not installed${NC}"
fi
echo -e "\n${YELLOW}Testing shell configuration:${NC}"
if [ -f "$HOME/.zshrc" ]; then
zsh -c 'echo "Shell configuration test successful"'
else
echo -e "${RED}.zshrc file not found${NC}"
fi
echo -e "\n${YELLOW}Checking git configuration:${NC}"
if [ -f "$HOME/.gitconfig" ]; then
git config --list
else
echo -e "${RED}.gitconfig file not found${NC}"
fi
echo -e "\n${YELLOW}Verification complete!${NC}"