Skip to content

Instantly share code, notes, and snippets.

@poborin
Created May 16, 2018 02:52
Show Gist options
  • Save poborin/12770130d88c1f5cc1275e80ed6a744d to your computer and use it in GitHub Desktop.
Save poborin/12770130d88c1f5cc1275e80ed6a744d to your computer and use it in GitHub Desktop.
This is a handy file to install build dependnecies
#!/bin/bash
# Installs tools to build and initialises Carthage dependencies
# Run this after your initial clone
set -eu
ruby_version=2.5.0
function resolve_brew() {
if [ ! `which brew 2> /dev/null` ]; then
echo "+++ installing rbenv"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew --version
else
brew update
brew --version
fi
}
function resolve_dep() {
dep=$1
resolve=$2
if [ ! `which $dep 2> /dev/null` ]; then
echo "+++ installing $dep"
$resolve $dep
else
echo "+++ Confirmed $dep available"
fi
}
function resolve_rbenv() {
# slightly complimacated. Install rbenv and required rubies
if [ ! `which rbenv 2> /dev/null` ]; then
echo "+++ installing rbenv"
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
eval "$(rbenv init -)"
rbenv install $ruby_version
rbenv global $ruby_version
fi
}
function brew_dep() {
resolve_dep $1 "brew install"
}
rm -rf Carthage
resolve_brew
brew_dep carthage
resolve_rbenv
resolve_dep bundle "gem install"
bundle install
bundle exec pod install
carthage bootstrap --platform ios --cache-builds
git reset HEAD .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment