Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var config = req.body
, asyncOps = [
wsServer.stop.bind(wsServer)
]
if (connections.manager)
asyncOps.push(connections.manager.stop.bind(connections.manager))
// See https://github.com/websockets/ws/pull/605
if (wsServer._wsServer) {
wsServer._wsServer._server.removeAllListeners('upgrade')
wsServer._wsServer._server.removeAllListeners('error')
wsServer._wsServer._server.removeAllListeners('listening')
}
if (config.store) asyncOps.push(rimraf.bind(rimraf, config.store))
async.series(asyncOps, (err) => {
if (err) throw err
setTimeout(() => res.end(), 10)
})
})
function updateRemote(name, files, callback) {
var self = this;
var remoteDir = path.join(self.remotesDir, name);
series([
rimraf.bind(null, path.join(remoteDir, 'idl')),
createFixtures.bind(null, remoteDir, files),
git('add --all .', {
cwd: remoteDir
}),
git('commit -am "update files"', {
cwd: remoteDir
})
], callback);
};
describe('gulp.dest()', function() {
beforeEach(rimraf.bind(null, outpath));
afterEach(rimraf.bind(null, outpath));
it('should return a stream', function(done) {
var stream = gulp.dest(path.join(__dirname, './fixtures/'));
expect(stream).toExist();
expect(stream.on).toExist();
done();
});
it('should return a output stream that writes files', function(done) {
var instream = gulp.src('./fixtures/**/*.txt', { cwd: __dirname });
var outstream = gulp.dest(outpath);
instream.pipe(outstream);
outstream.on('error', done);
outstream.on('data', function(file) {
describe('gulp.watch()', function() {
beforeEach(rimraf.bind(null, outpath));
beforeEach(mkdirp.bind(null, outpath));
afterEach(rimraf.bind(null, outpath));
it('should call the function when file changes: no options', function(done) {
var tempFile = path.join(outpath, 'watch-func.txt');
createTempFile(tempFile);
var watcher = gulp.watch('watch-func.txt', { cwd: outpath }, function(cb) {
watcher.close();
cb();
done();
});
updateTempFile(tempFile);
});
it('should fetch master for * when no tags available', co(function* () {
yield rimraf.bind(null, components);
var tree = yield* resolve({
dependencies: {
'timaschew/component-asterisk-no-tags': '*'
}
}, {
install: true,
})
var out = join(components, 'timaschew', 'component-asterisk-no-tags', 'master')
fs.statSync(join(out, 'index.js'))
var json = require(join(out, 'component.json'))
json.version.should.eql('0.0.2')
}))
, rmdb = function (engine, db, location, callback) {
engine.closeDb(db, rimraf.bind(null, location, callback))
}
var tasks = excessFiles.map(function (file) {
var filePath = path.join(dir, file);
console.log('removing', filePath);
return rimraf.bind(null, filePath);
});
function setup(cb) {
async.series([
rimraf.bind(null, conf.selenium.path),
rimraf.bind(null, path.dirname(conf.chromeDriver.path)),
mkdirp.bind(null, path.dirname(conf.selenium.path)),
mkdirp.bind(null, path.dirname(conf.chromeDriver.path))
], cb);
}
return gulp.src('*.js')
.pipe($.jscs(pkg.jscsConfig))
.pipe($.jshint())
.pipe($.jshint.reporter(stylish))
.pipe($.jshint.reporter('fail'));
});
gulp.task('lint:json', function() {
return gulp.src('*.json')
.pipe($.jsonlint())
.pipe($.jsonlint.reporter());
});
gulp.task('lint', ['lint:scripts', 'lint:json']);
gulp.task('clean', rimraf.bind(null, 'dist'));
gulp.task('build', ['lint'], function() {
return gulp.src(['src/*.coffee'])
.pipe($.coffeelint())
.pipe($.coffeelint.reporter())
.pipe($.coffee())
.pipe($.rename(pkg.main))
.pipe($.size({showFiles: true}))
.pipe(gulp.dest(''));
});
gulp.task('watch', function() {
gulp.watch('src/*.coffee', ['coffee']);
gulp.watch(['*.{js,json}', '.jshintrc'], ['lint']);
});
function setup(cb) {
async.series([
rimraf.bind(null, conf.selenium.path),
rimraf.bind(null, path.dirname(conf.chromeDriver.path)),
mkdirp.bind(null, path.dirname(conf.selenium.path)),
mkdirp.bind(null, path.dirname(conf.chromeDriver.path))
], cb);
}