Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable configured build handler with command-line tool #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions bin/buildr.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ cwd = process.cwd()
cson.parseFile "#{cwd}/buildr.cson", (err,config) ->
throw err if err
myBuildr = buildr.createInstance(config)
myBuildr.process (err) ->
throw err if err
myBuildr.process()
12 changes: 7 additions & 5 deletions lib/buildr.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,20 @@ class Buildr
@config = tmp

# Handlers
@config.buildHandler or= (err) =>
@config.buildHandler or= (err) ->
if err
@log 'error', err
throw err
@log 'info', 'Building completed'
@config.successHandler.call(@) if @config.successHandler
@config.rebuildHandler or= (err) =>
@config.successHandler.call(@) if @config.successHandler
@afterBuild = (err) => @config.buildHandler.call(@,err)
@config.rebuildHandler or= (err) ->
if err
@log 'error', err
throw err
@log 'info', 'ReBuilding completed'
@config.successHandler.call(@) if @config.successHandler
@afterRebuild = (err) => @config.rebuildHandler.call(@,err)

# Logger
if @config.log is true then @config.log = 6
Expand Down Expand Up @@ -150,7 +152,7 @@ class Buildr
# Prepare
buildr = @
log = @log
next or= @config.rebuildHandler or @config.buildHandler
next or= @afterRebuild

# Log
log 'debug', 'Setting up watching...'
Expand Down Expand Up @@ -186,7 +188,7 @@ class Buildr

# Prepare
log = @log
next or= @config.buildHandler
next or= @afterBuild

# Log
log 'info', 'Processing started'
Expand Down