From e4dec2bc26ef55c550c91c329f382bc6f087284b Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 1 Apr 2018 09:51:51 +0200 Subject: Fix bootstrapping vagrant environment. - just start postgresql instead of restarting everything after install. - update setup script to install required ruby version and deps if not installed. - seed database when running the dev:setup rake task. --- lib/tasks/dev_setup.rake | 2 +- script/setup | 11 ++++++++++- vagrant/bootstrap.sh | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/tasks/dev_setup.rake b/lib/tasks/dev_setup.rake index 73e0b01..7042710 100644 --- a/lib/tasks/dev_setup.rake +++ b/lib/tasks/dev_setup.rake @@ -10,5 +10,5 @@ namespace :dev do end desc "Setup local environment for development." - task :setup => [ 'config_refinery', 'config_db', 'db:setup' ] + task :setup => [ 'config_refinery', 'config_db', 'db:setup', 'db:seed' ] end diff --git a/script/setup b/script/setup index 7823f40..9ddd50b 100755 --- a/script/setup +++ b/script/setup @@ -1,4 +1,13 @@ -#!/bin/bash +#!/usr/bin/env bash +ruby_status=$(rbenv version |& awk '{ printf $4 " " $5 " " $6 }'|sed -r 's/[ ]+$//') +echo \"${ruby_status}\" +if [[ "${ruby_status}" == "is not installed" ]] +then + rbenv install $(cat .ruby-version) + gem install bundler + bundle config build.sqlite3 --with-sqlite3-dir=/usr/local +fi + bundle install --without=production if [ $? ]; then diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh index 22e8f3c..8b3fad2 100644 --- a/vagrant/bootstrap.sh +++ b/vagrant/bootstrap.sh @@ -7,4 +7,4 @@ echo 'eval "$(rbenv init -)"' >> /home/vagrant/.bash_profile chsh -s /usr/local/bin/bash vagrant service postgresql initdb -service -R +service postgresql start -- cgit v1.2.3