-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
54 lines (45 loc) · 951 Bytes
/
Rakefile
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
# Rakefile
task :default do
system('rake -T')
end
desc 'Run GNU Stow'
task :stow do
dotfiles = %w{asdf git jrnl ruby tmux vim zsh}
system("stow #{dotfiles.join(' ')} --verbose")
end
namespace :brew do
desc 'Run brew bundle'
task :bundle do
system('brew bundle --verbose')
end
end
namespace :test do
desc 'Syntax test for Brewfile'
task :brewfile do
system('ruby -c Brewfile')
end
task :shellcheck do
# no-op for now
end
end
task tests: ['test:brewfile', 'test:shellcheck']
namespace :install do
desc 'Install Homebrew'
task :homebrew do
install_homebrew
end
end
private
def run(cmd)
puts "[Running] #{cmd}..." if ENV['DEBUG']
`#{cmd}`
end
def install_homebrew
run %{which brew}
unless $?.success?
puts "\tInstalling Homebrew..."
run %{ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"}
else
puts 'Homebrew already installed.'
end
end