Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:component/component

  • Loading branch information...
commit aa7c059c4071418a81ea7607845d9af440e43ed8 2 parents 991568e + c86f69a
@tj tj authored
Showing with 17 additions and 8 deletions.
  1. +14 −5 bin/component-install
  2. +3 −3 test/install.js
View
19 bin/component-install
@@ -94,7 +94,8 @@ if (local) {
if (!local) {
conf.dependencies = conf.dependencies || {};
pkgs.forEach(function(pkg){
- conf.dependencies[pkg] = '*';
+ pkg = parsePackage(pkg);
+ conf.dependencies[pkg.name] = pkg.version || '*';
});
saveConfig();
}
@@ -108,12 +109,20 @@ conf.remotes.push('https://raw.github.com');
console.log();
pkgs.forEach(function(pkg){
- var parts = pkg.split('@');
- var name = parts.shift();
- var version = parts.shift() || 'master';
- install(name, version);
+ pkg = parsePackage(pkg);
+ install(pkg.name, pkg.version || 'master');
});
+// parse package identifier
+
+function parsePackage(pkg) {
+ var parts = pkg.split('@');
+ return {
+ name: parts.shift(),
+ version: parts.shift()
+ };
+}
+
// map deps to args
function normalize(deps) {
View
6 test/install.js
@@ -40,10 +40,10 @@ describe('component install', function(){
})
it('should add the component to ./component.json', function(done){
- exec('bin/component install component/emitter', function(err, stdout){
+ exec('bin/component install component/emitter@0.0.4', function(err, stdout){
if (err) return done(err);
var json = require(path.resolve('component.json'));
- json.dependencies.should.have.property('component/emitter', '*');
+ json.dependencies.should.have.property('component/emitter', '0.0.4');
done();
})
})
@@ -126,4 +126,4 @@ describe('component install', function(){
done();
})
})
-})
+})
Please sign in to comment.
Something went wrong with that request. Please try again.