Comparing version 0.0.9 to 0.1.0
{ | ||
"name": "mounter", | ||
"version": "0.0.9", | ||
"version": "0.1.0", | ||
"main": "src/main.js", | ||
@@ -5,0 +5,0 @@ "description": "Install your subprojects from git endpoint into your project", |
@@ -0,0 +0,0 @@ Mounter |
@@ -0,0 +0,0 @@ var exec = require('child_process').exec, |
@@ -0,0 +0,0 @@ var exec = require('child_process').exec, |
@@ -0,0 +0,0 @@ var version = require('../utils/version'), |
@@ -0,0 +0,0 @@ var async = require('async'), |
@@ -7,6 +7,6 @@ var cp = require('child_process').exec, | ||
var commands = { | ||
lsRemote: 'git ls-remote --{{action}} {{repository}}', | ||
lsRemote: 'git ls-remote --tags --heads {{repository}}', | ||
clone: 'git clone {{repository}} {{path}}', | ||
pull: 'cd {{path}} && git checkout master && git pull', | ||
checkout: 'cd {{path}} && git checkout -B {{version}} && git reset --hard {{version}}' | ||
checkout: 'cd {{path}} && git checkout -B {{version}} && git pull origin {{version}}' | ||
}; | ||
@@ -39,3 +39,3 @@ | ||
function clean(str) { | ||
return str.replace(/(refs\/tags\/)(.*)(\^{})/, '$2'); | ||
return str.replace(/refs\/(tags|heads)\/(.*)/, '$2'); | ||
} | ||
@@ -51,4 +51,7 @@ | ||
list = stdout ? stdout.match(/refs\/tags\/(.*)/gi) : []; | ||
list = stdout ? stdout.match(/refs\/(tags|heads)\/(.*)/gi) : []; | ||
list = list.map(clean); | ||
console.log('!!!!', list); | ||
complete(null, list); | ||
@@ -58,5 +61,3 @@ } | ||
exec(commands.lsRemote | ||
.replace('{{repository}}', this.config.repository) | ||
.replace('{{action}}', 'tags'), parse); | ||
.replace('{{repository}}', this.config.repository), parse); | ||
}; | ||
@@ -77,2 +78,3 @@ | ||
Git.prototype.update = function(base, tag, complete) { | ||
console.log(fs.existsSync(base) ? 'pull' : 'clone'); | ||
this[fs.existsSync(base) ? 'pull' : 'clone'](base, curry(this.checkout, base, tag, complete)); | ||
@@ -79,0 +81,0 @@ } |
@@ -25,6 +25,7 @@ var url = require('url'); | ||
if (uri.protocol.length === 2 && uri.protocol[1]) { | ||
if (uri.protocol.length === 2 && ['https', 'http'].indexOf(uri.protocol[1]) !== -1) { | ||
repository = uri.protocol[1].replace(/^-/, '') + '://' + repository; | ||
} | ||
} catch(e) { | ||
@@ -41,6 +42,6 @@ throw new Error('Incorrect git endpoint: ' + component.endpoint); | ||
return component; | ||
} | ||
}; | ||
exports.load = function(path) { | ||
return treat(require(path)); | ||
} | ||
}; |
@@ -0,0 +0,0 @@ module.exports = function() { |
@@ -1,2 +0,2 @@ | ||
var semver = require('semver') | ||
var semver = require('semver'); | ||
@@ -14,6 +14,6 @@ exports.get = function(expr, list) { | ||
if (ret) { | ||
list.forEach(function(version) { | ||
console.log('!!', ret, version); | ||
ret = version.indexOf(ret) !== -1 ? version : ret; | ||
@@ -23,4 +23,8 @@ }); | ||
} | ||
if (!ret && !semver.valid(expr)) { | ||
return expr; | ||
} | ||
return ret || '*'; | ||
} | ||
}; |
@@ -0,0 +0,0 @@ exports['config should have correct endpoint for private git endpoint'] = function(test) { |
@@ -0,0 +0,0 @@ { |
@@ -44,2 +44,10 @@ exports['module should resolve strict version number'] = function(test) { | ||
test.done(); | ||
} | ||
exports['modules should resolve branch name'] = function(test) { | ||
var version = require('../src/utils/version'), | ||
list = ['chat-231', 'chat-234']; | ||
test.ok(version.get('chat-231', list) === 'chat-231', 'return branch'); | ||
test.done(); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
278
13849