How to use the q.nfcall function in q

To help you get started, we’ve selected a few q examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OrgCurrent / Android / node / bower / lib / core / resolvers / FsResolver.js View on Github external
var file;
        var oldPath;
        var newPath;

        // Remove any OS specific files from the files array
        // before checking its length
        files = files.filter(junk.isnt);

        // Only rename if there's only one file and it's not the json
        if (files.length === 1 && !/^(bower|component)\.json$/.test(files[0])) {
            file = files[0];
            this._singleFile = 'index' + path.extname(file);
            oldPath = path.join(this._tempDir, file);
            newPath = path.join(this._tempDir, this._singleFile);

            return Q.nfcall(fs.rename, oldPath, newPath);
        }
    }.bind(this));
};
github aerisweather / aerisjs / node_modules / bower / lib / core / ResolveCache.js View on Github external
}, function () {
                // If it fails to read, invalidate the in memory
                // cache for the source and delete the entry directory
                var sourceId = path.basename(path.dirname(dir));
                that._cache.del(sourceId);

                return Q.nfcall(rimraf, dir);
            });
        });
github GitbookIO / gitbook-convert / importer.js View on Github external
var that = this;

    that.filename = opts.filename;
    that.filetype = path.extname(that.filename);

    // Set working directories
    that.rootDirectory = opts.root || 'export';
    that.assetsDirectory = opts.assetsDirectory || 'assets';

    that._projectName = path.basename(that.filename, that.filetype);
    that._projectFolder = path.join(that.rootDirectory, that._projectName);
    that._assetsFolder = path.join(that._projectFolder, that.assetsDirectory);
    that._summaryFile = path.join(that._projectFolder, 'SUMMARY.md');

    // Check that file exists
    Q.nfcall(fs.stat, that.filename)
    .then(function() {
        // Pick a to-HTML converter
        that.pickConverter(that.filetype.slice(1));

        // Create folders
        that.createDirectories()
        .fin(function() {
        // Actually convert to HTML
            that.convert()
            .then(function() {
                that.extractFootnotes();
                that.parseAndClean();
                that.toMarkdown();
                that.writeFiles();
            });
        });
github leancloud / avoscloud-code-command / bin / run.js View on Github external
}).then(function(runtime) {
    repoUrl = _.findWhere(templates, {name: runtime}).url;
    return Q.nfcall(initAVOSCloudSDK, _appId, false);
  }).then(function(AV) {
    console.log("正在创建项目 ...");
github apache / cordova-lib / src / util / npm-helper.js View on Github external
function loadWithSettings (settings) {
    if (cachedSettings) {
        throw new Error('Trying to initialize npm when settings have not been restored from a previous initialization.');
    }

    return Q.nfcall(npm.load, settings).then(function () {
        for (var prop in settings) {
            var currentValue = npm.config.get(prop);
            var newValue = settings[prop];

            if (currentValue !== newValue) {
                cachedSettingsValues = cachedSettingsValues || {};
                cachedSettings = cachedSettings || [];
                cachedSettings.push(prop);
                if (typeof currentValue !== 'undefined') {
                    cachedSettingsValues[prop] = currentValue;
                }
                npm.config.set(prop, newValue);
            }
        }
    });
}
github DDMAL / cantus / public / cantusdata / frontend / bundle-templates.js View on Github external
function getTemplates(templateDir)
{
    return Q.nfcall(fs.readdir, templateDir).then(function (files)
    {
        return Q.all(files.map(function (file)
        {
            return getTemplateSource(file, templateDir);
        }));
    });
}
github mautic / documentation / lib / utils / fs.js View on Github external
file: function(opt) {
            return Q.nfcall(tmp.file.bind(tmp), opt).get(0);
        },
        dir: function() {
github voorhoede / front-end-guide / lib / release.js View on Github external
function bumpVersion(answers, increment) {
	var command = [
		'npm version',
		answers.semver,
		'-m',
			'"'+ answers.message +'"'
	].join(' ');
	return Q.nfcall(exec, command);
}
/**
github okfn / opendatasurvey / lib / util.js View on Github external
exports.loadAll = function (db, cb) {
  return Q.nfcall(exports.loadConfig)
    .then(function () {
      return Q.nfcall(exports.loadFixedData, db);
    })
    .nodeify(cb)
    ;
};
github vtex / toolbelt / src / lib / meta.js View on Github external
function readAppMetadata() {
  const manifestPath = path.resolve(process.cwd(), 'manifest.json');
  const manifest = Q.nfcall(fs.readFile, manifestPath, 'utf8')['catch'](function() {
    throw new Error('Couldn\'t find manifest.json file.');
  });
  return manifest;
}