Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:component/component
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jan 17, 2013
2 parents 991568e + c86f69a commit aa7c059
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
19 changes: 14 additions & 5 deletions bin/component-install
Expand Up @@ -94,7 +94,8 @@ if (local) {
if (!local) { if (!local) {
conf.dependencies = conf.dependencies || {}; conf.dependencies = conf.dependencies || {};
pkgs.forEach(function(pkg){ pkgs.forEach(function(pkg){
conf.dependencies[pkg] = '*'; pkg = parsePackage(pkg);
conf.dependencies[pkg.name] = pkg.version || '*';
}); });
saveConfig(); saveConfig();
} }
Expand All @@ -108,12 +109,20 @@ conf.remotes.push('https://raw.github.com');


console.log(); console.log();
pkgs.forEach(function(pkg){ pkgs.forEach(function(pkg){
var parts = pkg.split('@'); pkg = parsePackage(pkg);
var name = parts.shift(); install(pkg.name, pkg.version || 'master');
var version = parts.shift() || 'master';
install(name, version);
}); });


// parse package identifier

function parsePackage(pkg) {
var parts = pkg.split('@');
return {
name: parts.shift(),
version: parts.shift()
};
}

// map deps to args // map deps to args


function normalize(deps) { function normalize(deps) {
Expand Down
6 changes: 3 additions & 3 deletions test/install.js
Expand Up @@ -40,10 +40,10 @@ describe('component install', function(){
}) })


it('should add the component to ./component.json', function(done){ 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); if (err) return done(err);
var json = require(path.resolve('component.json')); 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(); done();
}) })
}) })
Expand Down Expand Up @@ -126,4 +126,4 @@ describe('component install', function(){
done(); done();
}) })
}) })
}) })

0 comments on commit aa7c059

Please sign in to comment.