//////////////////////////////////////////////////////////////////////////////// // Compile styles for all blocks in package (from all pathnames) // function concatStyles(pathnames, destination, callback) { fstools.mkdir(path.dirname(destination), function (err) { if (err) { callback(err); return; } async.mapSeries(pathnames, function (pathname, next) { var render = RENDERERS[pathname.extname]; if (!render) { next("Don't know how to compile " + pathname); return; } render(pathname, next); }, function (err, chunks) { if (err) { callback(err); return; } fs.writeFile(destination, chunks.join('\n'), 'utf8', callback); }); }); }
this.dirExists(dir, function(exists) { if(exists) { return cb(null, dir); } fsTools.mkdir(dir, function(err) { if (err) { logger.error('[wdmanager] could not create directory ' + dir, err); console.log('Could not create directory', dir); console.error(err); } cb(err, dir); }); });
fsTools.remove(dir, function(err) { if (err) { logger.error('[html reporter] could not prepare path', dir); console.log('Could not prepare path %s for write', dir); console.error(err); cb(err, dir); return; } fsTools.mkdir(dir, function(err) { if (err) { logger.error('[html reporter] Can\'t create directory ', dir); console.log('Could not create directory', dir); console.error(err); } cb(err, dir); }); });
module.exports = function (tmpdir, sandbox, callback) { var pkgNames = _.keys(sandbox.config.packages), timer = stopwatch(); fstools.mkdir(path.join(tmpdir, 'bundle'), function (err) { if (err) { callback(err); return; } async.forEachSeries(pkgNames, function (pkgName, next) { concatJavascripts(pkgName, tmpdir, sandbox, next); }, function (err) { N.logger.debug('Concatenated dynamic assets ' + timer.elapsed); callback(err); }); }); };
tools.remove(dir, function(err) { if (err) { logger.error('[junit reporter] could not clean path', dir); console.log('Could not prepare path %s for write', dir); console.error(err); //process.exit(1); return; } tools.mkdir(dir, function(err) { if (err) { logger.error('[junit reporter] Can\'t create directory ', dir); console.log('Could not create directory', dir); console.error(err); //process.exit(1); return; } cb(dir); }); });
fstools.remove(httpRoot, function () { fstools.mkdir(httpRoot, function () { Object.keys(paths).forEach(function (key) { fspath = paths[key]; httpPath = pathm.resolve(httpRoot + '/' + key); // make the symlink to the file (function (fspath, httpPath) { // fstools.copy(fspath, httpPath, function (err) { fs.symlink(fspath, httpPath, function (err) { if (err) { logger.debug( i18n('error creating symlink for static path %s to %s. exception: %s', fspath, httpPath, err) ); } else { logger.debug( i18n('created symlink for static path %s to %s', fspath, httpPath) ); } }); }(fspath, httpPath)); }); }); });
// writeClientTree(filename, views[, namespace], callback(err)) -> String // - filename (String): Filename where to write built views tree. // - views (Object): Views map generated by [[Views.collect]]. // - namespace (String): Global object used as container for the tree. // - callback (Function): Executed once everything is done. // // Build client-side `views` tree populator and writes it into the `filename` // creating parent directories if needed. // // // ##### Example // // collect('/path/to/views', function (err, views) { // // ... // writeClientTree('/path/to/client.js', views, function (err) { // // ... syntax sugar is sweet ... // }); // }); // function writeClientTree(filename, tree, namespace, callback) { if (!callback) { callback = namespace; namespace = null; } fstools.mkdir(path.dirname(filename), function (err) { var str; if (err) { callback(err); return; } try { str = buildClientTree(tree, namespace); } catch (err) { callback(err); return; } fs.writeFile(filename, str, 'utf8', callback); }); }
function (next) { fstools.mkdir(path.dirname(filename), next); },