forked from ember-cli/ember-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restart server and trigger LR on server file change
- Loading branch information
Chris Santero
committed
Oct 16, 2014
1 parent
8e6b9bc
commit 22ee045
Showing
23 changed files
with
877 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
var sane = require('sane'); | ||
var Task = require('./task'); | ||
|
||
module.exports = Task.extend({ | ||
verbose: true, | ||
|
||
init: function() { | ||
this.watcher = this.watcher || new sane.Watcher(this.watchedDir, { | ||
verbose: this.verbose, | ||
poll: this.polling() | ||
}); | ||
|
||
this.watcher.on('change', this.didChange.bind(this)); | ||
this.watcher.on('add', this.didAdd.bind(this)); | ||
this.watcher.on('delete', this.didDelete.bind(this)); | ||
}, | ||
|
||
didChange: function (filepath) { | ||
this.ui.writeLine('Server file changed: ' + filepath); | ||
|
||
this.analytics.track({ | ||
name: 'server file change', | ||
description: 'File changed: "' + filepath + '"' | ||
}); | ||
}, | ||
|
||
didAdd: function (filepath) { | ||
this.ui.writeLine('Server file added: ' + filepath); | ||
|
||
this.analytics.track({ | ||
name: 'server file addition', | ||
description: 'File added: "' + filepath + '"' | ||
}); | ||
}, | ||
|
||
didDelete: function (filepath) { | ||
this.ui.writeLine('Server file deleted: ' + filepath); | ||
|
||
this.analytics.track({ | ||
name: 'server file deletion', | ||
description: 'File deleted: "' + filepath + '"' | ||
}); | ||
}, | ||
|
||
then: function() { | ||
return this.watcher.then.apply(this.watcher, arguments); | ||
}, | ||
|
||
on: function() { | ||
this.watcher.on.apply(this.watcher, arguments); | ||
}, | ||
|
||
off: function() { | ||
this.watcher.off.apply(this.watcher, arguments); | ||
}, | ||
|
||
polling: function () { | ||
return this.options && this.options.watcher === 'polling'; | ||
} | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.