Skip to content

Instantly share code, notes, and snippets.

@gbp
Created July 20, 2020 14:34
Show Gist options
  • Save gbp/6aa433ef88daef780b63a5d9d0add96d to your computer and use it in GitHub Desktop.
Save gbp/6aa433ef88daef780b63a5d9d0add96d to your computer and use it in GitHub Desktop.
commit 76abf77a20c041a62437756ef0d0d92ce83256e7
Author: Graeme Porteous <[email protected]>
Date: Mon Apr 27 16:46:47 2020 +0100
Vagrant with rbenv
diff --git a/commonlib b/commonlib
index e29f27ddec..d7fe4bffb1 160000
--- a/commonlib
+++ b/commonlib
@@ -1 +1 @@
-Subproject commit e29f27ddec0eccb5278aaa46be05892a91cda939
+Subproject commit d7fe4bffb132ad54ebc1c1bac547b9c590ddda45
diff --git a/script/install-as-user b/script/install-as-user
index 00916b7cc9..131643a182 100755
--- a/script/install-as-user
+++ b/script/install-as-user
@@ -45,8 +45,17 @@ LINK_DESTINATION="$HOME/alaveteli"
ln -sfn "$REPOSITORY" $LINK_DESTINATION
cd "$REPOSITORY"
+RBENV="$HOME/.rbenv"
BASHRC="$HOME/.bashrc"
+# Install rbenv ruby-build
+if ! [ -d ~/.rbenv ]; then
+ git clone https://github.com/rbenv/rbenv.git "$RBENV"
+ cd $"RBENV" && src/configure && make -C src
+ mkdir -p "$RBENV/plugins"
+ git clone https://github.com/rbenv/ruby-build.git "$RBENV/plugins/ruby-build"
+fi
+
BASHRC_GEM_COMMENT="Set up local gem directory for Alaveteli"
BASHRC_START="# START $BASHRC_GEM_COMMENT"
BASHRC_END="# END $BASHRC_GEM_COMMENT"
@@ -63,7 +72,8 @@ TMP_BASHRC="$(mktemp "$BASHRC.XXXXXXX")"
cat >>$TMP_BASHRC <<EOBRC
$BASHRC_START
-export PATH="\$HOME/.gem/ruby/$RUBY_VERSION/bin:\$PATH"
+export PATH="$RBENV/bin:\$HOME/.gem/ruby/$RUBY_VERSION/bin:\$PATH"
+eval "\$(rbenv init -)"
$BASHRC_END
EOBRC
@@ -75,6 +85,12 @@ source "$BASHRC"
# Speed up the installation of gems:
echo 'gem: --no-ri --no-rdoc' > "$HOME/.gemrc"
+# Compile and install Ruby 2.4, set as default
+rbenv install -s 2.4.10
+rbenv global 2.4.10
+
+gem install bundler -v 1.17.3
+
# Write sensible values into the config file:
function random_alphanumerics() {
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index fc35ba2794..b0adbaa066 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -93,6 +93,9 @@ apt-get -y update
echo 'Setting hostname...'
hostnamectl set-hostname $HOST
+# required so rbenv can compile Ruby 2.4
+apt-get install -y libreadline-dev
+
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
install_nginx
add_website_to_nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment