-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.rb
executable file
·92 lines (79 loc) · 2.42 KB
/
setup.rb
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
#!/usr/bin/ruby
# Install Oh-My-Zsh
unless system('which zsh')
puts 'Installing Oh-My-Zsh 🐚...'
unless system('sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"')
puts 'Error: Oh-My-Zsh installation failed.'
exit(1)
end
end
# Copy .zshrc configuration
puts 'Configuring .zshrc...'
system('rm ~/.zshrc')
unless system('cp .zshrc.copy ~/.zshrc')
puts 'Error: .zshrc configuration failed.'
exit(1)
end
# Check if Homebrew is installed, if not, install it
unless system('which brew')
puts 'Installing Homebrew 🍺...'
unless system('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
puts 'Error: Homebrew installation failed.'
exit(1)
end
end
# Check if Homebrew Bundle is installed, if not, install it
unless system('which brew bundle')
puts 'Installing Homebrew Bundle 📦...'
unless system('brew tap Homebrew/bundle')
puts 'Error: Homebrew Bundle installation failed.'
exit(1)
end
end
# Check if Volta is installed, if not, install it
unless system('which volta')
puts 'Installing Volta ⚡️...'
unless system('curl https://get.volta.sh | bash')
puts 'Error: Volta installation failed.'
exit(1)
end
end
# List of toolchains to install
toolchains = %w[node@18 yarn@1 commitizen cz-conventional-changelog npm-check-updates]
# Install toolchains using Volta
toolchains.each do |tool|
unless system("volta which #{tool} &>/dev/null")
puts "Installing #{tool} ⚡️..."
unless system("volta install #{tool}")
puts "Error: #{tool} installation failed."
exit(1)
end
end
end
# Set commitizen config globally
File.write(File.expand_path("~/.czrc"), '{ "path": "cz-conventional-changelog" }')
# Install Sdkman
unless system('which sdk')
puts 'Installing Sdkman 📦...'
unless system('curl -s "https://get.sdkman.io" | bash')
puts 'Error: Sdkman installation failed.'
exit(1)
end
end
# Install Java 17
unless system('sdk install java 17.0.9-zulu')
puts 'Error: Java 17 installation failed.'
exit(1)
end
# Set global Git config
puts 'Configuring Git...'
unless system('git config --global user.name "Waryen"')
puts 'Error: Git user name configuration failed.'
exit(1)
end
puts 'Error: Git user email configuration failed.'
exit(1)
end
system('source ~/.zshrc')
puts 'All done ✅'