Skip to content

Instantly share code, notes, and snippets.

@tatey
Created August 18, 2010 11:59
Show Gist options
  • Select an option

  • Save tatey/534462 to your computer and use it in GitHub Desktop.

Select an option

Save tatey/534462 to your computer and use it in GitHub Desktop.
# Revision 3:
#
# Just define the method, don't declare which sequences
# this hook will be executed in.
#
# More meaningful sequence names, following rails naming conventions
# for familiarty.
#
# pre -> before_process
# in -> before_render
# post -> after_process
require 'growl'
module Jekyll
class GrowlHook < Hook
def before_process
Growl.notify 'Building...', :title => 'Jekyll'
end
def after_process
Growl.notify 'Build complete', :title => 'Jekyll'
end
end
end
# Revision 2:
#
# Sequence becomes the method, instead of passing it in
require 'growl'
module Jekyll
class GrowlHook < Hook
sequences :pre, :post
def pre(site)
Growl.notify 'Building...', :title => 'Jekyll'
end
def post(site)
Growl.notify 'Build complete', :title => 'Jekyll'
end
end
end
# Revision 1
require 'growl'
module Jekyll
class GrowlHook < Hook
sequences :pre, :post
def run(site, sequence)
case sequence
when :pre
Growl.notify 'Building...', :title => 'Jekyll'
when :post
Growl.notify 'Build complete', :title => 'Jekyll'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment