Skip to content

Instantly share code, notes, and snippets.

@markmoser
Last active February 11, 2024 10:22
Show Gist options
  • Save markmoser/f668ed9fb7fd63c5c0453cd39fcb9530 to your computer and use it in GitHub Desktop.
Save markmoser/f668ed9fb7fd63c5c0453cd39fcb9530 to your computer and use it in GitHub Desktop.
A gollum workflow

Gollum Guard

Gollumn requires changes to be commited before the server will pick them up for display.

This is a simple workflow that uses guard livereload to continually amend a sessions commit while you work with local files in your gollum wiki. You can use this with any guard task, really, but I like live reload to refresh my broswer.

For live reload to work, you need the extension installed in your browser

Setup Guard

  • set up your gollum wiki
  • gem install guard guard-livereload
  • create guardfile with the provided config
  • touch .guardstamp
  • commit Guardfile and .guardstamp

Start an edit session

  • start the gollum server (not live-preview)
  • start guard
  • edit wiki

Guardfile

# Gollum Guard
#
# - watches for *.md changes
# - amends to the sessions commit
# - livereload browser

guard 'livereload' do
  watch(/.+\.md$/) do |m|
    system %Q(git add -A)
    system %Q(git commit --amend -m "$(cat .guardstamp)")
    m[0]
  end

  # start the sessions git commit
  callback(:start_begin) do
    system %Q(echo $(date "+session: %Y-%m-%d %H:%M") > .guardstamp)
    system %Q(git add .guardstamp)
    system %Q(git commit -m "$(cat .guardstamp)")
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment