Skip to content

Commit 93247a9

Browse files
Fix mac setup, see #988
1 parent 138a834 commit 93247a9

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

setup/native-script.rb

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
# coding: utf-8
22

33
# Only the user can manually download and install Xcode from AppStore
4-
puts "Installing Xcode... Please, click 'Get' or 'Update' to install Xcode from the App Store."
5-
`open 'macappstore://itunes.apple.com/us/app/xcode/id497799835'`
4+
puts "NativeScript requires Xcode. Do you have Xcode installed? (y/n)"
5+
puts "If you answer N, this script will open AppStore to download and install Xcode."
6+
puts "After you install Xcode, run this script again."
67

7-
until `xcodebuild -version`.include? "version" do
8-
puts "Waiting for Xcode to finish installing..."
9-
sleep(30)
8+
xcode = gets.chomp
9+
10+
if xcode == "n" || xcode == "N"
11+
system('open "macappstore://itunes.apple.com/us/app/xcode/id497799835"')
12+
exit
13+
end
14+
15+
if !(`xcodebuild -version`.include? "version")
16+
puts "Xcode is not installed or not configured properly. Download, install and set it up and run this script again."
17+
exit
1018
end
1119

1220
puts "You need to accept the Xcode license agreement to be able to use the Xcode command-line tools. (You might need to provide your password.)"
13-
`sudo xcodebuild -license`
21+
system('sudo xcodebuild -license')
1422

1523
# Install all other dependencies
1624
puts "Installing Homebrew... (You might need to provide your password.)"
17-
`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
25+
system('ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"')
26+
27+
if !(`brew --version`.include? "git revision")
28+
puts "Homebrew is not installed or not configured properly. Download it from http://brew.sh/, install and set it up and run this script again."
29+
exit
30+
end
1831

1932
puts "Installing CocoaPods... This might take some time, please, be patient. (You might need to provide your password.)"
2033
system('sudo gem install cocoapods')
2134

2235
puts "Installing Homebrew Cask... (You might need to provide your password.)"
2336
system('brew install caskroom/cask/brew-cask')
2437

25-
puts "Installing the Java SE Development Kit... (You might need to provide your password.)"
38+
puts "Installing the Java SE Development Kit... This might take some time, please, be patient. (You might need to provide your password.)"
2639
system('brew cask install java')
27-
`echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile`
28-
`echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.bash_profile`
40+
system('echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile')
41+
system('echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.bash_profile')
2942

3043
puts "Installing node.js 0.12"
3144
system('brew install homebrew/versions/node012')

0 commit comments

Comments
 (0)