This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify_env_mac.rb
92 lines (72 loc) · 3.41 KB
/
verify_env_mac.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
RSpec.configure do |config|
config.color = true
config.formatter = 'doc'
end
def lsregister_grep(search)
`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/\
lsregister -dump | grep -i "#{search}"`
end
RSpec.describe do
it 'Ruby version 2.2.3 or greater is installed.' do
expect(RUBY_VERSION).to be >= "2.2.3"
end
# it 'Chrome is installed.' do
# chrome_search = lsregister_grep('google chrome')
# expect(chrome_search).to_not be_empty,
# "Chrome isn't installed."
# end
it 'Heroku Toolbelt is installed.' do
heroku = `which heroku`
expect(heroku).to_not be_empty,
'Heroku Toolbelt is not installed.'
end
# it 'VSCode or Sublime Text is installed.' do
# which_code = lsregister_grep(`VSCode`)
# subl_search = lsregister_grep('Sublime Text')
# expect([which_code, subl_search]).to_not satisfy { |searches| searches.all?(&:empty?) },
# "Couldn't find either Sublime Text or Atom installed on your system."
# end
# it 'Atom Command Line Tools are installed.' do
# atom = `which atom`
# subl = `which subl`
# expect([atom, subl]).to_not satisfy { |s| s.all?(&:empty?) },
# "Your text editor is not configured to be launched from your Command Line.\
# Open Atom, and select Atom > Install Shell Commands"
# end
it 'Homebrew is installed.' do
brew = `which brew`
expect(brew).to_not be_empty,
'Homebrew is not installed.'
end
it 'XCode Command Line Tools are installed.' do
xcode_cli = `xcrun -f xcode-select`
expect(xcode_cli).to match(/\/usr\/bin\/xcode-select/),
"Xcode is not installed. Open the Mac App Store and install and/or update 'Xcode'."
end
it 'Version 10.x or greater of Xcode Command Line Tools is installed.' do
xcode_cli = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
expect(xcode_cli).to match(/version: 1[0-9]+\.[0-9]+/),
"Xcode Command Line Tools 10.x or greater are not installed."
end
# it 'Postgres App is installed.' do
# postgres_search = lsregister_grep('postgres')
# expect(postgres_search).to_not be_empty,
# "Postgres App is not installed, visit http://postgresapp.com to install."
# end
it 'Postgres Command Line Tools are installed.' do
postgres = `which psql`
expect(postgres).to_not be_empty,
"Postgres Command Line tools are not installed. Run 'brew install postgresql' to install."
end
it 'Git is installed.' do
git = `which git`
expect(git).to_not be_empty,
"Git is not installed"
end
it 'Git user is configured.' do
git_name = `git config --get user.name`
git_email = `git config --get user.email`
expect([git_email, git_name]).to_not satisfy { |searches| searches.any?(&:empty?) },
"Your Git user is not configured. Run `git config --global user.name \"John Doe\"` and `git config --global user.email [email protected]` with your information."
end
end