From 72a36d908448e827f313ae531ab79c337d099007 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Thu, 5 Feb 2015 00:26:12 -0500 Subject: [PATCH] Provision the box for Ruby on Rails application --- Vagrantfile | 2 ++ provision/bootstrap.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 provision/bootstrap.sh diff --git a/Vagrantfile b/Vagrantfile index c712a25..49f3d3b 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,4 +12,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider "virtualbox" do |v| v.memory = 1024 end + + config.vm.provision 'shell', path: 'provision/bootstrap.sh' end diff --git a/provision/bootstrap.sh b/provision/bootstrap.sh new file mode 100644 index 0000000..4c6a98b --- /dev/null +++ b/provision/bootstrap.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +readonly RUBY_VERSION=2.2.0 + + +install-pre-requisites () { + apt-get update + + apt-get install wget software-properties-common libxml2 libxml2-dev \ + libxslt1-dev -y +} + +install-ruby () { + apt-add-repository ppa:brightbox/ruby-ng + apt-get update + apt-get install ruby2.2 ruby2.2-dev -y + + gem install bundler +} + +install-farmers_market () { + cd /home/vagrant/app + bundle install +} + +main () { + install-pre-requisites + install-ruby + + if [ -f /home/vagrant/app/Gemfile ]; then + install-farmers_market + fi +} + +main