Skip to content

Instantly share code, notes, and snippets.

@pgib
Last active December 24, 2015 15:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgib/6819283 to your computer and use it in GitHub Desktop.
Save pgib/6819283 to your computer and use it in GitHub Desktop.
Throw this in your Jekyll `_plugins/ext.rb` or into a separate file.

Terminal Notifier for Jekyll site builds

This Jekyll monkey patch triggers a Mac OS X Notification Center notification using the terminal-notifier gem.

If you start jekyll without bundle, first install the necessary gems:

gem install terminal-notifier
gem install terminal-notifier-guard

If you start jekyll with bundle exec (ie. bundle exec jekyll serve --watch, ensure the above two gems are in your Gemfile:

gem 'terminal-notifier'
gem 'terminal-notifier-guard'

Happy Jekylling!

# This monkey patch triggers a Mac OS X Notification Center notification using
# the terminal-notifier gem.
#
# If you start jekyll without bundle, first install the necessary gems:
#
# gem install terminal-notifier
# gem install terminal-notifier-guard
#
# If you start jekyll with bundle exec, ensure the above two gems are in
# your Gemfile:
#
# gem 'terminal-notifier'
# gem 'terminal-notifier-guard'
module Jekyll
class Site
alias old_write write
def write
old_write
if `uname`.strip == "Darwin"
`terminal-notifier-success -title "#{config['title'] ? config['title'] : 'Jekyll Site'}" -message "Jekyll generate complete."`
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment