Created
August 18, 2010 11:59
-
-
Save tatey/534462 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # 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