Skip to content

Commit 9926222

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

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

setup/native-script.rb

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
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."
5+
puts "If you do not have Xcode installed, download and install it from App Store and run it once to complete its setup."
6+
puts "Do you have Xcode installed? (y/n)"
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+
exit
12+
end
13+
14+
if !(`xcodebuild -version`.include? "version")
15+
puts "Xcode is not installed or not configured properly. Download, install, set it up and run this script again."
16+
exit
1017
end
1118

1219
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`
20+
system('sudo xcodebuild -license')
1421

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

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

2234
puts "Installing Homebrew Cask... (You might need to provide your password.)"
2335
system('brew install caskroom/cask/brew-cask')
2436

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

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

0 commit comments

Comments
 (0)