Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

install multi modules with cli

  • Loading branch information...
commit 275fae3feca0cb7dfc7cd6bd1ede62c0badd0a90 1 parent c9c62de
@lepture lepture authored
Showing with 10 additions and 9 deletions.
  1. +1 −1  Makefile
  2. +6 −5 bin/spm-install
  3. +3 −3 lib/install.js
View
2  Makefile
@@ -10,7 +10,7 @@ test: clean
@node_modules/.bin/mocha --reporter ${reporter} ${specs}
jsfiles := $(shell find ./ -name '*.js' ! -path "*utils/tar.js" ! -path "*node_modules/*" ! -path "*cases/*" ! -path "*data/*" ! -path "*scripts/*");
-binfiles := $(shell find ./bin/*);
+binfiles := $(shell find ./bin/* ! -path "*.iml");
lint:
@node_modules/.bin/jshint ${jsfiles}
@node_modules/.bin/jshint ${binfiles}
View
11 bin/spm-install
@@ -4,10 +4,11 @@ var commander = require('commander');
require('colorful').colorful();
var spm = require('..');
-commander.usage('[options] family/name[@version] [destination]');
+commander.usage('[options] family/name[@version]');
commander
- .option('-s, --source <source>', 'default value will be the first source')
+ .option('-s, --source <source>', 'the source repo name')
+ .option('-d, --destination <dest>', 'the destination, default: sea-modules')
.option('-f, --force', 'force to download a unstable module')
.option('-v, --verbose', 'show more logs')
.option('-q, --quiet', 'show less logs')
@@ -20,7 +21,7 @@ commander.on('--help', function() {
console.log(' ' + 'Examples:'.to.bold.blue);
console.log();
console.log(' $ ' + 'spm install'.to.magenta.color + ' jquery');
- console.log(' $ ' + 'spm install'.to.magenta.color + ' jquery/jquery assets');
+ console.log(' $ ' + 'spm install'.to.magenta.color + ' jquery/jquery arale/class');
console.log(' $ ' + 'spm install'.to.magenta.color + ' jquery/jquery' +
'@1.8.2'.to.cyan.color);
console.log();
@@ -34,8 +35,8 @@ spm.log.config(commander);
// run install
spm.install({
source: commander.source,
+ destination: commander.destination,
force: commander.force,
parallel: commander.parallel,
- query: commander.args[0],
- dest: commander.args[1]
+ query: commander.args
});
View
6 lib/install.js
@@ -31,13 +31,13 @@ var store = {
exports = module.exports = function(options) {
store.parallel = options.parallel || store.parallel;
- store.dest = options.dest || store.dest;
+ store.dest = options.destination || store.dest;
store.source = options.source;
store.force = options.force;
var packages;
- if (options.query && options.query.charAt(0) !== '.') {
- packages = [options.query];
+ if (options.query.length && options.query[0].charAt(0) !== '.') {
+ packages = options.query;
} else {
packages = parseDependencies('package.json');
}
Please sign in to comment.
Something went wrong with that request. Please try again.