Skip to content

Commit 7e75880

Browse files
committed
Fix mac setup, see #988
1 parent 138a834 commit 7e75880

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

setup/native-script.rb

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

3-
# 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'`
3+
# Only the user can manually download and install Xcode from App Store
4+
puts "NativeScript requires Xcode. Do you want to install Xcode now?"
5+
puts "Answer Y to open App Store to download and install Xcode. After you install Xcode, run this script again."
6+
puts "Answer N if you have Xcode already installed."
7+
puts "Do you want to install Xcode now? (y/n)"
68

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

1221
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`
22+
system('sudo xcodebuild -license')
1423

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

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

2236
puts "Installing Homebrew Cask... (You might need to provide your password.)"
2337
system('brew install caskroom/cask/brew-cask')
2438

25-
puts "Installing the Java SE Development Kit... (You might need to provide your password.)"
39+
puts "Installing the Java SE Development Kit... This might take some time, please, be patient. (You might need to provide your password.)"
2640
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`
41+
system('echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile')
42+
system('echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.bash_profile')
2943

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

0 commit comments

Comments
 (0)