diff --git a/bin/setup b/bin/setup index 4ac8382..e3c3cb7 100755 --- a/bin/setup +++ b/bin/setup @@ -60,10 +60,10 @@ else fi fi -# WITH_DEP=true bin/setup will install system dependencies (mac only) +# WITH_DEP=true bin/setup will install system dependencies (mac and ubuntu/debian only) if [ -n "$WITH_DEP" ]; then echo "Checking system dependencies..." - # Ubuntu/Debian support was once working; Here it determines if you're on a mac or debian + # Here it determines if you're on a Mac or Ubuntu/Debian IS_MAC=false; IS_DEBIAN=false [[ -f /etc/debian_version ]] && IS_DEBIAN=true [[ $(command -v sw_vers) && $(sw_vers -productVersion | cut -f2 -d.) -ge 7 ]] && IS_MAC=true @@ -90,11 +90,67 @@ if [ -n "$WITH_DEP" ]; then echo $PATH | grep $(cd $(which gem)/..;pwd) > /dev/null [[ $? -ne 0 ]] && echo 'For ruby gems to work, add the current path to your profile (.bashrc, .zshrc, etc): export PATH="$(cd $(which gem)/..;pwd):$PATH"' + elif $IS_DEBIAN; then + # Installing ruby + if [[ ! $(command -v ruby) ]]; then + append_log successfully sudo apt-get install -y build-essential libffi-dev libgdbm-dev libncurses5-dev libreadline-dev libssl-dev libyaml-dev zlib1g-dev + + echo "Downloading Ruby 2" + wget -qO - "ftp://ftp.ruby-lang.org/pub/ruby/ruby-2.0-stable.tar.gz" | tar xzf - + + echo "Installing Ruby 2" + quietly cd ruby-* && ./configure --silent --prefix=/usr/local/lib/ruby --bindir=/usr/local/bin && make --silent && sudo make install --silent && cd .. + quietly successfully rm -rf ruby-* + fi + + # Installing memcached + append_log successfully sudo apt-get install -y memcached + + # Installing ImageMagick + append_log successfully sudo apt-get install -y imagemagick libdjvulibre-dev libjpeg-dev libtiff-dev libwmf-dev libmagickcore-dev libmagickwand-dev libmagick++-dev + + # Installing PhantomJS + LATEST_PHANTOMJS_VERSION=`wget -qO - "https://code.google.com/p/phantomjs/downloads/list?can=1" | sed -E 's/^.*(phantomjs)-(.*)-linux-.*$/\2/' | sed -e '/^[0-9].*/!d' | sort | sed '$!d'` + PJS32="https://phantomjs.googlecode.com/files/phantomjs-$LATEST_PHANTOMJS_VERSION-linux-i686.tar.bz2" + PJS64="https://phantomjs.googlecode.com/files/phantomjs-$LATEST_PHANTOMJS_VERSION-linux-x86_64.tar.bz2" + [[ $(dpkg-architecture -qDEB_HOST_ARCH) = 'amd64' ]] && PJSURL=$PJS64 || PJSURL=$PJS32 + + wget -qO - $PJSURL | tar xvjf - + append_log successfully sudo cp phantomjs-*/bin/phantomjs /usr/local/bin/ + quietly successfully rm -rf phantomjs-* + + append_log successfully sudo apt-get install -y libfreetype6 fontconfig + + echo "Installing system libraries so we can compile some gems" + + quietly successfully sudo apt-get install -y g++ libcurl3 + + # For nokogiri gem + append_log successfully sudo apt-get install -y libxml2-dev libxslt1-dev + + # Using NodeJS as javascript runtime + quietly successfully sudo add-apt-repository -y ppa:chris-lea/node.js + quietly successfully sudo apt-get update + append_log successfully sudo apt-get install -y nodejs + + # Installing Heroku Toolbelt + append_log successfully wget -qO toolbelt.sh https://toolbelt.heroku.com/install-ubuntu.sh + append_log successfully sh toolbelt.sh + quietly successfully rm toolbelt.sh + + # Installing Postgres + quietly successfully sudo apt-get install -y python-software-properties + quietly successfully sudo add-apt-repository -y ppa:pitti/postgresql + quietly successfully sudo apt-get update + append_log successfully sudo apt-get install -y postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 postgresql-client-9.2 + quietly successfully sudo sed -i 's/peer$/trust/g' /etc/postgresql/9.2/main/pg_hba.conf + quietly successfully sudo sed -i 's/md5$/trust/g' /etc/postgresql/9.2/main/pg_hba.conf + append_log sudo service postgresql restart && sudo su postgres -c "createuser -s -d $USER" && createdb fi fi echo "Installing libraries..." -append_log successfully gem list -i bundler || gem install bundler +append_log gem list -i bundler || gem install bundler append_log successfully bundle install --path vendor/bundle --binstubs vendor/bundle/bin # Flush all the memcaches