@@ -4,95 +4,103 @@ require 'fileutils'
4
4
require 'os'
5
5
6
6
if OS.mac?
7
- # homebrew installation
7
+ # Homebrew installation
8
+ puts 'Checking for Homebrew...'
8
9
unless system 'which brew'
9
- puts 'Installing homebrew ...'
10
+ puts 'Installing Homebrew ...'
10
11
unless system 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
11
12
raise 'Error installing homebrew.'
12
13
end
13
- puts 'homebrew successfully installed !'
14
+ puts '...success !'
14
15
else
15
- puts 'homebrew already installed.'
16
+ puts 'Homebrew already installed.'
16
17
end
17
18
18
19
puts 'Tapping brew-bundle...'
19
20
unless system 'brew tap Homebrew/bundle'
20
21
raise 'Error tapping Homebrew/bundle.'
21
22
end
22
- puts 'brew-bundle successfully installed !'
23
+ puts '...success !'
23
24
24
25
# Brewfile installation
25
26
puts 'Installing Brewfile bundle...'
26
27
unless system 'brew bundle install -v'
27
28
raise 'Error installing Brewfile bundle.'
28
29
end
29
- puts 'Brewfile bundle successfully installed !'
30
+ puts '...success !'
30
31
31
- # general system settings
32
+ # Mac App Store apps
33
+ puts 'Installing Mac App Store apps...'
34
+ unless system 'bash ./mac/mac-app-store.sh'
35
+ raise 'Error installing Mac App Store applications.'
36
+ end
37
+ puts '...success!'
38
+
39
+ # VSCode extensions
40
+ puts 'Installing VSCode extensions...'
41
+ unless system 'bash ./mac/vscode-extensions.sh'
42
+ raise 'Error installing VSCode extensions.'
43
+ end
44
+ puts '...success!'
45
+
46
+ # Install fonts
47
+ puts 'Installing fonts...'
48
+ FileUtils.cp Dir.glob('./vendor/inconsolata/fonts/otf/*.otf'), "#{Dir.home}/Library/Fonts/"
49
+
50
+ # macOS system settings
51
+ puts 'Applying Mac system settings...'
32
52
unless system 'bash ./mac/system-settings.sh'
33
53
raise 'Error applying system settings'
34
54
end
35
- puts 'System settings applied successfully '
55
+ puts '...success! '
36
56
37
- # iTerm 2 preferences location
57
+ # iTerm 2 preferences
58
+ puts 'Configuring iTerm2 preferences...'
38
59
unless system 'defaults write com.googlecode.iterm2.plist PrefsCustomFolder -string "~/.homesick/repos/dotfiles/preferences"'
39
60
raise 'Error setting iTerm2 custom preferences location'
40
61
end
41
62
42
63
unless system 'defaults write com.googlecode.iterm2.plist LoadPrefsFromCustomFolder -bool true'
43
64
raise 'Error setting iTerm2 preferences to load from custom folder'
44
65
end
45
- puts 'iTerm2 custom preferences location set. '
66
+ puts '...success! '
46
67
47
- # VSCode extensions
48
- unless system 'bash ./mac/vscode-extensions.sh'
49
- raise 'Error installing VSCode extensions.'
50
- end
51
- puts 'VSCode extensions successfully installed.'
68
+ # gnupg pinentry-mac
69
+ puts 'Configuring gnupg...'
70
+ homebrew_pinentry_mac_path=`brew --prefix pinentry-mac`.strip
71
+ system "echo \"pinentry-program #{homebrew_pinentry_mac_path}/bin/pinentry-mac\" >> ~/.gnupg/gpg-agent.conf"
72
+ puts '...success!'
73
+ end
52
74
53
- # Mac App Store apps
54
- unless system 'bash ./mac/mac-app-store.sh'
55
- raise 'Error installing Mac App Store applications.'
56
- end
57
- puts 'Mac App Store applications installed.'
75
+ # zsh as default shell
76
+ puts 'Setting zsh as default shell...'
77
+ if OS.mac?
78
+ homebrew_zsh_path=`brew --prefix zsh`
79
+ system "sudo sh -c 'echo \"#{homebrew_zsh_path}\" >> /etc/shells'"
80
+ system "chsh -s \"#{homebrew_zsh_path}\""
81
+ else
82
+ system 'chsh -s /bin/zsh'
58
83
end
84
+ puts '...success!'
59
85
60
86
# oh-my-zsh installation
87
+ puts 'Checking for oh-my-zsh...'
61
88
ohmyzsh_path = Pathname.new "#{Dir.home}/.oh-my-zsh"
62
89
unless ohmyzsh_path.exist?
63
90
puts 'Installing oh-my-zsh...'
64
91
unless system 'git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh'
65
92
raise 'Error installing oh-my-zsh'
66
93
end
67
94
system 'chmod g-w,o-w ~/.oh-my-zsh'
68
- puts 'oh-my-zsh installed !'
95
+ puts '...success !'
69
96
else
70
97
puts 'oh-my-zsh already installed.'
71
98
end
72
99
73
- puts 'Setting zsh as default shell...'
74
- if OS.mac?
75
- homebrew_zsh_path=`brew --prefix zsh`
76
- system "sudo sh -c 'echo \"#{homebrew_zsh_path}\" >> /etc/shells'"
77
- system "chsh -s \"#{homebrew_zsh_path}\""
78
- else
79
- system "chsh -s /bin/zsh"
80
- end
81
-
82
- if OS.mac?
83
- puts "Installing fonts..."
84
- # Install Inconsolata
85
- FileUtils.cp Dir.glob("./vendor/inconsolata/fonts/otf/*.otf"), "#{Dir.home}/Library/Fonts/"
86
-
87
- puts "Configuring gnupg..."
88
- homebrew_pinentry_mac_path=`brew --prefix pinentry-mac`.strip
89
- system "echo \"pinentry-program #{homebrew_pinentry_mac_path}/bin/pinentry-mac\" >> ~/.gnupg/gpg-agent.conf"
90
- end
91
-
92
- # Private info prompts
93
- puts "Configuring git..."
100
+ # git user info
101
+ puts 'Configuring git user info...'
94
102
email = Readline.readline('Email address: ')
95
103
unless system "git config --file ~/.gitconfig-private user.email #{email}"
96
104
raise 'Error setting email address in git.'
97
105
end
98
- puts 'Email address set in git global configuration '
106
+ puts '...success! '
0 commit comments