src/plugman/install.js
function possiblyFetch (id, plugins_dir, options) {
    var parsedSpec = pluginSpec.parse(id);

    // if plugin is a relative path, check if it already exists
    var plugin_src_dir = isAbsolutePath(id) ? id : path.join(plugins_dir, parsedSpec.id);

    // Check that the plugin has already been fetched.
    if (fs.existsSync(plugin_src_dir)) {
        return Promise.resolve(plugin_src_dir);
    }

    var opts = underscore.extend({}, options, {
        client: 'plugman'
    });
    // TODO: without runtime require below, we have a circular dependency.
    return require('./plugman').fetch(id, plugins_dir, opts);
}
function possiblyFetch (id, plugins_dir, options) {
    var parsedSpec = pluginSpec.parse(id);

    // if plugin is a relative path, check if it already exists
    var plugin_src_dir = isAbsolutePath(id) ? id : path.join(plugins_dir, parsedSpec.id);

    // Check that the plugin has already been fetched.
    if (fs.existsSync(plugin_src_dir)) {
        return Promise.resolve(plugin_src_dir);
    }

    var opts = underscore.extend({}, options, {
        client: 'plugman'
    });
    // TODO: without runtime require below, we have a circular dependency.
    return require('./plugman').fetch(id, plugins_dir, opts);
}
possible options: subdir, cli_variables, www_dir, git_ref, is_top_level Returns a promise.