diff --git a/README.md b/README.md
index 781c569..a35676f 100644
--- a/README.md
+++ b/README.md
@@ -1,50 +1,48 @@
-# mgit2
+# Mr. Git
-
-
-
-
-
+
+
+
+
+
Multi-repo manager for git. A tool for managing projects build using multiple repositories.
-mgit2 is designed to work with [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [Lerna](https://github.com/lerna/lerna) out of the box, hence, it mixes the "package" and "repository" concepts. In other words, every repository is meant to be a single [npm](https://npmjs.com) package. It doesn't mean that you must use it with Lerna and npm, but don't be surprised that mgit2 talks about "packages" and works best with npm packages.
+`mrgit` is designed to work with [yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) and [Lerna](https://github.com/lerna/lerna) out of the box, hence, it mixes the "package" and "repository" concepts. In other words, every repository is meant to be a single [npm](https://npmjs.com) package. It doesn't mean that you must use it with Lerna and npm, but don't be surprised that mrgit talks about "packages" and works best with npm packages.
## Installation
```bash
-npm install -g mgit2
+npm install -g mrgit
```
Use:
```bash
-mgit --help
+mrgit --help
```
-**Note:** The command is called `mgit`.
-
## Usage
-First, create a configuration file `mgit.json`:
+First, create a configuration file `mrgit.json`:
```json
{
"dependencies": {
"@ckeditor/ckeditor5-engine": "ckeditor/ckeditor5-engine",
- "mgit2": "cksource/mgit2"
+ "mrgit": "cksource/mrgit"
}
}
```
(Keys of the `dependencies` object are package names and values are repository URLs (GitHub identifiers in this case). Read more about the [`dependencies` option](#the-dependencies-option).)
-And run `mgit sync` to clone all the repositories. By default, they will be cloned to `/packages/` directory:
+And run `mrgit sync` to clone all the repositories. By default, they will be cloned to `/packages/` directory:
```bash
packages/
ckeditor5-engine/
- mgit2/
+ mrgit/
```
## Configuration
@@ -58,7 +56,7 @@ CLI options:
--hash Whether to save current commit hashes. Used only by "save" command.
--ignore Ignores packages which names match the given glob pattern. E.g.:
- > mgit exec --ignore="foo*" "git status"
+ > mrgit exec --ignore="foo*" "git status"
Will ignore all packages which names start from "foo".
Default: null
@@ -72,7 +70,7 @@ CLI options:
--recursive Whether to install dependencies recursively. Used only by "sync" command.
--resolver-path Path to a custom repository resolver function.
- Default: '@mgit2/lib/default-resolver.js'
+ Default: '@mrgit/lib/default-resolver.js'
--resolver-url-template Template used to generate repository URL out of a
simplified 'organization/repository' format of the dependencies option.
@@ -89,14 +87,14 @@ CLI options:
whether the repository will be cloned to packages/@scope/pkgname' or 'packages/pkgname'.
Default: 'git'
---resolver-default-branch The branch name to use if not specified in mgit.json dependencies.
+--resolver-default-branch The branch name to use if not specified in mrgit.json dependencies.
Default: master
--scope Restricts the command to packages which names match the given glob pattern.
Default: null
```
-All these options can also be specified in `mgit.json` (options passed through CLI takes precedence):
+All these options can also be specified in `mrgit.json` (options passed through CLI takes precedence):
```json
{
@@ -111,9 +109,9 @@ All these options can also be specified in `mgit.json` (options passed through C
### The `dependencies` option
-This option specifies repositories which mgit is supposed to clone. It can also clone its dependencies recursively (see [Recursive cloning](#recursive-cloning)).
+This option specifies repositories which `mrgit` is supposed to clone. It can also clone its dependencies recursively (see [Recursive cloning](#recursive-cloning)).
-The dependency keys can be any strings, but it's recommended to use package names (e.g. npm package names, just like in `package.json`). The values are repository URLs which mgit will clone.
+The dependency keys can be any strings, but it's recommended to use package names (e.g. npm package names, just like in `package.json`). The values are repository URLs which `mrgit` will clone.
Examples:
@@ -140,9 +138,9 @@ Examples:
### Recursive cloning
-When the `--recursive` option is used mgit will clone repositories recursively. First, it will clone the `dependencies` specified in `mgit.json` and, then, their `dependencies` and `devDependencies` specified in `package.json` files located in cloned repositories.
+When the `--recursive` option is used `mrgit` will clone repositories recursively. First, it will clone the `dependencies` specified in `mrgit.json` and, then, their `dependencies` and `devDependencies` specified in `package.json` files located in cloned repositories.
-However, mgit needs to know repository URLs of those dependencies, as well as which dependencies to clone (usually, only the ones maintained by you). In order to configure that you need to use a custom repository resolver (`--resolver-path`).
+However, `mrgit` needs to know repository URLs of those dependencies, as well as which dependencies to clone (usually, only the ones maintained by you). In order to configure that you need to use a custom repository resolver (`--resolver-path`).
Resolver is a simple Node.js module which exports the resolver function.
@@ -151,7 +149,7 @@ For example, assuming that you want to clone all `@ckeditor/ckeditor5-*` package
```js
'use strict';
-const parseRepositoryUrl = require( 'mgit2/lib/utils/parserepositoryurl' );
+const parseRepositoryUrl = require( 'mrgit/lib/utils/parserepositoryurl' );
/**
* Resolves repository URL for a given package name.
@@ -173,47 +171,47 @@ module.exports = function resolver( packageName, options ) {
};
```
-You can also check the [default resolver](https://github.com/cksource/mgit2/blob/master/lib/default-resolver.js) used by mgit and [the config object definition](https://github.com/cksource/mgit2/blob/master/lib/utils/getconfig.js).
+You can also check the [default resolver](https://github.com/cksource/mrgit/blob/master/lib/default-resolver.js) used by `mrgit` and [the config object definition](https://github.com/cksource/mrgit/blob/master/lib/utils/getconfig.js).
### Cloning repositories on CI servers
-CI servers, such as Travis, can't clone repositories using Git URLs (such as `git@github.com:cksource/mgit.git`). By default, mgit uses Git URLs because it assumes that you'll want to commit to these repositories (and don't want to be asked for a password every time).
+CI servers, such as Travis, can't clone repositories using Git URLs (such as `git@github.com:cksource/mrgit.git`). By default, `mrgit` uses Git URLs because it assumes that you'll want to commit to these repositories (and don't want to be asked for a password every time).
-If you need to run mgit on a CI server, then configure it to use HTTPS URLs:
+If you need to run `mrgit` on a CI server, then configure it to use HTTPS URLs:
```bash
-mgit --resolver-url-template="https://github.com/\${ path }.git"
+mrgit --resolver-url-template="https://github.com/\${ path }.git"
```
-You can also use full HTTPS URLs to configure `dependencies` in your `mgit.json`.
+You can also use full HTTPS URLs to configure `dependencies` in your `mrgit.json`.
## Commands
```bash
-$ mgit [command]
+$ mrgit [command]
```
For displaying help screen for specified command, type:
```bash
-$ mgit [command] --help
+$ mrgit [command] --help
```
### sync
-Updates dependencies. Switches repositories to correct branches (specified in `mgit.json`) and pulls changes.
+Updates dependencies. Switches repositories to correct branches (specified in `mrgit.json`) and pulls changes.
If any dependency is missing, the command will install this dependency as well.
This command does not touch repositories in which there are uncommitted changes.
-If in the packages directory will be located some directories that are not specified in `mgit.json`, paths to these directories
+If in the packages directory will be located some directories that are not specified in `mrgit.json`, paths to these directories
will be printed out on the screen.
Examples:
```bash
-mgit sync --recursive
+mrgit sync --recursive
```
### pull
@@ -224,7 +222,7 @@ the repository contains uncommitted changes.
Examples:
```bash
-mgit pull
+mrgit pull
```
### push
@@ -234,7 +232,7 @@ Pushes changes in existing repositories.
Examples:
```bash
-mgit push
+mrgit push
```
### fetch
@@ -244,7 +242,7 @@ Fetches changes in existing repositories.
Examples:
```bash
-mgit fetch
+mrgit fetch
```
### exec
@@ -254,7 +252,7 @@ Executes specified shell command in existing repositories.
Example:
```bash
-mgit exec 'git status'
+mrgit exec 'git status'
# Executes `git status` command on each repository.
```
@@ -262,10 +260,10 @@ mgit exec 'git status'
During the task execution, `cwd` is set to the repository path:
```bash
-mgit exec 'echo `pwd`'
+mrgit exec 'echo `pwd`'
-# /home/mgit/packages/organization/repository-1
-# /home/mgit/packages/organization/repository-2
+# /home/mrgit/packages/organization/repository-1
+# /home/mrgit/packages/organization/repository-2
```
### commit (alias: `ci`)
@@ -276,7 +274,7 @@ You need to specify the message for the commit.
Example:
```bash
-mgit commit --message 'Introduce PULL_REQUEST_TEMPLATE.md.'
+mrgit commit --message 'Introduce PULL_REQUEST_TEMPLATE.md.'
# Executes `git commit --message 'Introduce PULL_REQUEST_TEMPLATE.md.'` command on each repository.
# Commit will be made in repositories that "git status" returns a list if changed files (these files must be tracked by Git).
@@ -295,7 +293,7 @@ Example:
```bash
# Assumptions: we are on "master" branch and "develop" branch exists.
-mgit merge develop --message 'These changes are required for the future release.'
+mrgit merge develop --message 'These changes are required for the future release.'
# Branch "develop" will be merged into "master".
# Branch "develop" will be removed from the origin.
@@ -303,18 +301,18 @@ mgit merge develop --message 'These changes are required for the future release.
### save
-Saves hashes of packages in `mgit.json`. It allows to easily fix project to a specific state.
+Saves hashes of packages in `mrgit.json`. It allows to easily fix project to a specific state.
Example:
```bash
-mgit save
+mrgit save
```
If you would like to save name of branches instead of current commit, you can use an option `--branch`:
```bash
-mgit save --branch
+mrgit save --branch
```
### status (alias: `st`)
@@ -324,15 +322,15 @@ Prints a table which contains useful information about the status of repositorie
Example:
```bash
-mgit status
+mrgit status
# or
-mgit st
+mrgit st
```
In order to save space in your terminal, you can define the `packagesPrefix` option in your configuration file.
The prefix will be removed from packages' names. Full names of packages aren't needed so we can cut the names.
-![An example response of `mgit status` command.](https://user-images.githubusercontent.com/2270764/28871104-5915289e-7783-11e7-8d06-9eac6d7d96ab.png)
+![An example response of `mrgit status` command.](https://user-images.githubusercontent.com/2270764/28871104-5915289e-7783-11e7-8d06-9eac6d7d96ab.png)
### diff
@@ -347,55 +345,55 @@ These options must be separated by a double dash `--`, the same way as [`npm scr
Prints changes from all repositories:
```bash
-mgit diff
+mrgit diff
```
Prints diffstat from all repositories:
```bash
-mgit diff -- --stat
+mrgit diff -- --stat
```
Prints staged changes from restricted scope:
```bash
-mgit diff --scope=*@(engine|typing)* -- --staged
+mrgit diff --scope=*@(engine|typing)* -- --staged
```
Prints changes from repositories which are not on `master`:
```bash
-mgit diff -- master...HEAD
+mrgit diff -- master...HEAD
```
-![An example response of `mgit diff` command.](https://user-images.githubusercontent.com/2270764/28918716-c6f90002-784a-11e7-95ae-8d08c47c5427.png)
+![An example response of `mrgit diff` command.](https://user-images.githubusercontent.com/2270764/28918716-c6f90002-784a-11e7-95ae-8d08c47c5427.png)
### checkout (alias: `co`)
-Changes branches in repositories according to the configuration file. It does not pull the changes and hance is much faster than `mgit sync`.
+Changes branches in repositories according to the configuration file. It does not pull the changes and hance is much faster than `mrgit sync`.
The command is useful for bisecting if your main repository contain a revision log like CKEditor 5's [`master-revision`](https://github.com/ckeditor/ckeditor5/commits/master-revisions) branch.
```bash
-mgit checkout
+mrgit checkout
# or
-mgit co
+mrgit co
```
-If specified an argument, specified branch will be used instead of default or saved in `mgit.json` file.
+If specified an argument, specified branch will be used instead of default or saved in `mrgit.json` file.
```bash
# Checkout all repositories to "stable" branch.
-mgit checkout stable
+mrgit checkout stable
```
-Also you can specify the `--branch` option which means that mgit creates a new branches in repositories that contains changes (that could be committed).
-It works on the same terms like `mgit commit`.
+Also you can specify the `--branch` option which means that `mrgit` creates a new branches in repositories that contains changes (that could be committed).
+It works on the same terms like `mrgit commit`.
```bash
# Create the branch "t/foo" in repositories where "git status" returns a list if changed files (these files must be tracked by Git).
-mgit checkout --branch t/foo
+mrgit checkout --branch t/foo
```
-## Projects using mgit2
+## Projects using mrgit
* [CKEditor 5](https://github.com/ckeditor/ckeditor5)
diff --git a/index.js b/index.js
index 94a8322..5eb9931 100755
--- a/index.js
+++ b/index.js
@@ -9,7 +9,7 @@
const chalk = require( 'chalk' );
const meow = require( 'meow' );
-const mgit = require( './lib/index' );
+const mrgit = require( './lib/index' );
const getCommandInstance = require( './lib/utils/getcommandinstance' );
handleCli();
@@ -33,15 +33,15 @@ function handleCli() {
}
};
- const mgitLogo = `
- _ _
- (_) |
- _ __ ___ __ _ _| |_
- | '_ \` _ \\ / _\` | | __|
- | | | | | | (_| | | |_
- |_| |_| |_|\\__, |_|\\__|
- __/ |
- |___/
+ const logo = `
+ _ _
+ (_) |
+ _ __ ___ _ __ __ _ _| |_
+ | '_ \` _ \\| '__| / _\` | | __|
+ | | | | | | | _ | (_| | | |_
+ |_| |_| |_|_|(_) \\__, |_|\\__|
+ __/ |
+ |___/
`;
const {
@@ -52,20 +52,20 @@ function handleCli() {
yellow: y,
} = chalk;
- const cli = meow( `${ mgitLogo }
+ const cli = meow( `${ logo }
${ u( 'Usage:' ) }
- $ mgit ${ c( 'command' ) } ${ y( '[--options]' ) } -- ${ m( '[--git-options]' ) }
+ $ mrgit ${ c( 'command' ) } ${ y( '[--options]' ) } -- ${ m( '[--git-options]' ) }
${ u( 'Commands:' ) }
${ c( 'checkout' ) } Changes branches in repositories according to the configuration file.
${ c( 'close' ) } Merges specified branch with the current one and remove merged branch from the remote.
- ${ c( 'commit' ) } Commits all changes. A shorthand for "mgit exec 'git commit -a'".
+ ${ c( 'commit' ) } Commits all changes. A shorthand for "mrgit exec 'git commit -a'".
${ c( 'diff' ) } Prints changes from packages where something has changed.
${ c( 'exec' ) } Executes shell command in each package.
${ c( 'fetch' ) } Fetches existing repositories.
${ c( 'pull' ) } Pulls changes in existing repositories.
${ c( 'push' ) } Pushes changes in existing repositories to remotes.
- ${ c( 'save' ) } Saves hashes of packages in mgit.json. It allows to easily fix project to a specific state.
+ ${ c( 'save' ) } Saves hashes of packages in mrgit.json. It allows to easily fix project to a specific state.
${ c( 'status' ) } Prints a table which contains useful information about the status of repositories.
${ c( 'sync' ) } Updates packages to the latest versions or install missing ones.
@@ -77,7 +77,7 @@ function handleCli() {
${ y( '--hash' ) } Whether to save current commit hashes. Used only by "${ u( 'save' ) }" command.
${ y( '--ignore' ) } Ignores packages which names match the given glob pattern. E.g.:
- ${ g( '> mgit exec --ignore="foo*" "git status"' ) }
+ ${ g( '> mrgit exec --ignore="foo*" "git status"' ) }
Will ignore all packages which names start from "foo".
${ g( 'Default: null' ) }
@@ -91,7 +91,7 @@ function handleCli() {
${ y( '--recursive' ) } Whether to install dependencies recursively. Used only by "${ u( 'sync' ) }" command.
${ y( '--resolver-path' ) } Path to a custom repository resolver function.
- ${ g( 'Default: \'@mgit2/lib/default-resolver.js\'' ) }
+ ${ g( 'Default: \'@mrgit/lib/default-resolver.js\'' ) }
${ y( '--resolver-url-template' ) } Template used to generate repository URL out of a
simplified 'organization/repository' format of the dependencies option.
@@ -108,7 +108,7 @@ function handleCli() {
whether the repository will be cloned to packages/@scope/pkgname' or 'packages/pkgname'.
${ g( 'Default: \'git\'' ) }
- ${ y( '--resolver-default-branch' ) } The branch name to use if not specified in mgit.json dependencies.
+ ${ y( '--resolver-default-branch' ) } The branch name to use if not specified in mrgit.json dependencies.
${ g( 'Default: master' ) }
${ y( '--scope' ) } Restricts the command to packages which names match the given glob pattern.
@@ -116,18 +116,18 @@ function handleCli() {
${ u( 'Git Options:' ) }
Git options are supported by the following commands: commit, diff, fetch, push.
- Type "mgit [command] -h" in order to see which options are supported.
+ Type "mrgit [command] -h" in order to see which options are supported.
`, meowOptions );
const commandName = cli.input[ 0 ];
// If user specified a command and `--help` flag wasn't active.
if ( commandName && !cli.flags.help ) {
- return mgit( cli.input, cli.flags );
+ return mrgit( cli.input, cli.flags );
}
// A user wants to see "help" screen.
- // Missing command. Displays help screen for the entire Mgit.
+ // Missing command. Displays help screen for the entire Mr. Git.
if ( !commandName ) {
return cli.showHelp( 0 );
}
@@ -141,7 +141,7 @@ function handleCli() {
}
// Specified command is is available, displays the command's help.
- console.log( mgitLogo );
+ console.log( logo );
console.log( ` ${ u( 'Command:' ) } ${ c( commandInstance.name || commandName ) } ` );
console.log( commandInstance.helpMessage );
}
diff --git a/lib/commands/checkout.js b/lib/commands/checkout.js
index e09a5d1..f43fd79 100644
--- a/lib/commands/checkout.js
+++ b/lib/commands/checkout.js
@@ -21,18 +21,18 @@ module.exports = {
return `
${ u( 'Description:' ) }
- Checks out the repository to specified branch or commit saved in "mgit.json" file.
+ Checks out the repository to specified branch or commit saved in "mrgit.json" file.
- If specified a branch as an argument for "checkout" command, mgit will use the branch
- instead of data saved in "mgit.json". E.g "${ g( 'mgit checkout master' ) }" will check out
+ If specified a branch as an argument for "checkout" command, mrgit will use the branch
+ instead of data saved in "mrgit.json". E.g "${ g( 'mrgit checkout master' ) }" will check out
all branches to "master".
- You can also call "${ g( 'mgit checkout .' ) }" in order to restore files before changes.
+ You can also call "${ g( 'mrgit checkout .' ) }" in order to restore files before changes.
${ u( 'Options:' ) }
- ${ y( '--branch' ) } (-b) If specified, mgit will create given branch in all repositories
+ ${ y( '--branch' ) } (-b) If specified, mrgit will create given branch in all repositories
that contain changes that could be committed.
- ${ g( '> mgit checkout --branch develop' ) }
+ ${ g( '> mrgit checkout --branch develop' ) }
`;
},
@@ -42,8 +42,8 @@ module.exports = {
*/
execute( data ) {
// Used `--branch` option.
- if ( data.mgitOptions.branch ) {
- return this._createAndCheckout( data.mgitOptions.branch, data );
+ if ( data.toolOptions.branch ) {
+ return this._createAndCheckout( data.toolOptions.branch, data );
}
const branch = data.arguments[ 0 ] || data.repository.branch;
diff --git a/lib/commands/close.js b/lib/commands/close.js
index 94290b5..2c674ce 100644
--- a/lib/commands/close.js
+++ b/lib/commands/close.js
@@ -31,13 +31,13 @@ module.exports = {
${ u( 'Options:' ) }
${ m( '--message' ) } (-m) An additional description for merge commit. It will be
appended to the default message. E.g.:
- ${ g( '> mgit merge develop -- -m "Some description about merged changes."' ) }
+ ${ g( '> mrgit merge develop -- -m "Some description about merged changes."' ) }
`;
},
beforeExecute( args ) {
if ( !args[ 1 ] ) {
- throw new Error( 'Missing branch to merge. Use: mgit close [branch].' );
+ throw new Error( 'Missing branch to merge. Use: mrgit close [branch].' );
}
},
@@ -62,7 +62,7 @@ module.exports = {
};
}
- const mergeMessage = this._getMergeMessage( data.mgitOptions, data.arguments );
+ const mergeMessage = this._getMergeMessage( data.toolOptions, data.arguments );
const commitTitle = `Merge branch '${ branch }'`;
let mergeCommand = `git merge ${ branch } --no-ff -m "${ commitTitle }"`;
@@ -100,17 +100,17 @@ module.exports = {
/**
* @private
- * @param {options} mgitOptions Options resolved by mgit.
+ * @param {options} toolOptions Options resolved by mrgit.
* @param {Array.>} argv List of arguments provided by the user via CLI.
* @returns {Array.}
*/
- _getMergeMessage( mgitOptions, argv ) {
+ _getMergeMessage( toolOptions, argv ) {
const cliOptions = this._parseArguments( argv );
let message;
- if ( mgitOptions.message ) {
- message = mgitOptions.message;
+ if ( toolOptions.message ) {
+ message = toolOptions.message;
} else if ( cliOptions.message ) {
message = cliOptions.message;
} else {
diff --git a/lib/commands/commit.js b/lib/commands/commit.js
index 43199a9..1c0e1e0 100644
--- a/lib/commands/commit.js
+++ b/lib/commands/commit.js
@@ -25,28 +25,28 @@ module.exports = {
return `
${ u( 'Description:' ) }
Makes a commit in every repository that contains tracked files that have changed.
- This command is a shorthand for: "${ i( 'mgit exec \'git commit -a\'' ) }".
+ This command is a shorthand for: "${ i( 'mrgit exec \'git commit -a\'' ) }".
${ u( 'Options:' ) }
${ y( '--message' ) } (-m) Required. A message for the commit. It can be specified more then once, e.g.:
- ${ g( '> mgit commit --message "Title of the commit." --message "Additional description."' ) }
+ ${ g( '> mrgit commit --message "Title of the commit." --message "Additional description."' ) }
${ u( 'Git Options:' ) }
${ m( '--no-verify' ) } (-n) Whether to skip pre-commit and commit-msg hooks.
- ${ g( '> mgit commit -m "Title of the commit." -- -n' ) }
+ ${ g( '> mrgit commit -m "Title of the commit." -- -n' ) }
`;
},
/**
* @param {Array.} args Arguments and options that a user provided calling the command.
- * @param {Options} mgitOptions Options resolved by mgit.
+ * @param {Options} toolOptions Options resolved by mrgit.
*/
- beforeExecute( args, mgitOptions ) {
+ beforeExecute( args, toolOptions ) {
const cliOptions = this._parseArguments( args );
- const commitMessage = this._getCommitMessage( mgitOptions, cliOptions );
+ const commitMessage = this._getCommitMessage( toolOptions, cliOptions );
if ( !commitMessage.length ) {
- throw new Error( 'Missing --message (-m) option. Call "mgit commit -h" in order to read more.' );
+ throw new Error( 'Missing --message (-m) option. Call "mrgit commit -h" in order to read more.' );
}
},
@@ -71,7 +71,7 @@ module.exports = {
}
const cliOptions = this._parseArguments( data.arguments );
- const commitCommand = this._buildCliCommand( data.mgitOptions, cliOptions );
+ const commitCommand = this._buildCliCommand( data.toolOptions, cliOptions );
return execCommand.execute( getExecData( commitCommand ) );
} );
@@ -85,12 +85,12 @@ module.exports = {
/**
* @private
- * @param {options} mgitOptions Options resolved by mgit.
+ * @param {options} toolOptions Options resolved by mrgit.
* @param {Object} cliOptions Parsed arguments provided by the user via CLI.
* @returns {String}
*/
- _buildCliCommand( mgitOptions, cliOptions ) {
- const commitMessage = this._getCommitMessage( mgitOptions, cliOptions );
+ _buildCliCommand( toolOptions, cliOptions ) {
+ const commitMessage = this._getCommitMessage( toolOptions, cliOptions );
let command = 'git commit -a';
command += ' ' + commitMessage.map( message => `-m "${ message }"` ).join( ' ' );
@@ -104,15 +104,15 @@ module.exports = {
/**
* @private
- * @param {Options} mgitOptions Options resolved by mgit.
+ * @param {Options} toolOptions Options resolved by mrgit.
* @param {Object} cliOptions Parsed arguments provided by the user via CLI.
* @returns {Array.}
*/
- _getCommitMessage( mgitOptions, cliOptions ) {
+ _getCommitMessage( toolOptions, cliOptions ) {
let message;
- if ( mgitOptions.message ) {
- message = mgitOptions.message;
+ if ( toolOptions.message ) {
+ message = toolOptions.message;
} else if ( cliOptions.message ) {
message = cliOptions.message;
} else {
diff --git a/lib/commands/diff.js b/lib/commands/diff.js
index 9835d5c..8f3636f 100644
--- a/lib/commands/diff.js
+++ b/lib/commands/diff.js
@@ -24,10 +24,10 @@ module.exports = {
"${ m( '--color' ) }" is adding. You can cancel it using option "${ m( '--no-color' ) }".
${ u( 'Git Options:' ) }
- All options accepted by "${ i( 'git diff' ) }" are supported by mgit. Everything specified after "--" is passed directly to the
+ All options accepted by "${ i( 'git diff' ) }" are supported by mrgit. Everything specified after "--" is passed directly to the
"${ i( 'git diff' ) }" command.
- E.g.: "${ g( 'mgit diff -- origin/master..master' ) }" will execute "${ i( 'git diff --color origin/master..master' ) }"
+ E.g.: "${ g( 'mrgit diff -- origin/master..master' ) }" will execute "${ i( 'git diff --color origin/master..master' ) }"
`;
},
diff --git a/lib/commands/exec.js b/lib/commands/exec.js
index 5c0f205..a760c41 100644
--- a/lib/commands/exec.js
+++ b/lib/commands/exec.js
@@ -20,18 +20,18 @@ module.exports = {
return `
${ u( 'Description:' ) }
- Requires a command that will be executed on all repositories. E.g. "${ g( 'mgit exec pwd' ) }" will execute "${ i( 'pwd' ) }"
+ Requires a command that will be executed on all repositories. E.g. "${ g( 'mrgit exec pwd' ) }" will execute "${ i( 'pwd' ) }"
command in every repository. Commands that contain spaces must be wrapped in quotation marks,
- e.g.: "${ g( 'mgit exec "git remote"' ) }".
+ e.g.: "${ g( 'mrgit exec "git remote"' ) }".
`;
},
/**
- * @param {Array.} args Arguments that user provided calling the mgit.
+ * @param {Array.} args Arguments that user provided calling the mrgit.
*/
beforeExecute( args ) {
if ( args.length === 1 ) {
- throw new Error( 'Missing command to execute. Use: mgit exec [command-to-execute].' );
+ throw new Error( 'Missing command to execute. Use: mrgit exec [command-to-execute].' );
}
},
@@ -43,11 +43,11 @@ module.exports = {
const log = require( '../utils/log' )();
return new Promise( ( resolve, reject ) => {
- const newCwd = path.join( data.mgitOptions.packages, data.repository.directory );
+ const newCwd = path.join( data.toolOptions.packages, data.repository.directory );
// Package does not exist.
if ( !fs.existsSync( newCwd ) ) {
- log.error( `Package "${ data.packageName }" is not available. Run "mgit sync" in order to download the package.` );
+ log.error( `Package "${ data.packageName }" is not available. Run "mrgit sync" in order to download the package.` );
return reject( { logs: log.all() } );
}
@@ -56,14 +56,14 @@ module.exports = {
shell( data.arguments[ 0 ] )
.then( stdout => {
- process.chdir( data.mgitOptions.cwd );
+ process.chdir( data.toolOptions.cwd );
log.info( stdout );
resolve( { logs: log.all() } );
} )
.catch( error => {
- process.chdir( data.mgitOptions.cwd );
+ process.chdir( data.toolOptions.cwd );
log.error( error );
diff --git a/lib/commands/fetch.js b/lib/commands/fetch.js
index 52c0961..7c8ab2c 100644
--- a/lib/commands/fetch.js
+++ b/lib/commands/fetch.js
@@ -25,7 +25,7 @@ module.exports = {
return `
${ u( 'Description:' ) }
Download objects and refs from the remote repository. If some package is missed, the command will not be executed.
- For cloned repositories this command is a shorthand for: "${ i( 'mgit exec \'git fetch\'' ) }".
+ For cloned repositories this command is a shorthand for: "${ i( 'mrgit exec \'git fetch\'' ) }".
${ u( 'Git Options:' ) }
${ m( '--prune' ) } (-p) Before fetching, remove any remote-tracking references that
@@ -42,7 +42,7 @@ module.exports = {
const log = require( '../utils/log' )();
const execCommand = require( './exec' );
- const destinationPath = path.join( data.mgitOptions.packages, data.repository.directory );
+ const destinationPath = path.join( data.toolOptions.packages, data.repository.directory );
// Package is not cloned.
if ( !fs.existsSync( destinationPath ) ) {
diff --git a/lib/commands/pull.js b/lib/commands/pull.js
index a5a09cc..65a0c88 100644
--- a/lib/commands/pull.js
+++ b/lib/commands/pull.js
@@ -21,7 +21,7 @@ module.exports = {
return `
${ u( 'Description:' ) }
Pull changes in all packages. If some package is missed, the command will not be executed.
- For cloned repositories this command is a shorthand for: "${ i( 'mgit exec \'git pull\'' ) }".
+ For cloned repositories this command is a shorthand for: "${ i( 'mrgit exec \'git pull\'' ) }".
`;
},
@@ -32,7 +32,7 @@ module.exports = {
execute( data ) {
const execCommand = require( './exec' );
- const destinationPath = path.join( data.mgitOptions.packages, data.repository.directory );
+ const destinationPath = path.join( data.toolOptions.packages, data.repository.directory );
// Package is not cloned.
if ( !fs.existsSync( destinationPath ) ) {
diff --git a/lib/commands/push.js b/lib/commands/push.js
index 0bc62eb..5089fb2 100644
--- a/lib/commands/push.js
+++ b/lib/commands/push.js
@@ -22,13 +22,13 @@ module.exports = {
return `
${ u( 'Description:' ) }
Push changes in all packages. If some package is missed, the command will not be executed.
- For cloned repositories this command is a shorthand for: "${ i( 'mgit exec \'git push\'' ) }".
+ For cloned repositories this command is a shorthand for: "${ i( 'mrgit exec \'git push\'' ) }".
${ u( 'Git Options:' ) }
- All options accepted by "${ i( 'git push' ) }" are supported by mgit. Everything specified after "--" is passed directly to the
+ All options accepted by "${ i( 'git push' ) }" are supported by mrgit. Everything specified after "--" is passed directly to the
"${ i( 'git push' ) }" command.
- E.g.: "${ g( 'mgit push -- --verbose --all' ) }" will execute "${ i( 'git push --verbose --all' ) }"
+ E.g.: "${ g( 'mrgit push -- --verbose --all' ) }" will execute "${ i( 'git push --verbose --all' ) }"
`;
},
@@ -39,7 +39,7 @@ module.exports = {
execute( data ) {
const execCommand = require( './exec' );
- const destinationPath = path.join( data.mgitOptions.packages, data.repository.directory );
+ const destinationPath = path.join( data.toolOptions.packages, data.repository.directory );
// Package is not cloned.
if ( !fs.existsSync( destinationPath ) ) {
diff --git a/lib/commands/save.js b/lib/commands/save.js
index 3ff6f8d..0dc4553 100644
--- a/lib/commands/save.js
+++ b/lib/commands/save.js
@@ -20,28 +20,28 @@ module.exports = {
return `
${ u( 'Description:' ) }
- Saves hashes of commits or branches which repositories are checked out in "mgit.json" file.
+ Saves hashes of commits or branches which repositories are checked out in "mrgit.json" file.
${ u( 'Options:' ) }
${ y( '--hash' ) } Whether to save hashes (id of last commit) on current branch.
${ g( 'Default: true' ) }
${ y( '--branch' ) } (-b) Whether to save names of current branches instead of commit ids.
${ g( 'Default: false' ) }
- ${ g( '> mgit save --branch' ) }
+ ${ g( '> mrgit save --branch' ) }
`;
},
/**
* @param {Array.} args Arguments and options that a user provided calling the command.
- * @param {Options} mgitOptions Options resolved by mgit.
+ * @param {Options} toolOptions Options resolved by mrgit.
*/
- beforeExecute( args, mgitOptions ) {
- if ( !mgitOptions.branch && !mgitOptions.hash ) {
- mgitOptions.hash = true;
- mgitOptions.branch = false;
+ beforeExecute( args, toolOptions ) {
+ if ( !toolOptions.branch && !toolOptions.hash ) {
+ toolOptions.hash = true;
+ toolOptions.branch = false;
}
- if ( mgitOptions.hash && mgitOptions.branch ) {
+ if ( toolOptions.hash && toolOptions.branch ) {
throw new Error( 'Cannot use "hash" and "branch" options at the same time.' );
}
},
@@ -57,10 +57,10 @@ module.exports = {
let promise;
/* istanbul ignore else */
- if ( data.mgitOptions.branch ) {
+ if ( data.toolOptions.branch ) {
promise = execCommand.execute( getExecData( 'git status --branch --porcelain' ) )
.then( execResponse => gitStatusParser( execResponse.logs.info[ 0 ] ).branch );
- } else if ( data.mgitOptions.hash ) {
+ } else if ( data.toolOptions.hash ) {
promise = execCommand.execute( getExecData( 'git rev-parse HEAD' ) )
.then( execResponse => execResponse.logs.info[ 0 ].slice( 0, 7 ) );
}
@@ -70,14 +70,14 @@ module.exports = {
const commandResponse = {
packageName: data.packageName,
data: dataToSave,
- branch: data.mgitOptions.branch,
- hash: data.mgitOptions.hash
+ branch: data.toolOptions.branch,
+ hash: data.toolOptions.hash
};
/* istanbul ignore else */
- if ( data.mgitOptions.branch ) {
+ if ( data.toolOptions.branch ) {
log.info( `Branch: "${ dataToSave }".` );
- } else if ( data.mgitOptions.hash ) {
+ } else if ( data.toolOptions.hash ) {
log.info( `Commit: "${ dataToSave }".` );
}
@@ -102,9 +102,9 @@ module.exports = {
*/
afterExecute( processedPackages, commandResponses ) {
const cwd = require( '../utils/getcwd' )();
- const mgitJsonPath = path.join( cwd, 'mgit.json' );
+ const mrgitJsonPath = path.join( cwd, 'mrgit.json' );
- updateJsonFile( mgitJsonPath, json => {
+ updateJsonFile( mrgitJsonPath, json => {
for ( const response of commandResponses.values() ) {
const repository = json.dependencies[ response.packageName ].split( '#' )[ 0 ];
diff --git a/lib/commands/status.js b/lib/commands/status.js
index f1050e9..a3012d4 100644
--- a/lib/commands/status.js
+++ b/lib/commands/status.js
@@ -22,7 +22,7 @@ module.exports = {
Prints a useful table that contains status of every repository. It displays:
* current branch,
- * whether current branch is equal to specified in "mgit.json" file,
+ * whether current branch is equal to specified in "mrgit.json" file,
* whether current branch is behind or ahead with the remote,
* current commit short hash,
* how many files is staged, modified and untracked.
@@ -49,7 +49,7 @@ module.exports = {
.then( ( [ hashResponse, statusResponse ] ) => {
let packageName = data.packageName;
- for ( const packagePrefix of data.mgitOptions.packagesPrefix ) {
+ for ( const packagePrefix of data.toolOptions.packagesPrefix ) {
packageName = packageName.replace( new RegExp( '^' + packagePrefix ), '' );
}
@@ -57,7 +57,7 @@ module.exports = {
packageName,
status: gitStatusParser( statusResponse.logs.info[ 0 ] ),
commit: hashResponse.logs.info[ 0 ].slice( 0, 7 ), // Short version of the commit hash.
- mgitBranch: data.repository.branch
+ mrgitBranch: data.repository.branch
};
return { response: commandResponse };
@@ -108,14 +108,14 @@ module.exports = {
console.log( table.toString() );
console.log( getLegend() );
- function createSingleRow( { packageName, status, mgitBranch, commit } ) {
+ function createSingleRow( { packageName, status, mrgitBranch, commit } ) {
const wholeRow = [];
const statusColumn = [];
const wholeRowColor = status.branch !== 'master' ? 'magenta' : null;
let branch = status.branch;
- if ( mgitBranch !== status.branch ) {
+ if ( mrgitBranch !== status.branch ) {
branch = `${ color( 'cyan', '!' ) } ${ branch }`;
}
@@ -153,7 +153,7 @@ module.exports = {
`${ color( 'green', '+' ) } staged files`,
`${ color( 'red', 'M' ) } modified files`,
`${ color( 'blue', '?' ) } untracked files`,
- `\n${ color( 'cyan', '!' ) } not on a branch specified in "mgit.json"`
+ `\n${ color( 'cyan', '!' ) } not on a branch specified in "mrgit.json"`
];
return `${ chalk.bold( 'Legend:' ) }\n${ legend.join( ', ' ) }.`;
diff --git a/lib/commands/sync.js b/lib/commands/sync.js
index e9e59dc..8bfb4f3 100644
--- a/lib/commands/sync.js
+++ b/lib/commands/sync.js
@@ -28,7 +28,7 @@ module.exports = {
* Checks whether repository can be updated. If the repository contains uncommitted changes,
the process is aborted.
* Fetches changes from the remote.
- * Checks out on the branch or particular commit that is specified in "mgit.json" file.
+ * Checks out on the branch or particular commit that is specified in "mrgit.json" file.
* Pulls the changes if the repository is not detached at some commit.
${ u( 'Options:' ) }
@@ -46,7 +46,7 @@ module.exports = {
const log = require( '../utils/log' )();
const execCommand = require( './exec' );
- const destinationPath = path.join( data.mgitOptions.packages, data.repository.directory );
+ const destinationPath = path.join( data.toolOptions.packages, data.repository.directory );
// Package is not cloned.
if ( !fs.existsSync( destinationPath ) ) {
@@ -57,7 +57,7 @@ module.exports = {
name: data.packageName,
url: data.repository.url,
branch: data.repository.branch
- }, data.mgitOptions, { log } );
+ }, data.toolOptions, { log } );
}
return execCommand.execute( getExecData( 'git status -s' ) )
@@ -86,7 +86,7 @@ module.exports = {
const stdout = response.logs.info.join( '\n' ).trim();
const isOnBranchRegexp = /HEAD detached at+/;
- // If on a detached commit, mgit must not pull the changes.
+ // If on a detached commit, mrgit must not pull the changes.
if ( isOnBranchRegexp.test( stdout ) ) {
log.info( `Package "${ data.packageName }" is on a detached commit.` );
@@ -120,21 +120,21 @@ module.exports = {
/**
* @param {Set} parsedPackages Collection of processed packages.
*/
- afterExecute( parsedPackages, commandResponses, mgitOptions ) {
+ afterExecute( parsedPackages, commandResponses, toolOptions ) {
console.log( chalk.cyan( `${ parsedPackages.size } packages have been processed.` ) );
- const repositoryResolver = require( mgitOptions.resolverPath );
+ const repositoryResolver = require( toolOptions.resolverPath );
- const repositoryDirectories = Object.keys( mgitOptions.dependencies )
+ const repositoryDirectories = Object.keys( toolOptions.dependencies )
.map( packageName => {
- const repository = repositoryResolver( packageName, mgitOptions );
+ const repository = repositoryResolver( packageName, toolOptions );
- return path.join( mgitOptions.packages, repository.directory );
+ return path.join( toolOptions.packages, repository.directory );
} );
- const skippedPackages = fs.readdirSync( mgitOptions.packages )
+ const skippedPackages = fs.readdirSync( toolOptions.packages )
.map( directoryName => {
- const absolutePath = path.join( mgitOptions.packages, directoryName );
+ const absolutePath = path.join( toolOptions.packages, directoryName );
if ( !directoryName.startsWith( '@' ) ) {
return absolutePath;
@@ -163,7 +163,7 @@ module.exports = {
if ( skippedPackages.length ) {
console.log(
- chalk.yellow( 'Paths to directories listed below are skipped by mgit because they are not defined in "mgit.json":' )
+ chalk.yellow( 'Paths to directories listed below are skipped by mrgit because they are not defined in "mrgit.json":' )
);
skippedPackages.forEach( absolutePath => {
@@ -179,13 +179,13 @@ module.exports = {
* @param {String} packageDetails.url A url that will be cloned.
* @param {String} packageDetails.path An absolute path where the package should be cloned.
* @param {String} packageDetails.branch A branch on which the repository will be checked out after cloning.
- * @param {Options} mgitOptions Options resolved by mgit.
- * @param {Object} options Additional options which aren't related to mgit.
+ * @param {Options} toolOptions Options resolved by mrgit.
+ * @param {Object} options Additional options which aren't related to mrgit.
* @param {Logger} options.log Logger
* @param {Boolean} [options.doNotTryAgain=false] If set to `true`, bootstrap command won't be executed again.
* @returns {Promise}
*/
- _clonePackage( packageDetails, mgitOptions, options ) {
+ _clonePackage( packageDetails, toolOptions, options ) {
const log = options.log;
const command = [
@@ -202,7 +202,7 @@ module.exports = {
logs: log.all()
};
- if ( mgitOptions.recursive ) {
+ if ( toolOptions.recursive ) {
const packageJson = require( path.join( packageDetails.path, 'package.json' ) );
const packages = [];
@@ -223,7 +223,7 @@ module.exports = {
/* istanbul ignore else */
if ( isRemoteHungUpError( error ) && !options.doNotTryAgain ) {
return delay( 5000 ).then( () => {
- return this._clonePackage( packageDetails, mgitOptions, { log, doNotTryAgain: true } );
+ return this._clonePackage( packageDetails, toolOptions, { log, doNotTryAgain: true } );
} );
}
@@ -234,7 +234,7 @@ module.exports = {
}
};
-// See: https://github.com/cksource/mgit2/issues/87
+// See: https://github.com/cksource/mrgit/issues/87
function isRemoteHungUpError( error ) {
if ( typeof error != 'string' ) {
error = error.toString();
diff --git a/lib/index.js b/lib/index.js
index d57c85f..037b033 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -30,13 +30,13 @@ module.exports = function( args, options ) {
const cwd = getCwd();
const mainPackageName = require( path.resolve( cwd, 'package.json' ) ).name;
const startTime = process.hrtime();
- const mgitOptions = getOptions( options, cwd );
- const repositoryResolver = require( mgitOptions.resolverPath );
+ const toolOptions = getOptions( options, cwd );
+ const repositoryResolver = require( toolOptions.resolverPath );
const forkPool = createForkPool( CHILD_PROCESS_PATH );
if ( command.beforeExecute ) {
try {
- command.beforeExecute( args, mgitOptions );
+ command.beforeExecute( args, toolOptions );
} catch ( error ) {
console.log( chalk.red( error.message ) );
process.exit( 1 );
@@ -48,7 +48,7 @@ module.exports = function( args, options ) {
const processedPackages = new Set();
const commandResponses = new Set();
const packagesWithError = new Set();
- const packageNames = getPackageNames( mgitOptions );
+ const packageNames = getPackageNames( toolOptions );
let allPackagesNumber = packageNames.length;
let donePackagesNumber = 0;
@@ -77,10 +77,10 @@ module.exports = function( args, options ) {
const data = {
packageName,
- mgitOptions,
+ toolOptions,
commandPath: command.path,
arguments: args.slice( 1 ),
- repository: repositoryResolver( packageName, mgitOptions )
+ repository: repositoryResolver( packageName, toolOptions )
};
forkPool.enqueue( data )
@@ -130,7 +130,7 @@ module.exports = function( args, options ) {
return forkPool.killAll()
.then( () => {
if ( command.afterExecute ) {
- command.afterExecute( processedPackages, commandResponses, mgitOptions );
+ command.afterExecute( processedPackages, commandResponses, toolOptions );
}
const endTime = process.hrtime( startTime );
diff --git a/lib/utils/getcommandinstance.js b/lib/utils/getcommandinstance.js
index 018c7c5..45b2250 100644
--- a/lib/utils/getcommandinstance.js
+++ b/lib/utils/getcommandinstance.js
@@ -29,7 +29,7 @@ module.exports = function getCommandInstance( commandName ) {
return commandInstance;
} catch ( err ) {
- const message = `Command "${ commandName }" does not exist. Type: "mgit --help" in order to see available commands.`;
+ const message = `Command "${ commandName }" does not exist. Type: "mrgit --help" in order to see available commands.`;
console.error( chalk.red( message ) );
}
@@ -54,10 +54,10 @@ module.exports = function getCommandInstance( commandName ) {
*
* @property {String} [name] A name of the command. It's useful if specified command has defined an alias.
*
- * @property {Function} [beforeExecute] A function that is called by mgit automatically before executing the main command's method.
+ * @property {Function} [beforeExecute] A function that is called by mrgit automatically before executing the main command's method.
* This function is called once. It receives two parameters:
* - an array of arguments typed by a user (including called command name).
- * - an options object (`Options`) which contains options resolved by mgit.
+ * - an options object (`Options`) which contains options resolved by mrgit.
*
* @property {Function} execute The main function of command.
* It receives single argument (`CommandData`) that represents an input provided by a user.
@@ -65,13 +65,13 @@ module.exports = function getCommandInstance( commandName ) {
* - `logs` - an object that matches to `Logs` object definition.
* - `response` - the entire `response` object is added to a collection that will be passed as second argument to `#afterExecute`
* function.
- * - `packages` - an array of packages that mgit should process as well.
+ * - `packages` - an array of packages that mrgit should process as well.
*
- * @property {Function} [afterExecute] A function that is called by mgit automatically after executing the main command's method.
+ * @property {Function} [afterExecute] A function that is called by mrgit automatically after executing the main command's method.
* This function is called once. It receives three parameters:
- * - a collection (`Set`) that contains all processed packages by mgit.
+ * - a collection (`Set`) that contains all processed packages by mrgit.
* - a collection (`Set`) that contains responses returned by `#execute` function.
- * - an options object (`Options`) which contains options resolved by mgit.
+ * - an options object (`Options`) which contains options resolved by mrgit.
*/
/**
@@ -79,7 +79,7 @@ module.exports = function getCommandInstance( commandName ) {
*
* @property {String} packageName A name of package.
*
- * @propery {Options} mgitOptions Options resolved by mgit.
+ * @propery {Options} toolOptions Options resolved by mrgit.
*
* @property {String} commandPath An absolute path to the file that keeps the command.
*
diff --git a/lib/utils/getcwd.js b/lib/utils/getcwd.js
index 7253bbf..a028820 100644
--- a/lib/utils/getcwd.js
+++ b/lib/utils/getcwd.js
@@ -11,7 +11,7 @@ const path = require( 'upath' );
/**
* Returns an absolute path to the directory that contains a configuration file.
*
- * It scans directory tree up for `mgit.json` file. If the file won't be found,
+ * It scans directory tree up for `mrgit.json` file. If the file won't be found,
* an exception should be thrown.
*
* @returns {String}
@@ -19,11 +19,11 @@ const path = require( 'upath' );
module.exports = function cwdResolver() {
let cwd = process.cwd();
- while ( !fs.existsSync( path.join( cwd, 'mgit.json' ) ) ) {
+ while ( !fs.existsSync( path.join( cwd, 'mrgit.json' ) ) ) {
const parentCwd = path.resolve( cwd, '..' );
if ( cwd === parentCwd ) {
- throw new Error( 'Cannot find the "mgit.json" file.' );
+ throw new Error( 'Cannot find the "mrgit.json" file.' );
}
cwd = parentCwd;
diff --git a/lib/utils/getoptions.js b/lib/utils/getoptions.js
index 3c01921..155df43 100644
--- a/lib/utils/getoptions.js
+++ b/lib/utils/getoptions.js
@@ -10,11 +10,11 @@ const path = require( 'upath' );
/**
* @param {Object} callOptions Call options.
- * @param {String} cwd An absolute path to the directory where `mgit.json` is available.
+ * @param {String} cwd An absolute path to the directory where `mrgit.json` is available.
* @returns {Options} The options object.
*/
module.exports = function cwdResolver( callOptions, cwd ) {
- const mgitJsonPath = path.resolve( cwd, 'mgit.json' );
+ const mrgitJsonPath = path.resolve( cwd, 'mrgit.json' );
// Default options.
let options = {
@@ -30,8 +30,8 @@ module.exports = function cwdResolver( callOptions, cwd ) {
overrideDirectoryNames: {}
};
- if ( fs.existsSync( mgitJsonPath ) ) {
- options = Object.assign( options, require( mgitJsonPath ), options );
+ if ( fs.existsSync( mrgitJsonPath ) ) {
+ options = Object.assign( options, require( mrgitJsonPath ), options );
}
options = Object.assign( options, callOptions );
@@ -48,11 +48,11 @@ module.exports = function cwdResolver( callOptions, cwd ) {
/**
* @typedef {Object} Options
*
- * @property {String} cwd An absolute path to the directory which contains `mgit.json` file.
+ * @property {String} cwd An absolute path to the directory which contains `mrgit.json` file.
*
* @property {String} [packages='/packages/'] Directory to which all repositories will be cloned.
*
- * @property {String} [resolverPath='mgit2/lib/default-resolver.js'] Path to a custom repository resolver function.
+ * @property {String} [resolverPath='@mrgit/lib/default-resolver.js'] Path to a custom repository resolver function.
*
* @property {String} [resolverUrlTemplate='git@github.com:${ path }.git'] Template used to generate repository URL out of a
* simplified 'organization/repository' format of the dependencies option.
@@ -67,7 +67,7 @@ module.exports = function cwdResolver( callOptions, cwd ) {
* This option can be useful when scoped npm packages are used and one wants to decide
* whether the repository will be cloned to packages/@scope/pkgname' or 'packages/pkgname'.
*
- * @property {String} [resolverDefaultBranch='master'] The branch name to use if not specified in mgit.json dependencies.
+ * @property {String} [resolverDefaultBranch='master'] The branch name to use if not specified in mrgit.json dependencies.
*
* @property {String|null} [ignore=null] Ignores packages with names matching the given glob.
*
diff --git a/lib/utils/parserepositoryurl.js b/lib/utils/parserepositoryurl.js
index c03ec04..1145fc1 100644
--- a/lib/utils/parserepositoryurl.js
+++ b/lib/utils/parserepositoryurl.js
@@ -8,10 +8,10 @@
const url = require( 'url' );
/**
- * Parses repository URL taken from `mgit.json`'s dependencies and returns
+ * Parses repository URL taken from `mrgit.json`'s dependencies and returns
* it as an object containing repository URL and branch name.
*
- * @param {String} repositoryUrl The repository URL in formats supported by `mgit.json`.
+ * @param {String} repositoryUrl The repository URL in formats supported by `mrgit.json`.
* @param {Object} options
* @param {String} [options.urlTemplate] The URL template.
* Used if `repositoryUrl` defines only `'/'`.
diff --git a/package.json b/package.json
index 1e6ffc0..999e6a1 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "mgit2",
+ "name": "mrgit",
"version": "0.10.1",
"description": "A tool for managing projects build using multiple repositories.",
"keywords": [
@@ -40,7 +40,7 @@
},
"repository": {
"type": "git",
- "url": "git+https://github.com/cksource/mgit2.git"
+ "url": "git+https://github.com/cksource/mrgit.git"
},
"engines": {
"node": ">=6.0.0",
@@ -48,8 +48,8 @@
},
"author": "CKSource (http://cksource.com/)",
"license": "MIT",
- "bugs": "https://github.com/cksource/mgit2/issues",
- "homepage": "https://github.com/cksource/mgit2#readme",
+ "bugs": "https://github.com/cksource/mrgit/issues",
+ "homepage": "https://github.com/cksource/mrgit#readme",
"scripts": {
"test": "mocha tests --recursive",
"coverage": "istanbul cover _mocha tests -- --recursive",
@@ -59,8 +59,7 @@
"release": "node ./scripts/release.js"
},
"bin": {
- "mgit": "./index.js",
- "mgit2": "./index.js"
+ "mrgit": "./index.js"
},
"files": [
"index.js",
diff --git a/tests/commands/checkout.js b/tests/commands/checkout.js
index a46b96d..7255687 100644
--- a/tests/commands/checkout.js
+++ b/tests/commands/checkout.js
@@ -12,7 +12,7 @@ const mockery = require( 'mockery' );
const expect = require( 'chai' ).expect;
describe( 'commands/checkout', () => {
- let checkoutCommand, stubs, commandData, mgitOptions;
+ let checkoutCommand, stubs, commandData, toolOptions;
beforeEach( () => {
mockery.enable( {
@@ -28,14 +28,14 @@ describe( 'commands/checkout', () => {
gitStatusParser: sinon.stub()
};
- mgitOptions = {};
+ toolOptions = {};
commandData = {
arguments: [],
repository: {
branch: 'master'
},
- mgitOptions
+ toolOptions
};
mockery.registerMock( './exec', stubs.execCommand );
@@ -101,7 +101,7 @@ describe( 'commands/checkout', () => {
branch: 'master'
},
arguments: [ 'git checkout master' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -131,7 +131,7 @@ describe( 'commands/checkout', () => {
branch: 'master'
},
arguments: [ 'git checkout develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -142,7 +142,7 @@ describe( 'commands/checkout', () => {
} );
it( 'creates a new branch if a repository has changes that could be committed and specified --branch option', () => {
- mgitOptions.branch = 'develop';
+ toolOptions.branch = 'develop';
stubs.execCommand.execute.onFirstCall().resolves( {
logs: {
@@ -171,7 +171,7 @@ describe( 'commands/checkout', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -179,7 +179,7 @@ describe( 'commands/checkout', () => {
branch: 'master'
},
arguments: [ 'git checkout -b develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -189,7 +189,7 @@ describe( 'commands/checkout', () => {
} );
it( 'does not create a branch if a repository has no-changes that could be committed when specified --branch option', () => {
- mgitOptions.branch = 'develop';
+ toolOptions.branch = 'develop';
stubs.execCommand.execute.onFirstCall().resolves( {
logs: {
@@ -210,7 +210,7 @@ describe( 'commands/checkout', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
diff --git a/tests/commands/close.js b/tests/commands/close.js
index 6f419cc..7a0b840 100644
--- a/tests/commands/close.js
+++ b/tests/commands/close.js
@@ -12,7 +12,7 @@ const mockery = require( 'mockery' );
const expect = require( 'chai' ).expect;
describe( 'commands/close', () => {
- let closeCommand, stubs, commandData, mgitOptions;
+ let closeCommand, stubs, commandData, toolOptions;
beforeEach( () => {
mockery.enable( {
@@ -27,14 +27,14 @@ describe( 'commands/close', () => {
}
};
- mgitOptions = {};
+ toolOptions = {};
commandData = {
arguments: [],
repository: {
branch: 'master'
},
- mgitOptions
+ toolOptions
};
mockery.registerMock( './exec', stubs.execCommand );
@@ -58,7 +58,7 @@ describe( 'commands/close', () => {
it( 'throws an error if command to execute is not specified', () => {
expect( () => {
closeCommand.beforeExecute( [ 'merge' ] );
- } ).to.throw( Error, 'Missing branch to merge. Use: mgit close [branch].' );
+ } ).to.throw( Error, 'Missing branch to merge. Use: mrgit close [branch].' );
} );
it( 'does nothing if branch to merge is specified', () => {
@@ -138,7 +138,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch --list develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 1 ).args[ 0 ] ).to.deep.equal( {
@@ -146,7 +146,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git merge develop --no-ff -m "Merge branch \'develop\'"' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 2 ).args[ 0 ] ).to.deep.equal( {
@@ -154,7 +154,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch -d develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 3 ).args[ 0 ] ).to.deep.equal( {
@@ -162,7 +162,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git push origin :develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -180,7 +180,7 @@ describe( 'commands/close', () => {
} );
} );
- // mgit close develop -- --message "Test."
+ // mrgit close develop -- --message "Test."
it( 'merges specified branch using specified message', () => {
commandData.arguments.push( 'develop' );
commandData.arguments.push( '--message' );
@@ -232,7 +232,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch --list develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 1 ).args[ 0 ] ).to.deep.equal( {
@@ -240,7 +240,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git merge develop --no-ff -m "Merge branch \'develop\'" -m "Test."' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 2 ).args[ 0 ] ).to.deep.equal( {
@@ -248,7 +248,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch -d develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 3 ).args[ 0 ] ).to.deep.equal( {
@@ -256,7 +256,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git push origin :develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -274,11 +274,11 @@ describe( 'commands/close', () => {
} );
} );
- // mgit close develop --message "Test."
- it( 'merges specified branch using specified message when specified as a param of mgit', () => {
+ // mrgit close develop --message "Test."
+ it( 'merges specified branch using specified message when specified as a param of mrgit', () => {
commandData.arguments.push( 'develop' );
- mgitOptions.message = 'Test.';
+ toolOptions.message = 'Test.';
stubs.execCommand.execute.onCall( 0 ).resolves( {
logs: {
@@ -326,7 +326,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch --list develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 1 ).args[ 0 ] ).to.deep.equal( {
@@ -334,7 +334,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git merge develop --no-ff -m "Merge branch \'develop\'" -m "Test."' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 2 ).args[ 0 ] ).to.deep.equal( {
@@ -342,7 +342,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch -d develop' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.getCall( 3 ).args[ 0 ] ).to.deep.equal( {
@@ -350,7 +350,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git push origin :develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -391,7 +391,7 @@ describe( 'commands/close', () => {
branch: 'master'
},
arguments: [ 'git branch --list develop' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
diff --git a/tests/commands/commit.js b/tests/commands/commit.js
index 9c5c250..2bca547 100644
--- a/tests/commands/commit.js
+++ b/tests/commands/commit.js
@@ -12,7 +12,7 @@ const mockery = require( 'mockery' );
const expect = require( 'chai' ).expect;
describe( 'commands/commit', () => {
- let commitCommand, stubs, commandData, mgitOptions;
+ let commitCommand, stubs, commandData, toolOptions;
beforeEach( () => {
mockery.enable( {
@@ -28,14 +28,14 @@ describe( 'commands/commit', () => {
gitStatusParser: sinon.stub()
};
- mgitOptions = {};
+ toolOptions = {};
commandData = {
arguments: [],
repository: {
branch: 'master'
},
- mgitOptions
+ toolOptions
};
mockery.registerMock( './exec', stubs.execCommand );
@@ -68,7 +68,7 @@ describe( 'commands/commit', () => {
expect( () => {
commitCommand.beforeExecute( [ 'commit' ], {} );
- } ).to.throw( Error, 'Missing --message (-m) option. Call "mgit commit -h" in order to read more.' );
+ } ).to.throw( Error, 'Missing --message (-m) option. Call "mrgit commit -h" in order to read more.' );
} );
it( 'does nothing if specified message for commit (as git option)', () => {
@@ -77,7 +77,7 @@ describe( 'commands/commit', () => {
} ).to.not.throw( Error );
} );
- it( 'does nothing if specified message for commit (as mgit option)', () => {
+ it( 'does nothing if specified message for commit (as mrgit option)', () => {
expect( () => {
commitCommand.beforeExecute( [ 'commit' ], { message: 'Test.' } );
} ).to.not.throw( Error );
@@ -106,7 +106,7 @@ describe( 'commands/commit', () => {
} );
it( 'commits all changes', () => {
- mgitOptions.message = 'Test.';
+ toolOptions.message = 'Test.';
stubs.execCommand.execute.onFirstCall().resolves( {
logs: {
@@ -135,7 +135,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -143,7 +143,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git commit -a -m "Test."' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -183,7 +183,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -191,7 +191,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git commit -a -m "Test."' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -232,7 +232,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -240,7 +240,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git commit -a -m "Test" -n' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -250,7 +250,7 @@ describe( 'commands/commit', () => {
} );
it( 'accepts duplicated `--message` option', () => {
- mgitOptions.message = [
+ toolOptions.message = [
'Test.',
'Foo.'
];
@@ -282,7 +282,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -290,7 +290,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git commit -a -m "Test." -m "Foo."' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -332,7 +332,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( stubs.execCommand.execute.secondCall.args[ 0 ] ).to.deep.equal( {
@@ -340,7 +340,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git commit -a -m "Test." -m "Foo."' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
@@ -372,7 +372,7 @@ describe( 'commands/commit', () => {
branch: 'master'
},
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions
+ toolOptions
} );
expect( commandResponse.logs.info ).to.deep.equal( [
diff --git a/tests/commands/exec.js b/tests/commands/exec.js
index 41077e8..fc6d1da 100644
--- a/tests/commands/exec.js
+++ b/tests/commands/exec.js
@@ -38,10 +38,10 @@ describe( 'commands/exec', () => {
commandData = {
// Command `#execute` function is called without the "exec" command.
- // `mgit exec pwd` => [ 'pwd' ]
+ // `mrgit exec pwd` => [ 'pwd' ]
arguments: [ 'pwd' ],
packageName: 'test-package',
- mgitOptions: {
+ toolOptions: {
cwd: __dirname,
packages: 'packages'
},
@@ -70,9 +70,9 @@ describe( 'commands/exec', () => {
describe( 'beforeExecute()', () => {
it( 'throws an error if command to execute is not specified', () => {
expect( () => {
- // `beforeExecute` is called with full user's input (mgit exec [command-to-execute]).
+ // `beforeExecute` is called with full user's input (mrgit exec [command-to-execute]).
execCommand.beforeExecute( [ 'exec' ] );
- } ).to.throw( Error, 'Missing command to execute. Use: mgit exec [command-to-execute].' );
+ } ).to.throw( Error, 'Missing command to execute. Use: mrgit exec [command-to-execute].' );
} );
it( 'does nothing if command is specified', () => {
@@ -92,7 +92,7 @@ describe( 'commands/exec', () => {
throw new Error( 'Supposed to be rejected.' );
},
response => {
- const err = 'Package "test-package" is not available. Run "mgit sync" in order to download the package.';
+ const err = 'Package "test-package" is not available. Run "mrgit sync" in order to download the package.';
expect( response.logs.error[ 0 ] ).to.equal( err );
}
);
diff --git a/tests/commands/fetch.js b/tests/commands/fetch.js
index 541a323..71c13af 100644
--- a/tests/commands/fetch.js
+++ b/tests/commands/fetch.js
@@ -39,7 +39,7 @@ describe( 'commands/fetch', () => {
commandData = {
arguments: [],
packageName: 'test-package',
- mgitOptions: {
+ toolOptions: {
cwd: __dirname,
packages: 'packages'
},
diff --git a/tests/commands/pull.js b/tests/commands/pull.js
index 4427a12..e1df869 100644
--- a/tests/commands/pull.js
+++ b/tests/commands/pull.js
@@ -42,7 +42,7 @@ describe( 'commands/pull', () => {
commandData = {
arguments: [],
packageName: 'test-package',
- mgitOptions: {
+ toolOptions: {
cwd: __dirname,
packages: 'packages'
},
diff --git a/tests/commands/push.js b/tests/commands/push.js
index 9861957..720e55b 100644
--- a/tests/commands/push.js
+++ b/tests/commands/push.js
@@ -39,7 +39,7 @@ describe( 'commands/push', () => {
commandData = {
arguments: [],
packageName: 'test-package',
- mgitOptions: {
+ toolOptions: {
cwd: __dirname,
packages: 'packages'
},
diff --git a/tests/commands/save.js b/tests/commands/save.js
index 09b61f8..4e26b42 100644
--- a/tests/commands/save.js
+++ b/tests/commands/save.js
@@ -13,7 +13,7 @@ const mockery = require( 'mockery' );
const expect = require( 'chai' ).expect;
describe( 'commands/save', () => {
- let saveCommand, stubs, commandData, mgitOptions, mgitJsonPath, updateFunction;
+ let saveCommand, stubs, commandData, toolOptions, mrgitJsonPath, updateFunction;
beforeEach( () => {
mockery.enable( {
@@ -32,17 +32,17 @@ describe( 'commands/save', () => {
gitStatusParser: sinon.stub()
};
- mgitOptions = {};
+ toolOptions = {};
commandData = {
packageName: 'test-package',
arguments: [],
- mgitOptions
+ toolOptions
};
mockery.registerMock( './exec', stubs.execCommand );
mockery.registerMock( '../utils/updatejsonfile', ( pathToFile, callback ) => {
- mgitJsonPath = pathToFile;
+ mrgitJsonPath = pathToFile;
updateFunction = callback;
} );
mockery.registerMock( '../utils/getcwd', () => {
@@ -67,25 +67,25 @@ describe( 'commands/save', () => {
describe( 'beforeExecute()', () => {
it( 'defined which type of data should be saved', () => {
- saveCommand.beforeExecute( [], mgitOptions );
- expect( mgitOptions.hash ).to.equal( true );
+ saveCommand.beforeExecute( [], toolOptions );
+ expect( toolOptions.hash ).to.equal( true );
} );
it( 'throws an error if used both options', () => {
const errorMessage = 'Cannot use "hash" and "branch" options at the same time.';
- mgitOptions.branch = true;
- mgitOptions.hash = true;
+ toolOptions.branch = true;
+ toolOptions.hash = true;
expect( () => {
- saveCommand.beforeExecute( [], mgitOptions );
+ saveCommand.beforeExecute( [], toolOptions );
} ).to.throw( Error, errorMessage );
} );
} );
describe( 'execute()', () => {
it( 'rejects promise if called command returned an error', () => {
- mgitOptions.hash = true;
+ toolOptions.hash = true;
const error = new Error( 'Unexpected error.' );
@@ -107,7 +107,7 @@ describe( 'commands/save', () => {
} );
it( 'resolves promise with last commit id', () => {
- mgitOptions.hash = true;
+ toolOptions.hash = true;
const execCommandResponse = {
logs: {
@@ -123,7 +123,7 @@ describe( 'commands/save', () => {
expect( stubs.execCommand.execute.firstCall.args[ 0 ] ).to.deep.equal( {
packageName: commandData.packageName,
arguments: [ 'git rev-parse HEAD' ],
- mgitOptions: {
+ toolOptions: {
hash: true,
}
} );
@@ -146,7 +146,7 @@ describe( 'commands/save', () => {
}
};
- mgitOptions.branch = true;
+ toolOptions.branch = true;
stubs.gitStatusParser.returns( { branch: 'master' } );
stubs.execCommand.execute.returns( Promise.resolve( execCommandResponse ) );
@@ -157,7 +157,7 @@ describe( 'commands/save', () => {
expect( stubs.execCommand.execute.firstCall.args[ 0 ] ).to.deep.equal( {
packageName: commandData.packageName,
arguments: [ 'git status --branch --porcelain' ],
- mgitOptions: {
+ toolOptions: {
branch: true,
}
} );
@@ -175,7 +175,7 @@ describe( 'commands/save', () => {
} );
describe( 'afterExecute()', () => {
- it( 'updates collected hashes in "mgit.json" (--hash option)', () => {
+ it( 'updates collected hashes in "mrgit.json" (--hash option)', () => {
const processedPackages = new Set();
const commandResponses = new Set();
@@ -205,7 +205,7 @@ describe( 'commands/save', () => {
}
};
- expect( mgitJsonPath ).to.equal( __dirname + '/mgit.json' );
+ expect( mrgitJsonPath ).to.equal( __dirname + '/mrgit.json' );
expect( updateFunction ).to.be.a( 'function' );
json = updateFunction( json );
@@ -217,7 +217,7 @@ describe( 'commands/save', () => {
} );
} );
- it( 'updates collected branches in "mgit.json" (--branch option)', () => {
+ it( 'updates collected branches in "mrgit.json" (--branch option)', () => {
const processedPackages = new Set();
const commandResponses = new Set();
@@ -247,7 +247,7 @@ describe( 'commands/save', () => {
}
};
- expect( mgitJsonPath ).to.equal( __dirname + '/mgit.json' );
+ expect( mrgitJsonPath ).to.equal( __dirname + '/mrgit.json' );
expect( updateFunction ).to.be.a( 'function' );
json = updateFunction( json );
@@ -280,7 +280,7 @@ describe( 'commands/save', () => {
}
};
- expect( mgitJsonPath ).to.equal( __dirname + '/mgit.json' );
+ expect( mrgitJsonPath ).to.equal( __dirname + '/mrgit.json' );
expect( updateFunction ).to.be.a( 'function' );
json = updateFunction( json );
diff --git a/tests/commands/status.js b/tests/commands/status.js
index 9d46d0c..91aaaaf 100644
--- a/tests/commands/status.js
+++ b/tests/commands/status.js
@@ -43,7 +43,7 @@ describe( 'commands/status', () => {
};
commandData = {
- mgitOptions: {
+ toolOptions: {
packagesPrefix: '@ckeditor/ckeditor5-'
},
repository: {
@@ -165,7 +165,7 @@ describe( 'commands/status', () => {
packageName: 'test-package',
commit: '6bfd379',
status: { response: 'Parsed response.' },
- mgitBranch: 'master'
+ mrgitBranch: 'master'
} );
} );
@@ -177,7 +177,7 @@ describe( 'commands/status', () => {
} );
it( 'modifies the package name if "packagesPrefix" is an array', () => {
- commandData.mgitOptions.packagesPrefix = [
+ commandData.toolOptions.packagesPrefix = [
'@ckeditor/ckeditor-',
'@ckeditor/ckeditor5-',
];
@@ -212,7 +212,7 @@ describe( 'commands/status', () => {
packageName: 'test-package',
commit: '6bfd379',
status: { response: 'Parsed response.' },
- mgitBranch: 'master'
+ mrgitBranch: 'master'
} );
} );
@@ -224,8 +224,8 @@ describe( 'commands/status', () => {
} );
it( 'does not modify the package name if "packagesPrefix" option is not specified', () => {
- // Mgit resolves this option to be an empty array if it isn't specified.
- commandData.mgitOptions.packagesPrefix = [];
+ // mrgit resolves this option to be an empty array if it isn't specified.
+ commandData.toolOptions.packagesPrefix = [];
stubs.execCommand.execute.onFirstCall().resolves( {
logs: {
@@ -246,7 +246,7 @@ describe( 'commands/status', () => {
packageName: '@ckeditor/ckeditor5-test-package',
commit: '6bfd379',
status: { response: 'Parsed response.' },
- mgitBranch: 'master'
+ mrgitBranch: 'master'
} );
} );
} );
@@ -300,7 +300,7 @@ describe( 'commands/status', () => {
modified: [ 'README.md' ],
untracked: [],
},
- mgitBranch: 'master',
+ mrgitBranch: 'master',
commit: 'abcd123'
} );
@@ -314,7 +314,7 @@ describe( 'commands/status', () => {
modified: [],
untracked: [ 'CHANGELOG.md' ],
},
- mgitBranch: 't/1',
+ mrgitBranch: 't/1',
commit: 'ef45678'
} );
@@ -364,7 +364,7 @@ describe( 'commands/status', () => {
modified: [],
untracked: [],
},
- mgitBranch: 'master',
+ mrgitBranch: 'master',
commit: 'abcd123'
} );
@@ -392,7 +392,7 @@ describe( 'commands/status', () => {
modified: [],
untracked: [],
},
- mgitBranch: 'master',
+ mrgitBranch: 'master',
commit: 'abcd123'
} );
@@ -402,7 +402,7 @@ describe( 'commands/status', () => {
logStub.restore();
} );
- it( 'adds "!" before the branch name if current branch is other than defined in "mgit.json"', () => {
+ it( 'adds "!" before the branch name if current branch is other than defined in "mrgit.json"', () => {
const logStub = sinon.stub( console, 'log' );
const processedPackages = new Set();
@@ -420,7 +420,7 @@ describe( 'commands/status', () => {
modified: [],
untracked: [],
},
- mgitBranch: 'master',
+ mrgitBranch: 'master',
commit: 'ef45678'
} );
@@ -472,7 +472,7 @@ describe( 'commands/status', () => {
modified: [],
untracked: [],
},
- mgitBranch: 'master',
+ mrgitBranch: 'master',
commit
};
}
diff --git a/tests/commands/sync.js b/tests/commands/sync.js
index 0245192..ab31f66 100644
--- a/tests/commands/sync.js
+++ b/tests/commands/sync.js
@@ -14,7 +14,7 @@ const mockery = require( 'mockery' );
const expect = require( 'chai' ).expect;
describe( 'commands/sync', () => {
- let syncCommand, stubs, mgitOptions, commandData;
+ let syncCommand, stubs, toolOptions, commandData;
beforeEach( () => {
mockery.enable( {
@@ -42,7 +42,7 @@ describe( 'commands/sync', () => {
repositoryResolver: sinon.stub()
};
- mgitOptions = {
+ toolOptions = {
cwd: '/tmp',
packages: '/tmp/packages',
resolverPath: 'PATH_TO_RESOLVER'
@@ -51,7 +51,7 @@ describe( 'commands/sync', () => {
commandData = {
arguments: [],
packageName: 'test-package',
- mgitOptions,
+ toolOptions,
repository: {
directory: 'test-package',
url: 'git@github.com/organization/test-package.git',
@@ -107,8 +107,8 @@ describe( 'commands/sync', () => {
} );
it( 'clones dependencies of installed package', () => {
- mgitOptions.recursive = true;
- commandData.mgitOptions.packages = __dirname + '/../fixtures';
+ toolOptions.recursive = true;
+ commandData.toolOptions.packages = __dirname + '/../fixtures';
commandData.repository.directory = 'project-a';
stubs.fs.existsSync.returns( false );
@@ -122,9 +122,9 @@ describe( 'commands/sync', () => {
} );
it( 'clones dev-dependencies of installed package', () => {
- mgitOptions.recursive = true;
- commandData.mgitOptions.packages = __dirname + '/../fixtures';
- commandData.repository.directory = 'project-with-options-in-mgitjson';
+ toolOptions.recursive = true;
+ commandData.toolOptions.packages = __dirname + '/../fixtures';
+ commandData.repository.directory = 'project-with-options-in-mrgitjson';
stubs.fs.existsSync.returns( false );
stubs.shell.returns( Promise.resolve( 'Git clone log.' ) );
@@ -136,7 +136,7 @@ describe( 'commands/sync', () => {
} );
} );
- describe( 'repeat installation process', function() {
+ describe( 'repeats installation process', function() {
this.timeout( 5500 );
const cloneCommand = 'git clone --progress "git@github.com/organization/test-package.git" "/tmp/packages/test-package"';
@@ -462,7 +462,7 @@ describe( 'commands/sync', () => {
} );
describe( 'afterExecute()', () => {
- it( 'informs about number of processed packages and differences between packages in directory and defined in mgit.json', () => {
+ it( 'informs about number of processed packages and differences between packages in directory and defined in mrgit.json', () => {
stubs.fs.lstatSync = sinon.stub( fs, 'lstatSync' );
const consoleLog = sinon.stub( console, 'log' );
@@ -471,7 +471,7 @@ describe( 'commands/sync', () => {
processedPackages.add( 'package-1' );
processedPackages.add( 'package-2' );
- mgitOptions.dependencies = {
+ toolOptions.dependencies = {
'package-1': 'foo/package-1',
'package-2': 'foo/package-2',
};
@@ -498,18 +498,18 @@ describe( 'commands/sync', () => {
}
} );
- syncCommand.afterExecute( processedPackages, null, mgitOptions );
+ syncCommand.afterExecute( processedPackages, null, toolOptions );
consoleLog.restore();
expect( consoleLog.callCount ).to.equal( 3 );
expect( consoleLog.firstCall.args[ 0 ] ).to.match( /2 packages have been processed\./ );
expect( consoleLog.secondCall.args[ 0 ] ).to.match(
- /Paths to directories listed below are skipped by mgit because they are not defined in "mgit\.json":/
+ /Paths to directories listed below are skipped by mrgit because they are not defined in "mrgit\.json":/
);
expect( consoleLog.thirdCall.args[ 0 ] ).to.match( / {2}- .*\/packages\/package-3/ );
} );
- it( 'informs about differences between packages in directory and defined in mgit.json for scopes packages', () => {
+ it( 'informs about differences between packages in directory and defined in mrgit.json for scopes packages', () => {
stubs.fs.lstatSync = sinon.stub( fs, 'lstatSync' );
const consoleLog = sinon.stub( console, 'log' );
@@ -518,7 +518,7 @@ describe( 'commands/sync', () => {
processedPackages.add( 'package-1' );
processedPackages.add( 'package-2' );
- mgitOptions.dependencies = {
+ toolOptions.dependencies = {
'package-1': 'foo/package-1',
'package-2': 'foo/package-2',
};
@@ -556,18 +556,18 @@ describe( 'commands/sync', () => {
}
} );
- syncCommand.afterExecute( processedPackages, null, mgitOptions );
+ syncCommand.afterExecute( processedPackages, null, toolOptions );
consoleLog.restore();
expect( consoleLog.callCount ).to.equal( 3 );
expect( consoleLog.firstCall.args[ 0 ] ).to.match( /2 packages have been processed\./ );
expect( consoleLog.secondCall.args[ 0 ] ).to.match(
- /Paths to directories listed below are skipped by mgit because they are not defined in "mgit\.json":/
+ /Paths to directories listed below are skipped by mrgit because they are not defined in "mrgit\.json":/
);
expect( consoleLog.thirdCall.args[ 0 ] ).to.match( / {2}- .*\/packages\/@foo\/package-3/ );
} );
- it( 'does not inform about differences between packages in directory and defined in mgit.json if everything seems to be ok', () => {
+ it( 'does not inform about differences between packages in directory and defined in mrgit.json if everything is ok', () => {
stubs.fs.lstatSync = sinon.stub( fs, 'lstatSync' );
const consoleLog = sinon.stub( console, 'log' );
@@ -576,7 +576,7 @@ describe( 'commands/sync', () => {
processedPackages.add( 'package-1' );
processedPackages.add( 'package-2' );
- mgitOptions.dependencies = {
+ toolOptions.dependencies = {
'package-1': 'foo/package-1',
'package-2': 'foo/package-2',
};
@@ -595,7 +595,7 @@ describe( 'commands/sync', () => {
}
} );
- syncCommand.afterExecute( processedPackages, null, mgitOptions );
+ syncCommand.afterExecute( processedPackages, null, toolOptions );
expect( consoleLog.callCount ).to.equal( 1 );
expect( consoleLog.firstCall.args[ 0 ] ).to.match( /2 packages have been processed\./ );
diff --git a/tests/default-resolver.js b/tests/default-resolver.js
index bb0e98c..68cbdf9 100644
--- a/tests/default-resolver.js
+++ b/tests/default-resolver.js
@@ -46,25 +46,25 @@ describe( 'default resolver()', () => {
it( 'returns original URL if git URL is specified', () => {
expect( resolver( 'full-url-git', options ) ).to.deep.equal( {
- url: 'git@github.com:cksource/mgit2.git',
+ url: 'git@github.com:cksource/mrgit.git',
branch: 'master',
- directory: 'mgit2'
+ directory: 'mrgit'
} );
} );
it( 'returns original URL and branch if git URL is specified', () => {
expect( resolver( 'full-url-git-with-branch', options ) ).to.deep.equal( {
- url: 'git@github.com:cksource/mgit2.git',
+ url: 'git@github.com:cksource/mrgit.git',
branch: 'xyz',
- directory: 'mgit2'
+ directory: 'mrgit'
} );
} );
it( 'returns original URL if HTTPS URL is specified', () => {
expect( resolver( 'full-url-https', options ) ).to.deep.equal( {
- url: 'https://github.com/cksource/mgit2.git',
+ url: 'https://github.com/cksource/mrgit.git',
branch: 'master',
- directory: 'mgit2'
+ directory: 'mrgit'
} );
} );
} );
@@ -84,9 +84,9 @@ describe( 'default resolver()', () => {
it( 'returns original URL if git URL is specified', () => {
expect( resolver( 'full-url-git', options ) ).to.deep.equal( {
- url: 'git@github.com:cksource/mgit2.git',
+ url: 'git@github.com:cksource/mrgit.git',
branch: 'master',
- directory: 'mgit2'
+ directory: 'mrgit'
} );
} );
} );
diff --git a/tests/fixtures/project-a/mgit.json b/tests/fixtures/project-a/mrgit.json
similarity index 57%
rename from tests/fixtures/project-a/mgit.json
rename to tests/fixtures/project-a/mrgit.json
index 8466f9a..045266c 100644
--- a/tests/fixtures/project-a/mgit.json
+++ b/tests/fixtures/project-a/mrgit.json
@@ -3,9 +3,9 @@
"simple-package": "a/b",
"package-with-branch": "a/b#dev",
"@scoped/package": "c/d",
- "full-url-git": "git@github.com:cksource/mgit2.git",
- "full-url-git-with-branch": "git@github.com:cksource/mgit2.git#xyz",
- "full-url-https": "https://github.com/cksource/mgit2.git",
+ "full-url-git": "git@github.com:cksource/mrgit.git",
+ "full-url-git-with-branch": "git@github.com:cksource/mrgit.git#xyz",
+ "full-url-https": "https://github.com/cksource/mrgit.git",
"override-directory": "foo/bar"
},
"overrideDirectoryNames": {
diff --git a/tests/fixtures/project-with-options-in-mgitjson/mgit.json b/tests/fixtures/project-with-options-in-mrgitjson/mrgit.json
similarity index 100%
rename from tests/fixtures/project-with-options-in-mgitjson/mgit.json
rename to tests/fixtures/project-with-options-in-mrgitjson/mrgit.json
diff --git a/tests/fixtures/project-with-options-in-mgitjson/package.json b/tests/fixtures/project-with-options-in-mrgitjson/package.json
similarity index 100%
rename from tests/fixtures/project-with-options-in-mgitjson/package.json
rename to tests/fixtures/project-with-options-in-mrgitjson/package.json
diff --git a/tests/utils/getcwd.js b/tests/utils/getcwd.js
index a88bb5c..8d30d57 100644
--- a/tests/utils/getcwd.js
+++ b/tests/utils/getcwd.js
@@ -18,14 +18,14 @@ describe( 'utils', () => {
} );
describe( 'getCwd()', () => {
- it( 'returns "process.cwd()" value if the "mgit.json" has been found', () => {
+ it( 'returns "process.cwd()" value if the "mrgit.json" has been found', () => {
sinon.stub( process, 'cwd' ).returns( '/workspace/ckeditor/ckeditor5' );
sinon.stub( fs, 'existsSync' ).returns( true );
expect( getCwd() ).to.equal( '/workspace/ckeditor/ckeditor5' );
} );
- it( 'scans dir tree up in order to find "mgit.json" file', () => {
+ it( 'scans dir tree up in order to find "mrgit.json" file', () => {
sinon.stub( process, 'cwd' ).returns( '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/node_modules/@ckeditor' );
const existsSync = sinon.stub( fs, 'existsSync' );
@@ -44,21 +44,21 @@ describe( 'utils', () => {
expect( getCwd() ).to.equal( '/workspace/ckeditor/ckeditor5' );
expect( existsSync.getCall( 0 ).args[ 0 ] ).to.equal(
- '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/node_modules/@ckeditor/mgit.json'
+ '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/node_modules/@ckeditor/mrgit.json'
);
expect( existsSync.getCall( 1 ).args[ 0 ] ).to.equal(
- '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/node_modules/mgit.json'
+ '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/node_modules/mrgit.json'
);
- expect( existsSync.getCall( 2 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/mgit.json' );
- expect( existsSync.getCall( 3 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/packages/mgit.json' );
- expect( existsSync.getCall( 4 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/mgit.json' );
+ expect( existsSync.getCall( 2 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/packages/ckeditor5-engine/mrgit.json' );
+ expect( existsSync.getCall( 3 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/packages/mrgit.json' );
+ expect( existsSync.getCall( 4 ).args[ 0 ] ).to.equal( '/workspace/ckeditor/ckeditor5/mrgit.json' );
} );
- it( 'throws an error if the "mgit.json" cannot be found', () => {
+ it( 'throws an error if the "mrgit.json" cannot be found', () => {
sinon.stub( process, 'cwd' ).returns( '/workspace/ckeditor' );
sinon.stub( fs, 'existsSync' ).returns( false );
- expect( () => getCwd() ).to.throw( Error, 'Cannot find the "mgit.json" file.' );
+ expect( () => getCwd() ).to.throw( Error, 'Cannot find the "mrgit.json" file.' );
} );
} );
} );
diff --git a/tests/utils/getoptions.js b/tests/utils/getoptions.js
index cd7e37d..27b63c6 100644
--- a/tests/utils/getoptions.js
+++ b/tests/utils/getoptions.js
@@ -37,15 +37,15 @@ describe( 'utils', () => {
} );
} );
- it( 'returns depepndencies read from mgit.json', () => {
+ it( 'returns depepndencies read from mrgit.json', () => {
const options = getOptions( {}, cwd );
- const mgitJson = require( path.join( cwd, 'mgit.json' ) );
+ const mrgitJson = require( path.join( cwd, 'mrgit.json' ) );
- expect( options.dependencies ).to.deep.equal( mgitJson.dependencies );
+ expect( options.dependencies ).to.deep.equal( mrgitJson.dependencies );
} );
- it( 'does not fail if mgit.json is not defined ', () => {
- const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-no-mgitjson' );
+ it( 'does not fail if mrgit.json is not defined ', () => {
+ const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-no-mrgitjson' );
const options = getOptions( {}, cwd );
expect( options ).to.deep.equal( {
@@ -62,8 +62,8 @@ describe( 'utils', () => {
} );
} );
- it( 'reads options from mgit.json', () => {
- const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-options-in-mgitjson' );
+ it( 'reads options from mrgit.json', () => {
+ const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-options-in-mrgitjson' );
const options = getOptions( {}, cwd );
expect( options ).to.deep.equal( {
@@ -84,7 +84,7 @@ describe( 'utils', () => {
} );
it( 'priorities passed options', () => {
- const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-options-in-mgitjson' );
+ const cwd = path.resolve( __dirname, '..', 'fixtures', 'project-with-options-in-mrgitjson' );
const options = getOptions( {
resolverUrlTemplate: 'a/b/c',
packages: 'bar'