Skip to content

Commit 707a0c8

Browse files
committed
A script to setup a fresh Mac OS machine to develop with NativeScript
Implements #625
1 parent 96bc691 commit 707a0c8

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

setup/empty

Whitespace-only changes.

setup/empty.tar.gz

129 Bytes
Binary file not shown.

setup/native-script.rb

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 do finish installing..."
9+
sleep(30)
10+
end
11+
12+
puts "You need to accept the Xcode license agreement to be able to use the compilers. (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+
29+
puts "Creating Homebrew formula for NativeScript."
30+
File.open("/usr/local/Library/Formula/native-script.rb", "w:utf-8") do |f|
31+
f.write DATA.read
32+
end
33+
34+
puts "Installing NativeScript formula. This might take some time, please, be patient."
35+
system('brew install native-script')
36+
37+
__END__
38+
39+
class NativeScript < Formula
40+
desc "NativeScript"
41+
homepage "https://www.nativescript.org"
42+
version "1.3.0"
43+
url "https://raw.githubusercontent.com/NativeScript/nativescript-cli/brew/setup/empty.tar.gz"
44+
sha256 "813e1b809c094d29255191c14892a32a498e2ca298abbf5ce5cb4081faa4e88f"
45+
46+
depends_on :macos => :yosemite
47+
depends_on "pkg-config" => :build
48+
depends_on "node"
49+
depends_on "ant"
50+
depends_on "android-sdk"
51+
depends_on "gradle"
52+
53+
def install
54+
ohai "Installing NativeScript CLI."
55+
system "/usr/local/bin/npm install -g nativescript"
56+
57+
ohai "Installing Android SDK packages. This might take some time, please, be patient."
58+
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"
59+
system 'echo "export ANDROID_HOME=/usr/local/opt/android-sdk" >> ~/.bash_profile'
60+
61+
ohai "ANDROID_HOME and JAVA_HOME environment variables have been added to your .bash_profile. Restart the shell to use them."
62+
end
63+
end

0 commit comments

Comments
 (0)