Last active
December 27, 2015 16:19
-
-
Save patrickwelker/7353822 to your computer and use it in GitHub Desktop.
Script for starting a gollum wiki (from anywhere) in the background when developing with RVM.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Load RVM into a shell session *as a function* | |
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then | |
# First try to load from a user install | |
source "$HOME/.rvm/scripts/rvm" | |
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then | |
# Then try to load from a root install | |
source "/usr/local/rvm/scripts/rvm" | |
else | |
printf "ERROR: An RVM installation was not found.\n" | |
fi | |
# Open project folder | |
cd "$HOME"/wiki/; | |
# In case loading RVM isn't enough (c.f. in a project specific gemset) uncomment the next line | |
# rvm use 1.9.3@wiki | |
# Start gollum on port 61001 and run it in the background | |
screen -dmS wiki "$HOME"/.rvm/gems/ruby-1.9.3-p448@wiki/bin/gollum --port 61001 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starting Gollum Shell Script
Script for starting a gollum wiki (from anywhere) in the background when developing with RVM.
The first part of the script checks if the RVM-Ruby environment is used instead of your login shell (see https://rvm.io/workflow/scripting/).
The second part is starting the wiki in the background with
screen
.About
screen
screen -ls
screen -r wiki
⌃A
+D
⌃C
Notes
I tried to set the path to the script in a variable like in this excellent article Personal Wiki using GitHub and Gollum on OS X.
But the example code
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
didn't work for me. The above solution is running smoothly now with my setup.