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