From cab379a42715133a3f8a19c4134cfb0229a57f15 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Tue, 8 Sep 2015 12:01:13 +0300 Subject: [PATCH] A script to setup a fresh Mac OS machine to develop with NativeScript Implements https://github.com/NativeScript/nativescript-cli/issues/625 --- setup/empty | 0 setup/empty.tar.gz | Bin 0 -> 129 bytes setup/native-script.rb | 63 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 setup/empty create mode 100644 setup/empty.tar.gz create mode 100644 setup/native-script.rb diff --git a/setup/empty b/setup/empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup/empty.tar.gz b/setup/empty.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..89ce897787366a28fe2c76522bf47114853cfb8a GIT binary patch literal 129 zcmb2|=3oE=?ziU*`3@NfxLmaD>fhjZ&3o=*7bVv&ft36SJ8VxZYSjz*Z@PHmvKgtn zj|ZPynxA*=^CR2Mv%dXPtkgKVX26hRAa@X4JTV3ZS YuYW6l9%2cM{PBu)b=Arh3>pj!04*3cnE(I) literal 0 HcmV?d00001 diff --git a/setup/native-script.rb b/setup/native-script.rb new file mode 100644 index 0000000000..1ba4676776 --- /dev/null +++ b/setup/native-script.rb @@ -0,0 +1,63 @@ +# coding: utf-8 + +# Only the user can manually download and install Xcode from AppStore +puts "Installing Xcode... Please, click 'Get' or 'Update' to install Xcode from the App Store." +`open 'macappstore://itunes.apple.com/us/app/xcode/id497799835'` + +until `xcodebuild -version`.include? "version" do + puts "Waiting for Xcode to finish installing..." + sleep(30) +end + +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.)" +`sudo xcodebuild -license` + +# Install all other dependencies +puts "Installing Homebrew... (You might need to provide your password.)" +`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` + +puts "Installing CocoaPods... This might take some time, please, be patient. (You might need to provide your password.)" +system('sudo gem install cocoapods') + +puts "Installing Homebrew Cask... (You might need to provide your password.)" +system('brew install caskroom/cask/brew-cask') + +puts "Installing the Java SE Development Kit... (You might need to provide your password.)" +system('brew cask install java') +`echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile` +`echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.bash_profile` + +puts "Creating Homebrew formula for NativeScript." +File.open("/usr/local/Library/Formula/native-script.rb", "w:utf-8") do |f| + f.write DATA.read +end + +puts "Installing NativeScript formula... This might take some time, please, be patient." +system('brew install native-script') + +__END__ + +class NativeScript < Formula + desc "NativeScript" + homepage "https://www.nativescript.org" + version "1.3.0" + url "https://raw.githubusercontent.com/NativeScript/nativescript-cli/brew/setup/empty.tar.gz" + sha256 "813e1b809c094d29255191c14892a32a498e2ca298abbf5ce5cb4081faa4e88f" + + depends_on :macos => :yosemite + depends_on "pkg-config" => :build + depends_on "node" + depends_on "ant" + depends_on "android-sdk" + depends_on "gradle" + + def install + ohai "Installing NativeScript CLI..." + system "/usr/local/bin/npm install -g nativescript" + + ohai "Configuring your system for Android development... This might take some time, please, be patient." + 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" + + ohai "The ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile. Restart the terminal to use them." + end +end