Browse files

added a notify event and extracted growl into its own plugin

  • Loading branch information...
1 parent e64c8bf commit c545e316b63bef93ef5459319a15f299e96e1169 @Delapouite Delapouite committed Aug 19, 2013
Showing with 6 additions and 42 deletions.
  1. +6 −39 src/lib/docpad.coffee
  2. +0 −1 src/lib/testers.coffee
  3. +0 −1 src/test/actions-test.coffee
  4. +0 −1 src/test/api-test.coffee
View
45 src/lib/docpad.coffee
@@ -108,26 +108,6 @@ class DocPad extends EventEmitterGrouped
# ---------------------------------
- # Instances
-
- # Growl
- growlInstance: null
- getGrowlInstance: ->
- # Create
- if @growlInstance? is false
- if @getConfig().growl
- try
- @growlInstance = require('growl')
- catch err
- @growlInstance = false
- else
- @growlInstance = false
-
- # Return
- return @growlInstance
-
-
- # ---------------------------------
# DocPad
# DocPad's version number
@@ -213,6 +193,7 @@ class DocPad extends EventEmitterGrouped
'serverBefore'
'serverExtend'
'serverAfter'
+ 'notify'
]
getEvents: ->
@events
@@ -895,14 +876,6 @@ class DocPad extends EventEmitterGrouped
# Which level of logging should we actually output
logLevel: (if ('-d' in process.argv) then 7 else 6)
- # Logger
- # A caterpillar instance if we already have one
- logger: null
-
- # Growl
- # Whether or not to send notifications to growl when we have them
- growl: true
-
# Catch uncaught exceptions
catchExceptions: true
@@ -2035,7 +2008,6 @@ class DocPad extends EventEmitterGrouped
@
-
# =================================
# Logging
@@ -2125,19 +2097,14 @@ class DocPad extends EventEmitterGrouped
# Chain
@
- # Perform a growl notification
- notify: (message,opts) =>
+ # Send a notify event to plugins (like growl)
+ notify: (message,options={}) =>
# Prepare
docpad = @
- # Check
- growl = @getGrowlInstance()
- if growl
- # Apply
- try
- growl(message,opts)
- catch err
- # ignore
+ # Emit
+ docpad.emitSerial 'notify', {message,options}, (err) ->
+ docpad.error(err) if err
# Chain
@
View
1 src/lib/testers.coffee
@@ -33,7 +33,6 @@ class PluginTester
# DocPad Config
docpadConfig:
port: null
- growl: false
logLevel: (if ('-d' in process.argv) then 7 else 5)
rootPath: null
outPath: null
View
1 src/test/actions-test.coffee
@@ -26,7 +26,6 @@ testWait = 1000*60*5 # five minutes
# Configure DocPad
docpadConfig =
- growl: false
port: port
rootPath: rootPath
logLevel: if (process.env.TRAVIS_NODE_VERSION? or '-d' in process.argv) then 7 else 5
View
1 src/test/api-test.coffee
@@ -15,7 +15,6 @@ cliPath = pathUtil.join(docpadPath, 'bin', 'docpad')
# Configure DocPad
docpadConfig =
- growl: false
port: 9780
rootPath: rootPath
logLevel: if (process.env.TRAVIS_NODE_VERSION? or '-d' in process.argv) then 7 else 5

0 comments on commit c545e31

Please sign in to comment.