Socket
Socket
Sign inDemoInstall

cox

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cox - npm Package Compare versions

Comparing version 0.5.0 to 1.0.0

help.txt

18

lib/commands/checkout.js

@@ -12,18 +12,4 @@ var path = require('path');

var command = function(moduleName, moduleRepo, done){
var isModule = !!moduleName;
moduleName = moduleName || 'main';
var moduleLocation = isModule? path.join('modules/', moduleName) : '.';
console.info(('checking out branch ' + branch + ' for module: ' + moduleName).action);
isModule && cd('modules/'+moduleName);
var errors = shell.run('git checkout ' + (isNew? '-b ' : '') + branch);
if(errors.legth > 0){
console.error('something nasty went wrong here'.error);
process.exit(1);
}
isModule && cd('../..');
shell.run('git checkout ' + (isNew? '-b ' : '') + branch);
console.info((moduleName + ' is now working with branch ' + branch).success);

@@ -33,3 +19,3 @@ done();

repeater(command).then(deferred.resolve);
repeater(command, 'goToModuleDir').then(deferred.resolve);

@@ -36,0 +22,0 @@ return deferred.promise;

@@ -10,20 +10,10 @@ var path = require('path');

var command = function(moduleName, moduleRepo, done){
var isModule = !!moduleName;
moduleName = moduleName || 'main';
var moduleLocation = isModule? path.join('modules/', moduleName) : '.';
console.info(('Diff of module: ' + moduleName).success);
isModule && cd('modules/'+moduleName);
var response = exec('git diff');
isModule && cd('../..');
done();
};
repeater(command).then(deferred.resolve);
repeater(command, 'goToModuleDir').then(deferred.resolve);
return deferred.promise;
};

@@ -1,38 +0,11 @@

