Files
bower/lib/commands/help.js
Andre Cruz fd31f247a6 Unit of work implementation.
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.
2012-10-11 13:40:54 +01:00

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]);
};