|
| 1 | +# coding: utf-8 |
| 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'` |
| 6 | + |
| 7 | +until `xcodebuild -version`.include? "version" do |
| 8 | + puts "Waiting for Xcode to finish installing..." |
| 9 | + sleep(30) |
| 10 | +end |
| 11 | + |
| 12 | +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` |
| 14 | + |
| 15 | +# Install all other dependencies |
| 16 | +puts "Installing Homebrew... (You might need to provide your password.)" |
| 17 | +`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` |
| 18 | + |
| 19 | +puts "Installing CocoaPods... This might take some time, please, be patient. (You might need to provide your password.)" |
| 20 | +system('sudo gem install cocoapods') |
| 21 | + |
| 22 | +puts "Installing Homebrew Cask... (You might need to provide your password.)" |
| 23 | +system('brew install caskroom/cask/brew-cask') |
| 24 | + |
| 25 | +puts "Installing the Java SE Development Kit... (You might need to provide your password.)" |
| 26 | +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` |
| 29 | + |
| 30 | +puts "Creating Homebrew formula for NativeScript." |
| 31 | +File.open("/usr/local/Library/Formula/native-script.rb", "w:utf-8") do |f| |
| 32 | + f.write DATA.read |
| 33 | +end |
| 34 | + |
| 35 | +puts "Installing NativeScript formula... This might take some time, please, be patient." |
| 36 | +system('brew install native-script') |
| 37 | + |
| 38 | +__END__ |
| 39 | + |
| 40 | +class NativeScript < Formula |
| 41 | + desc "NativeScript" |
| 42 | + homepage "https://www.nativescript.org" |
| 43 | + version "1.3.0" |
| 44 | + url "https://raw.githubusercontent.com/NativeScript/nativescript-cli/brew/setup/empty.tar.gz" |
| 45 | + sha256 "813e1b809c094d29255191c14892a32a498e2ca298abbf5ce5cb4081faa4e88f" |
| 46 | + |
| 47 | + depends_on :macos => :yosemite |
| 48 | + depends_on "pkg-config" => :build |
| 49 | + depends_on "node" |
| 50 | + depends_on "ant" |
| 51 | + depends_on "android-sdk" |
| 52 | + depends_on "gradle" |
| 53 | + |
| 54 | + def install |
| 55 | + ohai "Installing NativeScript CLI..." |
| 56 | + system "/usr/local/bin/npm install -g nativescript" |
| 57 | + |
| 58 | + ohai "Configuring your system for Android development... This might take some time, please, be patient." |
| 59 | + system "echo yes | android update sdk --filter tools,platform-tools,android-22,android-17,build-tools-22.0.1,sys-img-x86-android-22,extra-android-m2repository,extra-google-m2repository,extra-android-support --all --no-ui" |
| 60 | + |
| 61 | + ohai "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile. Restart the terminal to use them." |
| 62 | + end |
| 63 | +end |
0 commit comments