var fs = require('fs');
var path = require('path');
var repeater = require('../repeater');
var shell = require('../shell-utils');
var Q = require('q');
var npmCommand = require('./npm');
var modulesDir = 'modules';
var installModulesCmd = require('./tasks/install-modules');
var npmCmd = require('./tasks/npm');
module.exports = function(args){
var deferred = Q.defer();
//[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){
if(!moduleName){
return done();
}
console.info( ('cloning ' + moduleName + ' from ' + moduleRepo).action );
if(installedModules.indexOf(moduleName) > -1){
console.info( (moduleName + ' is already present in folder ' + modulesDir).warning );
return done();
}
if(shell.run('git clone ' + moduleRepo + ' modules/' + moduleName).errors > 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();
};
repeater(command)
.then( npmCommand.bind(null, 'install') )
installModulesCmd(args)
.then( npmCmd.bind(null, 'install') )
.then(deferred.resolve);

@@ -39,0 +12,0 @@

@@ -1,2 +0,1 @@

var path = require('path');
var Q = require('q');

@@ -10,18 +9,4 @@ var shell = require('../shell-utils');

var command = function(moduleName, moduleRepo, done){
var isModule = !!moduleName;
moduleName = moduleName || 'main';
var moduleLocation = isModule? path.join('modules/', moduleName) : '.';
console.info(('pulling from module: ' + moduleName).action);
isModule && cd('modules/'+moduleName);
var errors = shell.run('git pull');
if(errors.legth > 0){
console.error('something nasty went wrong here'.error);
process.exit(1);
}
isModule && cd('../..');
console.info(('pulling: ' + moduleName).action);
shell.run('git pull');
console.info(('pulled latest changes for ' + moduleName).success);

@@ -31,3 +16,3 @@ done();

repeater(command).then(deferred.resolve);
repeater(command, 'goToModuleDir').then(deferred.resolve);
return deferred.promise;

@@ -34,0 +19,0 @@ };

@@ -7,3 +7,3 @@ var path = require('path');

module.exports = function(args){
module.exports = function(args, force){
var ticket = args._[1];

@@ -13,18 +13,4 @@ var deferred = Q.defer();

var command = function(moduleName, moduleRepo, done){
var isModule = !!moduleName;
moduleName = moduleName || 'main';
var moduleLocation = isModule? path.join('modules/', moduleName) : '.';
console.info(('resetting ' + moduleName).action);
isModule && cd('modules/'+moduleName);
var errors = shell.run('git reset --hard');
if(errors.legth > 0){
console.error('somethint nasty went wrong here'.error);
process.exit(1);
}
isModule && cd('../..');
shell.run('git reset --hard');
console.info((moduleName + ' has reset to HEAD').success);

@@ -34,11 +20,14 @@ done();

var question = "this will void all the uncommited changes in this project and every module";
if(force){
repeater(command, 'goToModuleDir').then(deferred.resolve);
}
prompt.yesNo(question.warning).then(function(yes){
if(!yes){
console.info('thank you for using cox'.success);
process.exit(0);
}
repeater(command).then(deferred.resolve);
});
force || prompt.yesNo("this will void all the uncommited changes in this project and every module".warning)
.then(function(yes){
if(!yes){
console.info('thank you for using cox'.success);
process.exit(0);
}
repeater(command, 'goToModuleDir').then(deferred.resolve);
});

@@ -45,0 +34,0 @@ return deferred.promise;

@@ -1,7 +0,3 @@

var path = require('path');
var shell = require('../shell-utils');
var Q = require('q');
var _ = require('lodash');
var repeater = require('../repeater');
var prompt = require('../prompt-utils');

@@ -15,3 +11,3 @@ var cmdReset = require('./reset');

var ticket = args._[1];
console.info( ("You are about to start development for a new ticket " + ticket).warning );
console.info( ("You are about to start development for new ticket " + ticket).warning );

@@ -18,0 +14,0 @@ cmdReset(args)

@@ -10,19 +10,10 @@ var path = require('path');

var command = function(moduleName, moduleRepo, done){
var isModule = !!moduleName;
moduleName = moduleName || 'main';
var moduleLocation = isModule? path.join('modules/', moduleName) : '.';
console.info(('Status of module: ' + moduleName).warning);
isModule && cd('modules/'+moduleName);
exec('git status');
isModule && cd('../..');
done();
};
repeater(command).then(deferred.resolve);
repeater(command, 'goToModuleDir').then(deferred.resolve);
return deferred.promise;
};
var shelljs = require('shelljs/global');
var path = require('path');
var parseArgs = require('minimist');
require('colors').setTheme(require('./colors-theme'));
var command;
var args = parseArgs(process.argv.slice(2));
var commandName = args._[0];
try{
command = require( path.join(__dirname, 'commands', commandName ) );
} catch(ex){
console.error(('Error: there is no command ' + commandName + ' in cox').error);
process.exit(1);
if(args.h === true || args.v === true){
require('./help')(args);
} else {
require('./execute')(args);
}
command(args).then(function(){
console.info(('\n-------------------------------------------').success);
console.info(('cox has run the requested task successfully').success);
console.info(('-------------------------------------------\n').success);
});

@@ -0,3 +1,16 @@

var fs = require('fs');
var path = require('path');
var Supplant = require('supplant');
var pkg = require('../package.json');
module.exports = function(args){
console.info( 'Usage: "cox <<command>>"'.success );
if(args.v === true){
return console.info(("Cox - version " + pkg.version).warning)
}
var subs = new Supplant();
console.log(subs.text(helpTxt, pkg));
};
var helpTxt = fs.readFileSync(path.join(__dirname, '../help.txt'), 'utf8');

@@ -5,2 +5,5 @@ var fs = require('fs');

var modulesDir = 'modules';
var projectName = process.cwd().split('/').pop();
try{

@@ -19,7 +22,11 @@ var pkg = require( path.join(process.cwd(), 'package.json') );

var repeater = module.exports = function(command, callback){
var repeater = module.exports = function(command, goToModuleDir, skipMainProject){
var deferred = Q.defer();
var modules = Object.keys(dependencies);
command(null, null, repeat);
if(skipMainProject){
repeat();
} else {
command(projectName, pkg.repository.url, repeat);
}

@@ -32,3 +39,7 @@ function repeat(){

var moduleRepo = dependencies[moduleName];
command(moduleName, moduleRepo, repeat);
goToModuleDir && cd( path.join(modulesDir, moduleName) );
command(moduleName, moduleRepo, function(){
goToModuleDir && cd( '../../' );
repeat();
});
};

@@ -35,0 +46,0 @@

@@ -18,3 +18,2 @@ module.exports = {

var silent = {silent: true};
var silent = {silent: false};
{
"name": "cox",
"version": "0.5.0",
"version": "1.0.0",
"preferGlobal": "true",

@@ -31,4 +31,5 @@ "description": "git commander for multi-repositories",

"prompt": "^0.2.14",
"shelljs": "^0.3.0"
"shelljs": "^0.3.0",
"supplant": "^0.2.0"
}
}
# cox
Git commander for multi-repositories.
CLI commander for developing with our current module system
Allows for running necessary tasks in the project folder and all the modules
All Cox commands should be run from the root of the main project.
## Install
## Installation
```

@@ -15,3 +17,3 @@ npm install -g cox

```
Install git repositories defined in `package.json` `coxDependencies`, like:
installs all the project modules, defined in `package.json` `coxDependencies`, like:
```

@@ -25,53 +27,72 @@ "coxDependencies": {

#### update
```
cox update
```
runs npm update in the project folder and in all modules
### Start
```
cox start <<branch-name>>
cox start XE-1234
```
Create a new branch with name ```<<branch-name>>``` in all repositories.
Start developing on a new branch <ticket>
### npm commands
#### npm install
#### checkout
```
cox npm install
cox checkout XE-1234
//or to checkout a new branch:
cox checkout -b XE-1234
```
Runs `npm install` in the existing repositories.
#### npm update
Change to another branch <ticket>
#### reset
```
cox npm update
cox reset
```
Runs `npm update` in the existing repositories.
runs 'git reset --hard' on all repos
### git commands
#### git pull
#### pull
```
cox pull
```
Pull in all repositories.
GIT pulls the latest changes in the current branch
#### git reset --hard
#### status
```
cox reset
cox status
```
Reset all repositories.
displays the GIT status of all repos
#### git checkout
#### diff
```
cox checkout <<branch-name>>
cox diff
```
Checkout a branch ```<<branch-name>>``` in all repositories.
displays the GIT diff of all repos
#### git status
#### add
```
cox status
cox add
```
Status in all repositories.
runs git add to all files unstaged in all repos
#### git diff
#### commit
```
cox diff
cox commit "<message>"
```
Diff in all repositories.
Can be combined, like:
commits staged changes to all the repos with given message
#### push
```
cox diff | less
cox push <ticket>
```
GIT pushes the latest changes in the current branch
#### kill
```
cox kill <ticket>
```
checks out develop and kills the branch locally
*Please use Cox responsibly, don't forget to use protection.*
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc