Skip to content

Commit

Permalink
Update behaviour of finishing further execution
Browse files Browse the repository at this point in the history
* Break out of the loop instead
* Change order of loading scripts hubot-scripts.json before /scripts
  • Loading branch information
tombell committed Dec 24, 2011
1 parent 90a2d16 commit 74eb585
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,9 @@
v2.1.1
* Update behaviour of finishing further execution of listeners
* Scripts are now loaded in the following order
* Scripts defined in `./hubot-scripts.json` are loaded in order
* Scripts are loaded alphabetically from `/scripts`

v2.1.1
======
* The hwhoops release, finish/done behavior is handled elsewhere
Expand Down
13 changes: 7 additions & 6 deletions bin/hubot
Expand Up @@ -85,12 +85,6 @@ else
robot.enableSlash = Options.enableSlash
robot.alias = Options.alias

scriptsPath = Path.resolve ".", "scripts"
robot.load scriptsPath

scriptsPath = Path.resolve "src", "scripts"
robot.load scriptsPath

scriptsFile = Path.resolve "hubot-scripts.json"
Path.exists scriptsFile, (exists) =>
if exists
Expand All @@ -99,6 +93,13 @@ else
scriptsPath = Path.resolve "node_modules", "hubot-scripts", "src", "scripts"
robot.loadHubotScripts scriptsPath, scripts

scriptsPath = Path.resolve ".", "scripts"
robot.load scriptsPath

scriptsPath = Path.resolve "src", "scripts"
robot.load scriptsPath


robot.run()

# vim:ft=coffee ts=2 sw=2 et :
Expand Down
3 changes: 2 additions & 1 deletion src/robot.coffee
Expand Up @@ -92,6 +92,7 @@ class Robot
for listener in @listeners
try
listener.call message
break if message.done
catch ex
@logger.error "Unable to call the listener: #{ex}"

Expand Down Expand Up @@ -301,7 +302,7 @@ class Listener
# Returns nothing.
call: (message) ->
if match = @matcher message
@callback new @robot.Response(@robot, message, match) unless message.done
@callback new @robot.Response(@robot, message, match)

class TextListener extends Listener
# TextListeners receive every message from the chat source and decide if they want
Expand Down

0 comments on commit 74eb585

Please sign in to comment.