Comparing version
var repeater = require('../repeater'); | ||
var nodegit = require('nodegit'); | ||
var nodegitOptions = require('../nodegitoptions'); | ||
module.exports = function(args){ | ||
var branch = args[3]; | ||
var command = function(moduleName, moduleRepo, done){ | ||
var command = function(){ | ||
}; | ||
repeater(command, function(){ | ||
console.log('commands completed'); | ||
}) | ||
}; |
@@ -0,5 +1,3 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var rmdir = require('rimraf'); | ||
var NodeGit = require('nodegit'); | ||
var clone = NodeGit.Clone.clone; | ||
var repeater = require('../repeater'); | ||
@@ -13,26 +11,27 @@ var nodegitOptions = require('../nodegitoptions'); | ||
//[TODO] check args for different module folder | ||
var modulesPresent = ls(process.cwd()).indexOf(modulesDir) > -1; | ||
if(!modulesPresent){ | ||
mkdir(modulesDir); | ||
} | ||
var installedModules = ls(modulesDir); | ||
var command = function(moduleName, moduleRepo, done){ | ||
console.info( ('cloning ' + moduleName + ' from ' + moduleRepo).action ); | ||
var options = nodegitOptions.get(); | ||
clone(moduleRepo, 'modules/' + moduleName, options).then(function(){ | ||
console.info( (moduleName + ' has been cloned in folder ' + modulesDir).success ); | ||
done(); | ||
}, function(err){ | ||
console.error(err); | ||
if(installedModules.indexOf(moduleName) > -1){ | ||
console.info( (moduleName + ' is already present in folder ' + modulesDir).warning ); | ||
return done(); | ||
} | ||
if(exec('git clone ' + moduleRepo + ' modules/' + moduleName).code !== 0){ | ||
console.error('there was a fatal error cloning this repository'.error); | ||
process.exit(1); | ||
}); | ||
} | ||
console.info( (moduleName + ' has been cloned in folder ' + modulesDir).success ); | ||
done(); | ||
}; | ||
rmdir( path.join(process.cwd(), modulesDir), function(err){ | ||
if(err){ | ||
return console.log(err.error); | ||
process.exit(1); | ||
} | ||
repeater(command, function(){ | ||
console.log('cox has successfully run the task install'.success); | ||
npmCommand('install'); | ||
}); | ||
repeater(command, function(){ | ||
console.log('cox has successfully run the task install'.success); | ||
npmCommand('install'); | ||
}); | ||
}; |
var path = require('path'); | ||
var shelljs = require('shelljs/global'); | ||
var repeater = require('../repeater'); | ||
@@ -9,5 +8,2 @@ var _ = require('lodash'); | ||
console.log('subcommand', subCommand); | ||
console.info('starting task npm ' + subCommand) | ||
var command = function(moduleName, moduleRepo, done){ | ||
@@ -25,4 +21,4 @@ console.info(('cox is running npm ' + subCommand + ' for the ' + moduleName + ' module').action ); | ||
if (exec('npm ' + subCommand).code !== 0) { | ||
console.error( ('Error: npm install didn\'t run for ' + moduleName).error); | ||
process.exit(1); | ||
console.error( ('Error: npm install didn\'t run for ' + moduleName).error); | ||
process.exit(1); | ||
} | ||
@@ -34,5 +30,12 @@ console.info( ('successfully ran npm ' + subCommand + ' on module ' + moduleName).success); | ||
console.info('starting task npm ' + subCommand); | ||
repeater(command, function(){ | ||
//run for the command in the main project folder | ||
console.info( ('running npm ' + subCommand + ' in ' + process.cwd() ).action); | ||
if (exec('npm ' + subCommand).code !== 0) { | ||
console.error( ('Error: npm install didn\'t run for ' + moduleName).error); | ||
process.exit(1); | ||
} | ||
console.log( ('cox has successfully run the task npm ' + subCommand).success); | ||
}); | ||
}; |
@@ -0,1 +1,2 @@ | ||
var shelljs = require('shelljs/global'); | ||
var path = require('path'); | ||
@@ -2,0 +3,0 @@ var parseArgs = require('minimist'); |
{ | ||
"name": "cox", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"preferGlobal": "true", | ||
@@ -30,6 +30,4 @@ "description": "git commander for multi-repositories", | ||
"minimist": "^1.1.0", | ||
"nodegit": "^0.2.4", | ||
"rimraf": "^2.2.8", | ||
"shelljs": "^0.3.0" | ||
} | ||
} |
5516
4.73%4
-33.33%5
25%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed