|
1 | 1 | # coding: utf-8
|
2 | 2 |
|
3 | 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'` |
| 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." |
6 | 7 |
|
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 |
10 | 18 | end
|
11 | 19 |
|
12 | 20 | 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') |
14 | 22 |
|
15 | 23 | # Install all other dependencies
|
16 | 24 | 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 |
18 | 31 |
|
19 | 32 | puts "Installing CocoaPods... This might take some time, please, be patient. (You might need to provide your password.)"
|
20 | 33 | system('sudo gem install cocoapods')
|
21 | 34 |
|
22 | 35 | puts "Installing Homebrew Cask... (You might need to provide your password.)"
|
23 | 36 | system('brew install caskroom/cask/brew-cask')
|
24 | 37 |
|
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.)" |
26 | 39 | 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') |
29 | 42 |
|
30 | 43 | puts "Installing node.js 0.12"
|
31 | 44 | system('brew install homebrew/versions/node012')
|
|
0 commit comments