mirror of
https://github.com/bower/bower.git
synced 2026-01-23 21:27:59 -05:00
A unit of work is a simple storage with write lock/unlock. The manager/package now share a unit of work instance. The unit of work is used to prevent shared dependencies from being cloned/copied "at the same time" fixing issue #81. The prune and version resolving algorithm was also not correct. It now resolves versions correctly, fixing issue #57. - Fix I/O errors caused by copying/clone repos simultaneously to the same dest. - Optimize the clone/copy step by avoiding it if the last resolved resource is the same. - Fix failing test (at least on my windows machine) - Add some more tests - Fix CS.
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
// ==========================================
|
|
// BOWER: Help API
|
|
// ==========================================
|
|
// Copyright 2012 Twitter, Inc
|
|
// Licensed under The MIT License
|
|
// http://opensource.org/licenses/MIT
|
|
// ==========================================
|
|
|
|
var events = require('events');
|
|
var hogan = require('hogan.js');
|
|
var nopt = require('nopt');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var _ = require('lodash');
|
|
|
|
var template = require('../util/template');
|
|
var config = require('../core/config');
|
|
|
|
module.exports = function (name) {
|
|
var context = {};
|
|
var emitter = new events.EventEmitter;
|
|
var commands = require('../commands');
|
|
var templateName = name ? 'help-' + name : 'help';
|
|
|
|
if (!name) context = { commands: Object.keys(commands).join(', ') };
|
|
_.extend(context, config);
|
|
template(templateName, context).on('data', emitter.emit.bind(emitter, 'end'));
|
|
return emitter;
|
|
};
|
|
|
|
module.exports.line = function (argv) {
|
|
var options = nopt({}, {}, argv);
|
|
var paths = options.argv.remain.slice(1);
|
|
return module.exports(paths[0]);
|
|
}; |