Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
20
node_modules/gulp-git/LICENSE
generated
vendored
Normal file
20
node_modules/gulp-git/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2015 Steve Lacy <me@slacy.me> slacy.me
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
786
node_modules/gulp-git/README.md
generated
vendored
Normal file
786
node_modules/gulp-git/README.md
generated
vendored
Normal file
|
@ -0,0 +1,786 @@
|
|||
# gulp-git
|
||||
|
||||
[](https://travis-ci.org/stevelacy/gulp-git)
|
||||
[](http://badge.fury.io/js/gulp-git)
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>Package</td><td>gulp-git</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>Git plugin for gulp (gulpjs.com)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Node Version</td>
|
||||
<td>>= 0.9</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gulp Version</td>
|
||||
<td>3.x</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
### Install
|
||||
npm install gulp-git --save
|
||||
|
||||
#### 0.4.0 introduced Breaking Changes!
|
||||
Git actions which did not require a [Vinyl](https://github.com/wearefractal/vinyl) file were refactored.
|
||||
Please review the following docs for changes:
|
||||
##Example
|
||||
|
||||
```javascript
|
||||
var gulp = require('gulp');
|
||||
var git = require('gulp-git');
|
||||
|
||||
// Run git init
|
||||
// src is the root folder for git to initialize
|
||||
gulp.task('init', function(){
|
||||
git.init(function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git init with options
|
||||
gulp.task('init', function(){
|
||||
git.init({args: '--quiet --bare'}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git add
|
||||
// src is the file(s) to add (or ./*)
|
||||
gulp.task('add', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.add());
|
||||
});
|
||||
|
||||
// Run git add with options
|
||||
gulp.task('add', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.add({args: '-f -i -p'}));
|
||||
});
|
||||
|
||||
// Run git commit
|
||||
// src are the files to commit (or ./*)
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit('initial commit'));
|
||||
});
|
||||
|
||||
// Run git commit with a computed commit message
|
||||
gulp.task('commit', function(){
|
||||
let newVersion;
|
||||
function computeNewVersion() { newVersion = /* ... */ }
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(computeNewVersion())
|
||||
.pipe(git.commit(() => `Bumps to version ${newVersion}`));
|
||||
});
|
||||
|
||||
// Run git commit with options
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit('initial commit', {args: '-A --amend -s'}));
|
||||
});
|
||||
|
||||
// Run git commit without checking for a message using raw arguments
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit(undefined, {
|
||||
args: '-m "initial commit"',
|
||||
disableMessageRequirement: true
|
||||
}));
|
||||
});
|
||||
|
||||
// Run git commit without appending a path to the commits
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit('initial commit', {
|
||||
disableAppendPaths: true
|
||||
}));
|
||||
});
|
||||
|
||||
// Run git commit, passing multiple messages as if calling
|
||||
// git commit -m "initial commit" -m "additional message"
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit(['initial commit', 'additional message']));
|
||||
});
|
||||
|
||||
// Run git commit, emiting 'data' event during progress
|
||||
// This is useful when you have long running githooks
|
||||
// and want to show progress to your users on screen
|
||||
gulp.task('commit', function(){
|
||||
return gulp.src('./git-test/*')
|
||||
.pipe(git.commit('initial commit', {emitData:true}))
|
||||
.on('data',function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
|
||||
// Run git remote add
|
||||
// remote is the remote repo
|
||||
// repo is the https url of the repo
|
||||
gulp.task('addremote', function(){
|
||||
git.addRemote('origin', 'https://github.com/stevelacy/git-test', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git remote remove
|
||||
// remote is the remote repo
|
||||
gulp.task('removeremote', function(){
|
||||
git.removeRemote('origin', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git push
|
||||
// remote is the remote repo
|
||||
// branch is the remote branch to push to
|
||||
gulp.task('push', function(){
|
||||
git.push('origin', 'master', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git push
|
||||
// branch is the current branch & remote branch to push to
|
||||
gulp.task('push', function(){
|
||||
git.push('origin', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git push with options
|
||||
// branch is the remote branch to push to
|
||||
gulp.task('push', function(){
|
||||
git.push('origin', 'master', {args: " -f"}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git push with multiple branches and tags
|
||||
gulp.task('push', function(){
|
||||
git.push('origin', ['master', 'develop'], {args: " --tags"}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git pull
|
||||
// remote is the remote repo
|
||||
// branch is the remote branch to pull from
|
||||
gulp.task('pull', function(){
|
||||
git.pull('origin', 'master', {args: '--rebase'}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git pull from multiple branches
|
||||
gulp.task('pull', function(){
|
||||
git.pull('origin', ['master', 'develop'], function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git fetch
|
||||
// Fetch refs from all remotes
|
||||
gulp.task('fetch', function(){
|
||||
git.fetch('', '', {args: '--all'}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Run git fetch
|
||||
// Fetch refs from origin
|
||||
gulp.task('fetch', function(){
|
||||
git.fetch('origin', '', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Clone a remote repo
|
||||
gulp.task('clone', function(){
|
||||
git.clone('https://github.com/stevelacy/gulp-git', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Clone remote repo to sub folder ($CWD/sub/folder/git-test)
|
||||
gulp.task('clonesub', function() {
|
||||
git.clone('https://github.com/stevelacy/git-test', {args: './sub/folder'}, function(err) {
|
||||
// handle err
|
||||
});
|
||||
});
|
||||
|
||||
// Tag the repo with a version
|
||||
gulp.task('tag', function(){
|
||||
git.tag('v1.1.1', 'Version message', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Tag the repo with a version and empty message
|
||||
gulp.task('tag', function(){
|
||||
git.tag('v1.1.1', '', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Tag the repo With signed key
|
||||
gulp.task('tagsec', function(){
|
||||
git.tag('v1.1.1', 'Version message with signed key', {signed: true}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Create a git branch
|
||||
gulp.task('branch', function(){
|
||||
git.branch('newBranch', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Checkout a git branch
|
||||
gulp.task('checkout', function(){
|
||||
git.checkout('branchName', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Create and switch to a git branch
|
||||
gulp.task('checkout', function(){
|
||||
git.checkout('branchName', {args:'-b'}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Merge branches to master
|
||||
gulp.task('merge', function(){
|
||||
git.merge('branchName', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Reset a commit
|
||||
gulp.task('reset', function(){
|
||||
git.reset('SHA', function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Show the formatted git diff
|
||||
gulp.task('diff', function(){
|
||||
gulp.src('./*')
|
||||
.pipe(git.diff('master', {log: true}))
|
||||
.pipe(gulp.dest('./diff.out'));
|
||||
});
|
||||
|
||||
// Git rm a file or folder
|
||||
gulp.task('rm', function(){
|
||||
return gulp.src('./gruntfile.js')
|
||||
.pipe(git.rm());
|
||||
});
|
||||
|
||||
gulp.task('addSubmodule', function(){
|
||||
git.addSubmodule('https://github.com/stevelacy/git-test', 'git-test', { args: '-b master'});
|
||||
});
|
||||
|
||||
gulp.task('updateSubmodules', function(){
|
||||
git.updateSubmodule({ args: '--init' });
|
||||
});
|
||||
|
||||
// Working tree status
|
||||
gulp.task('status', function(){
|
||||
git.status({args: '--porcelain'}, function (err, stdout) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Other actions that do not require a Vinyl
|
||||
gulp.task('log', function(){
|
||||
git.exec({args : 'log --follow index.js'}, function (err, stdout) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Git clean files
|
||||
gulp.task('clean', function() {
|
||||
git.clean({ args: '-f' }, function (err) {
|
||||
if(err) throw err;
|
||||
});
|
||||
});
|
||||
|
||||
// Get the current branch name
|
||||
|
||||
git.revParse({args:'--abbrev-ref HEAD'}, function (err, branch) {
|
||||
console.log('current git branch: ' + branch);
|
||||
});
|
||||
|
||||
// Run gulp's default task
|
||||
gulp.task('default',['add']);
|
||||
```
|
||||
|
||||
##API
|
||||
|
||||
### git.init(opt, cb)
|
||||
`git init`
|
||||
|
||||
Creates an empty git repo
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.init({args:'options'}, function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.clone(remote, opt, cb)
|
||||
`git clone <remote> <options>`
|
||||
|
||||
Clones a remote repo for the first time
|
||||
|
||||
`remote`: String, remote url
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.clone('https://remote.git', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
A desination folder or subfolder can be set with `args: '<destination>'`
|
||||
```
|
||||
git.clone('https://remote.git', {args: './sub/folder'}, function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.add(opt)
|
||||
`git add <files>`
|
||||
|
||||
Adds files to repo
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
```js
|
||||
gulp.src('./*')
|
||||
.pipe(git.add());
|
||||
});
|
||||
```
|
||||
|
||||
### git.commit(message, opt)
|
||||
`git commit -m <message> <files>`
|
||||
|
||||
Commits changes to repo
|
||||
|
||||
`message`: String or array of strings, commit message
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', maxBuffer: 200 * 1024, quiet: true, disableMessageRequirement: false, disableAppendPaths: false, multiline: false}`
|
||||
|
||||
```js
|
||||
gulp.src('./*')
|
||||
.pipe(git.commit('commit message'));
|
||||
});
|
||||
```
|
||||
|
||||
### git.addRemote(remote, url, opt, cb)
|
||||
`git remote add <remote> <repo https url>`
|
||||
|
||||
Adds remote repo url
|
||||
|
||||
`remote`: String, name of remote, default: `origin`
|
||||
|
||||
`url`: String, url of remote
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.addRemote('origin', 'git-repo-url', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.removeRemote(remote, opt, cb)
|
||||
`git remote remove <remote>`
|
||||
|
||||
Removes remote repo
|
||||
|
||||
`remote`: String, name of remote
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.removeRemote('origin', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.fetch(remote, branch, opt, cb)
|
||||
`git fetch <remote> <branch>`
|
||||
|
||||
Fetches refs and objects from remote repo
|
||||
|
||||
`remote`: String, name of remote, default: `origin`
|
||||
|
||||
`branch`: String, branch, default: ``
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.fetch('origin', '', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.pull(remote, branch, opt, cb)
|
||||
`git pull <remote> <branch>`
|
||||
|
||||
Pulls changes from remote repo
|
||||
|
||||
`remote`: String, name of remote, default: `undefined`
|
||||
|
||||
`branch`: String || Array, branch, default: `undefined`
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.pull('origin', 'master', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
|
||||
// without any remote or branches
|
||||
git.pull(function(err){
|
||||
//if (err) ...
|
||||
});
|
||||
|
||||
// with only a remote
|
||||
git.pull('upstream', function(err){
|
||||
//if (err) ...
|
||||
});
|
||||
|
||||
// with remote and an array of branches
|
||||
git.pull('upstream' ['dev', 'master'], function(err){
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.push(remote, branch, opt, cb)
|
||||
`git push <remote> <branch>`
|
||||
|
||||
Pushes changes to remote repo
|
||||
|
||||
`remote`: String, name of remote, default: `origin`
|
||||
|
||||
`branch`: String (may be `null`), branch, default: `master`
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.push('origin', 'master', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.tag(version, message, opt, cb)
|
||||
`git tag -a/s <version> -m <message>`
|
||||
|
||||
Tags repo with release version, returns all tags when used without arguments
|
||||
|
||||
`version`: String (optional), tag name
|
||||
|
||||
`message`: String or array of strings (optional), tag message
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.tag('v1.1.1', 'Version message', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
if options.signed is set to true, the tag will use the git secure key:
|
||||
`git.tag('v1.1.1', 'Version message with signed key', {signed: true});`
|
||||
|
||||
### git.branch(branch, opt, cb)
|
||||
`git branch <new branch name>`
|
||||
|
||||
Creates a new branch but doesn't switch to it
|
||||
|
||||
(Want to switch as you create? Use `git.checkout({args:'-b'})`.)
|
||||
|
||||
`branch`: String, branch
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.branch('development', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.showBranch(opt, cb)
|
||||
`git show-branch <opt>`
|
||||
|
||||
Show branches and their commits
|
||||
|
||||
`opt`: Object (optional) `{args: 'options'}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.showBranch({'args': '--list -a'}, function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.checkout(branch, opt, cb)
|
||||
`git checkout <new branch name>`
|
||||
|
||||
Checkout a new branch with files
|
||||
|
||||
`branch`: String, branch
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.checkout('development', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
If you want to create a branch and switch to it:
|
||||
|
||||
```js
|
||||
git.checkout('development', {args:'-b'}, function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
If you want to checkout files (e.g. revert them) use git.checkoutFiles:
|
||||
|
||||
```js
|
||||
gulp.src('./*')
|
||||
.pipe(git.checkoutFiles());
|
||||
```
|
||||
|
||||
### git.checkoutFiles(opt)
|
||||
`git checkout <list of files>`
|
||||
|
||||
Checkout (e.g. reset) files
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
```js
|
||||
gulp.src('./*')
|
||||
.pipe(git.checkoutFiles());
|
||||
```
|
||||
|
||||
### git.merge(branch, opt, cb)
|
||||
`git merge <branch name> <options>`
|
||||
|
||||
Merges a branch into the current branch
|
||||
|
||||
`branch`: String, source branch
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.merge('development', function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.rm()
|
||||
`git rm <file> <options>`
|
||||
|
||||
Removes a file from git and deletes it
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
```js
|
||||
gulp.src('./*')
|
||||
.pipe(git.commit('commit message'));
|
||||
});
|
||||
```
|
||||
|
||||
### git.reset(commit, opt, cb)
|
||||
`git reset <SHA> <options>`
|
||||
|
||||
Resets working directory to specified commit hash
|
||||
|
||||
`commit`: String, commit hash or reference
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any
|
||||
|
||||
```js
|
||||
git.reset('HEAD' {args:'--hard'}, function (err) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.revParse(opt, cb)
|
||||
`git rev-parse <options>`
|
||||
|
||||
Get details about the repository
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function, passed err if any and command stdout
|
||||
|
||||
|
||||
```js
|
||||
git.revParse({args:'--short HEAD'}, function (err, hash) {
|
||||
//if (err) ...
|
||||
console.log('current git hash: '+hash);
|
||||
});
|
||||
```
|
||||
|
||||
### git.addSubmodule()
|
||||
`git submodule add <options> <repository> <path>`
|
||||
|
||||
Options: Object
|
||||
|
||||
`.addSubmodule('https://repository.git', 'path', {args: "options", quiet: true})`
|
||||
|
||||
### git.updateSubmodule()
|
||||
`git submodule update <options>`
|
||||
|
||||
Options: Object
|
||||
|
||||
`.updateSubmodule({args: "options", quiet: true})`
|
||||
|
||||
|
||||
### git.status(opt, cb)
|
||||
`git status <options>`
|
||||
|
||||
Show the working tree status
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', maxBuffer: 200 * 1024, quiet: true}`
|
||||
|
||||
`cb`: function (optional), passed err and command stdout
|
||||
|
||||
```js
|
||||
git.status({args : '--porcelain'}, function (err, stdout) {
|
||||
// if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.exec(opt, cb)
|
||||
`git <options>`
|
||||
|
||||
Run other git actions that do not require a Vinyl.
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', maxBuffer: 200 * 1024, quiet: true}`
|
||||
|
||||
`cb`: function (optional), passed err and command stdout
|
||||
|
||||
```js
|
||||
git.exec({args : 'log --follow index.js'}, function (err, stdout) {
|
||||
//if (err) ...
|
||||
});
|
||||
```
|
||||
|
||||
### git.clean(paths, opt, cb)
|
||||
`git clean <options>`
|
||||
|
||||
Remove untracked files from the working tree
|
||||
|
||||
`paths`: String (optional), paths to be affected by clean operation
|
||||
|
||||
`opt`: Object (optional), `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
`cb`: function (optional), passed err if any
|
||||
|
||||
### git.diff(branch, opt)
|
||||
`git diff master <options>`
|
||||
|
||||
Diffs between git objects
|
||||
|
||||
`branch`: String, branch name, commit name, or git tag
|
||||
|
||||
`opt`: Object (optional) `{args: 'options', cwd: '/cwd/path', quiet: true, maxBuffer: 200 * 1024}`
|
||||
|
||||
```js
|
||||
gulp.task('diff', function(){
|
||||
gulp.src('./*')
|
||||
.pipe(git.diff('develop', {log: true}))
|
||||
.pipe(gulp.dest('./diff.out'));
|
||||
});
|
||||
```
|
||||
|
||||
#### You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-git/tree/master/examples)
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
### Possible errors:
|
||||
|
||||
#### stdout maxBuffer exceeded
|
||||
|
||||
Reported [here](https://github.com/stevelacy/gulp-git/issues/68).
|
||||
|
||||
If you get this error it means that the git process doesn't have enough memory.
|
||||
|
||||
Every function has an additional option: `maxBuffer`.
|
||||
|
||||
```js
|
||||
gulp.task('pull', function(){
|
||||
git.pull('origin', 'master', {args: '--rebase', maxBuffer: Infinity}, function (err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
## LICENSE
|
||||
|
||||
(MIT License)
|
||||
|
||||
Copyright (c) 2015 Steve Lacy <me@slacy.me> slacy.me
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
33
node_modules/gulp-git/index.js
generated
vendored
Normal file
33
node_modules/gulp-git/index.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
/**
|
||||
* git
|
||||
* @exports gulp-git
|
||||
* @property {function} add {@link module:gulp-git/lib/add}
|
||||
* @property {function} addRemote {@link module:gulp-git/lib/addRemote}
|
||||
* @property {function} addSubmodule {@link module:gulp-git/lib/addSubmodule}
|
||||
* @property {function} branch {@link module:gulp-git/lib/branch}
|
||||
* @property {function} catFile {@link module:gulp-git/lib/catFile}
|
||||
* @property {function} checkout {@link module:gulp-git/lib/checkout}
|
||||
* @property {function} checkoutFiles {@link module:gulp-git/lib/checkoutFiles}
|
||||
* @property {function} clean {@link module:gulp-git/lib/clean}
|
||||
* @property {function} clone {@link module:gulp-git/lib/clone}
|
||||
* @property {function} commit {@link module:gulp-git/lib/commit}
|
||||
* @property {function} diff {@link module:gulp-git/lib/diff}
|
||||
* @property {function} exec {@link module:gulp-git/lib/exec}
|
||||
* @property {function} fetch {@link module:gulp-git/lib/fetch}
|
||||
* @property {function} init {@link module:gulp-git/lib/init}
|
||||
* @property {function} merge {@link module:gulp-git/lib/merge}
|
||||
* @property {function} pull {@link module:gulp-git/lib/pull}
|
||||
* @property {function} push {@link module:gulp-git/lib/push}
|
||||
* @property {function} removeRemote {@link module:gulp-git/lib/removeRemote}
|
||||
* @property {function} reset {@link module:gulp-git/lib/reset}
|
||||
* @property {function} revParse {@link module:gulp-git/lib/revParse}
|
||||
* @property {function} rm {@link module:gulp-git/lib/rm}
|
||||
* @property {function} showBranch {@link module:gulp-git/lib/showBranch}
|
||||
* @property {function} stash {@link module:gulp-git/lib/stash}
|
||||
* @property {function} status {@link module:gulp-git/lib/status}
|
||||
* @property {function} tag {@link module:gulp-git/lib/tag}
|
||||
* @property {function} updateSubmodule {@link module:gulp-git/lib/updateSubmodule}
|
||||
*/
|
||||
var requireDir = require('require-dir');
|
||||
module.exports = requireDir('./lib');
|
40
node_modules/gulp-git/lib/add.js
generated
vendored
Normal file
40
node_modules/gulp-git/lib/add.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var paths = [];
|
||||
var files = [];
|
||||
var fileCwd = process.cwd();
|
||||
|
||||
var write = function(file, enc, cb) {
|
||||
paths.push(file.path);
|
||||
files.push(file);
|
||||
fileCwd = file.cwd;
|
||||
cb();
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var cwd = opt.cwd || fileCwd;
|
||||
|
||||
var cmd = 'git add ' + escape(paths) + ' ' + opt.args;
|
||||
var that = this;
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(that.push.bind(that));
|
||||
that.emit('end');
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
28
node_modules/gulp-git/lib/addRemote.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/addRemote.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, url, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!url) return cb(new Error('gulp-git: Repo URL is required git.addRemote("origin", "https://github.com/user/repo.git")'));
|
||||
if (!remote) remote = 'origin';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git remote add ' + opt.args + ' ' + escape([remote, url]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
22
node_modules/gulp-git/lib/addSubmodule.js
generated
vendored
Normal file
22
node_modules/gulp-git/lib/addSubmodule.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (url, name, opt, cb) {
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!url) return cb(new Error('gulp-git: Repo URL is required git.submodule.add("https://github.com/user/repo.git", "repoName")'));
|
||||
if (!name) name = '';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = '';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git submodule add ' + opt.args + ' ' + url + ' ' + name;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err && cb) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
if (cb) cb();
|
||||
});
|
||||
};
|
30
node_modules/gulp-git/lib/branch.js
generated
vendored
Normal file
30
node_modules/gulp-git/lib/branch.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
// want to get the current branch instead?
|
||||
// git.revParse({args:'--abbrev-ref HEAD'})
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) return cb(new Error('gulp-git: Branch name is required git.branch("name")'));
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git branch ' + opt.args + ' ' + escape([branch]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null, stdout);
|
||||
});
|
||||
};
|
109
node_modules/gulp-git/lib/catFile.js
generated
vendored
Normal file
109
node_modules/gulp-git/lib/catFile.js
generated
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
'use strict';
|
||||
/**
|
||||
* catFile
|
||||
* @module gulp-git/lib/catFile
|
||||
*/
|
||||
|
||||
var through = require('through2');
|
||||
var PluginError = require('plugin-error');
|
||||
var spawn = require('child_process').spawn;
|
||||
var stripBom = require('strip-bom-stream');
|
||||
|
||||
/**
|
||||
* get a buffer.
|
||||
* @callback requestCallback
|
||||
* @param {buffer} buf
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convert stream to buffer
|
||||
*
|
||||
* @param {Stream} stream stream that what to read
|
||||
* @param {readStreamCallback} callback function that receive buffer
|
||||
* @returns {void}
|
||||
*/
|
||||
function readStream(stream, callback) {
|
||||
var buf;
|
||||
stream.on('data', function(data) {
|
||||
if (buf) {
|
||||
buf = Buffer.concat([buf, data]);
|
||||
} else {
|
||||
buf = data;
|
||||
}
|
||||
});
|
||||
stream.once('finish', function() {
|
||||
if (buf) {
|
||||
callback(buf);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} catFileOptions
|
||||
* @property {boolean} stripBOM {@link https://github.com/gulpjs/vinyl-fs#optionsstripbom}
|
||||
* @property {boolean} buffer {@link https://github.com/gulpjs/vinyl-fs#optionsbuffer}
|
||||
*/
|
||||
|
||||
/**
|
||||
* read vinyl file contents
|
||||
* @param {catFileOptions} opt [catFileOptions]{@link module:gulp-git/lib/catFile~catFileOptions}
|
||||
* @returns {stream} stream of vinyl `File` objects.
|
||||
*/
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (undefined === opt.stripBOM || null === opt.stripBOM) opt.stripBOM = true;
|
||||
if (undefined === opt.buffer || null === opt.buffer) opt.buffer = true;
|
||||
|
||||
/**
|
||||
* transform function of stream {@link https://nodejs.org/docs/latest/api/stream.html#stream_transform_transform_chunk_encoding_callback}
|
||||
*
|
||||
* @param {vinyl} file The file to be transformed.
|
||||
* @param {any} enc encoding type.
|
||||
* @param {function} cb A callback function (optionally with an error argument and data) to be called after the supplied `file` has been processed.
|
||||
* @returns {void}
|
||||
*/
|
||||
var write = function(file, enc, cb) {
|
||||
|
||||
var hash = file.git && file.git.hash;
|
||||
|
||||
/**
|
||||
* set file contents and send file to stream
|
||||
*
|
||||
* @param {Buffer} contents file contents
|
||||
* @returns {void}
|
||||
*/
|
||||
var sendFile = function(contents) {
|
||||
if (contents) {
|
||||
file.contents = contents;
|
||||
}
|
||||
return cb(null, file);
|
||||
};
|
||||
|
||||
if (!hash || /^0+$/.test(hash)) {
|
||||
return sendFile();
|
||||
}
|
||||
|
||||
var catFile = spawn('git', ['cat-file', 'blob', hash], {
|
||||
cwd: file.cwd
|
||||
});
|
||||
|
||||
var contents = catFile.stdout;
|
||||
var that = this;
|
||||
|
||||
readStream(catFile.stderr, function(error) {
|
||||
that.emit('error', new PluginError('gulp-git', 'Command failed: ' + catFile.spawnargs.join(' ').trim() + '\n' + error.toString()));
|
||||
});
|
||||
|
||||
if (opt.stripBOM) {
|
||||
contents = contents.pipe(stripBom());
|
||||
}
|
||||
|
||||
if (opt.buffer) {
|
||||
readStream(contents, sendFile);
|
||||
} else {
|
||||
sendFile(contents);
|
||||
}
|
||||
};
|
||||
var stream = through.obj(write);
|
||||
return stream;
|
||||
};
|
27
node_modules/gulp-git/lib/checkout.js
generated
vendored
Normal file
27
node_modules/gulp-git/lib/checkout.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) throw new Error('gulp-git: Branch name is require git.checkout("name")');
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git checkout ' + opt.args + ' ' + escape([branch]);
|
||||
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null);
|
||||
});
|
||||
};
|
29
node_modules/gulp-git/lib/checkoutFiles.js
generated
vendored
Normal file
29
node_modules/gulp-git/lib/checkoutFiles.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
function checkout(file, enc, cb) {
|
||||
var that = this;
|
||||
var cmd = 'git checkout ' + opt.args + ' ' + escape([file.path]);
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec(cmd, {cwd: file.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
that.push(file);
|
||||
cb(null);
|
||||
});
|
||||
}
|
||||
|
||||
// Return a stream
|
||||
return through.obj(checkout);
|
||||
};
|
40
node_modules/gulp-git/lib/clean.js
generated
vendored
Normal file
40
node_modules/gulp-git/lib/clean.js
generated
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (paths, opt, cb) {
|
||||
if (!cb) {
|
||||
if (typeof opt === 'function') {
|
||||
// passed in 2 arguments
|
||||
cb = opt;
|
||||
if (typeof paths === 'object') {
|
||||
opt = paths;
|
||||
paths = '';
|
||||
}
|
||||
else opt = {};
|
||||
}
|
||||
else {
|
||||
// passed in only cb
|
||||
cb = paths;
|
||||
paths = '';
|
||||
opt = {};
|
||||
}
|
||||
}
|
||||
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git clean ' + opt.args + ' ' + (paths.trim() ? (' -- ' + escape(paths)) : '');
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, { cwd: opt.cwd, maxBuffer: maxBuffer }, function (err, stdout, stderr) {
|
||||
if (err)
|
||||
return cb(err);
|
||||
if (!opt.quiet)
|
||||
log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
26
node_modules/gulp-git/lib/clone.js
generated
vendored
Normal file
26
node_modules/gulp-git/lib/clone.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git clone ' + escape([remote]) + ' ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
120
node_modules/gulp-git/lib/commit.js
generated
vendored
Normal file
120
node_modules/gulp-git/lib/commit.js
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
var path = require('path');
|
||||
|
||||
// want to get the current git hash instead?
|
||||
// git.revParse({args:'--short HEAD'})
|
||||
|
||||
module.exports = function(message, opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!message) {
|
||||
if (opt.args.indexOf('--amend') === -1 && opt.disableMessageRequirement !== true) {
|
||||
throw new Error('gulp-git: Commit message is required git.commit("commit message") or --amend arg must be given');
|
||||
}
|
||||
}
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var files = [];
|
||||
var paths = [];
|
||||
|
||||
var write = function(file, enc, cb) {
|
||||
files.push(file);
|
||||
paths.push(path.relative(opt.cwd, file.path).replace('\\', '/') || '.');
|
||||
cb();
|
||||
};
|
||||
|
||||
var messageEntry = function(entry) {
|
||||
return '-m "' + entry + '" ';
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var writeStdin = false;
|
||||
var cmd = 'git commit ';
|
||||
// Allow delayed execution to determine the message
|
||||
if (typeof message === 'function') {
|
||||
message = message();
|
||||
}
|
||||
|
||||
if (message && opt.args.indexOf('--amend') === -1) {
|
||||
|
||||
// Check if the message is multiline
|
||||
if (message && message instanceof Array) {
|
||||
|
||||
if (opt.multiline) {
|
||||
writeStdin = true;
|
||||
message = message.join('\n');
|
||||
} else {
|
||||
var messageExpanded = '';
|
||||
|
||||
// repeat -m as needed
|
||||
for (var i = 0; i < message.length; i++) {
|
||||
messageExpanded += messageEntry(message[i]);
|
||||
}
|
||||
cmd += messageExpanded + opt.args;
|
||||
}
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' ' + escape(paths);
|
||||
}
|
||||
} else {
|
||||
if (~message.indexOf('\n')) {
|
||||
writeStdin = true;
|
||||
} else {
|
||||
cmd += '-m "' + message + '" ' + opt.args;
|
||||
}
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' ' + escape(paths);
|
||||
}
|
||||
}
|
||||
} else if (opt.disableMessageRequirement === true) {
|
||||
cmd += opt.args;
|
||||
} else {
|
||||
// When amending, just add the file automatically and do not include the message not the file.
|
||||
// Also, add all the files and avoid lauching the editor (even if --no-editor was added)
|
||||
cmd += '-a ' + opt.args + (opt.args.indexOf('--no-edit') === -1 ? ' --no-edit' : '');
|
||||
}
|
||||
var self = this;
|
||||
|
||||
// If `message` was an array and `opt.multiline` was true
|
||||
// or was a string containing newlines, we append '-F -'
|
||||
if (writeStdin) {
|
||||
cmd += ' -F -';
|
||||
}
|
||||
|
||||
if (!opt.disableAppendPaths) {
|
||||
cmd += ' .';
|
||||
}
|
||||
|
||||
var execChildProcess = exec(cmd, opt, function(err, stdout, stderr) {
|
||||
if (err && (String(stdout).indexOf('no changes added to commit') === 0)) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(self.push.bind(self));
|
||||
self.emit('end');
|
||||
return cb();
|
||||
});
|
||||
|
||||
if (writeStdin) {
|
||||
execChildProcess.stdin.write(message);
|
||||
execChildProcess.stdin.end();
|
||||
}
|
||||
|
||||
// If the user wants, we'll emit data events during exec
|
||||
// they can listen to them with .on('data',function(data){ });
|
||||
// in their task
|
||||
if (opt.emitData) {
|
||||
execChildProcess.stdout.on('data', function(data) {
|
||||
self.emit('data', data);
|
||||
});
|
||||
execChildProcess.stderr.on('data', function(data) {
|
||||
self.emit('data', data);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
121
node_modules/gulp-git/lib/diff.js
generated
vendored
Normal file
121
node_modules/gulp-git/lib/diff.js
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
'use strict';
|
||||
/**
|
||||
* diff
|
||||
* @module gulp-git/lib/diff
|
||||
*/
|
||||
|
||||
var Vinyl = require('vinyl');
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var path = require('path');
|
||||
var exec = require('child_process').exec;
|
||||
var catFile = require('./catFile');
|
||||
|
||||
// https://git-scm.com/docs/git-diff#_raw_output_format
|
||||
/* eslint-disable */
|
||||
var RE_DIFF_RESULT = /\:(\w+)\s+(\w+)\s+(\w+)(?:\.{3})?\s+(\w+)(?:\.{3})?\s+(\w+)(\u0000|\t|\s+)(.+?)(?:\6|\n)(?:([^:]+?)\6)?/g;
|
||||
/* eslint-enable */
|
||||
|
||||
function getReaslt(data) {
|
||||
var result = [];
|
||||
if (data && data.length) {
|
||||
var str = data.toString();
|
||||
var match;
|
||||
RE_DIFF_RESULT.lastIndex = 0;
|
||||
while ((match = RE_DIFF_RESULT.exec(str))) {
|
||||
result.push({
|
||||
// mode for compare "src"
|
||||
srcMode: match[1],
|
||||
// mode for compare "dst"
|
||||
dstMode: match[2],
|
||||
// sha1 for compare "src"
|
||||
srcHash: match[3],
|
||||
// sha1 for compare "dst"
|
||||
dstHash: match[4],
|
||||
// status
|
||||
status: match[5],
|
||||
// path for compare "src"
|
||||
srcPath: match[7],
|
||||
// path for compare "dst"
|
||||
dstPath: match[8] || match[7],
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} diffOptions
|
||||
* @property {string} cwd {@link https://github.com/gulpjs/vinyl-fs#optionscwd}
|
||||
* @property {string} base {@link https://github.com/gulpjs/vinyl-fs#optionsbase}
|
||||
* @property {boolean} read {@link https://github.com/gulpjs/vinyl-fs#optionsread}
|
||||
* @property {boolean} buffer {@link https://github.com/gulpjs/vinyl-fs#optionsbuffer}
|
||||
* @property {boolean} stripBOM {@link https://github.com/gulpjs/vinyl-fs#optionsstripbom}
|
||||
* @property {boolean} log show log in console
|
||||
* @property {string[]} args Command parameter for `git diff`
|
||||
*/
|
||||
|
||||
/**
|
||||
* get git diff result as a stream of vinyl `File` objects.
|
||||
*
|
||||
* @example
|
||||
const git = require('gulp-git');
|
||||
const eslint = require('gulp-eslint');
|
||||
git.diff('--cached', {
|
||||
args: '-- *.js'
|
||||
})
|
||||
.pipe(eslint())
|
||||
* @param {string} compare compare arg for `git diff`
|
||||
* @param {diffOptions} opt [diffOptions]{@link module:gulp-git/lib/diff~diffOptions}
|
||||
* @returns {stream} stream of vinyl `File` objects.
|
||||
*/
|
||||
module.exports = function (compare, opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
// https://github.com/gulpjs/vinyl-fs#optionsread
|
||||
if (undefined === opt.read || null === opt.read) opt.read = true;
|
||||
if (undefined === opt.log || null === opt.log) opt.log = true;
|
||||
|
||||
var srcStream = through.obj();
|
||||
var cmd = compare;
|
||||
|
||||
if (!/--diff-filter=/.test(opt.args)) {
|
||||
cmd += ' --diff-filter=ACM';
|
||||
}
|
||||
if (opt.args) {
|
||||
cmd += ' ' + opt.args;
|
||||
}
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
exec('git diff --raw -z ' + cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout) {
|
||||
if (err) return srcStream.emit('error', err);
|
||||
var files = getReaslt(stdout);
|
||||
|
||||
if (opt.log) {
|
||||
log('git diff --name-status ' + cmd + '\n' + files.map(function(diff) {
|
||||
return diff.status + '\t' + diff.dstPath;
|
||||
}).join('\n'));
|
||||
}
|
||||
|
||||
files.forEach(function(diff) {
|
||||
srcStream.write(new Vinyl({
|
||||
path: path.resolve(opt.cwd, diff.dstPath),
|
||||
cwd: opt.cwd,
|
||||
base: opt.base,
|
||||
git: {
|
||||
hash: diff.dstHash,
|
||||
diff: diff
|
||||
}
|
||||
}));
|
||||
});
|
||||
srcStream.end();
|
||||
});
|
||||
|
||||
if (opt.read) {
|
||||
// read file contents when opt.read is `true`
|
||||
return srcStream.pipe(catFile(opt));
|
||||
}
|
||||
|
||||
return srcStream;
|
||||
};
|
29
node_modules/gulp-git/lib/exec.js
generated
vendored
Normal file
29
node_modules/gulp-git/lib/exec.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = { };
|
||||
if (!opt.log) opt.log = !cb;
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git ' + opt.args;
|
||||
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err, stderr);
|
||||
if (opt.log && !opt.quiet) log(cmd + '\n' + stdout, stderr);
|
||||
else {
|
||||
if (!opt.quiet) log(cmd + ' (log : false)', stderr);
|
||||
}
|
||||
cb(err, stdout);
|
||||
});
|
||||
};
|
35
node_modules/gulp-git/lib/fetch.js
generated
vendored
Normal file
35
node_modules/gulp-git/lib/fetch.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!branch) branch = '';
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!remote && opt.args.indexOf('--all') === -1) remote = 'origin';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git fetch ' + opt.args;
|
||||
var args = [];
|
||||
if (remote)
|
||||
args.push(remote);
|
||||
if (branch)
|
||||
args = args.concat(branch);
|
||||
if (args.length > 0)
|
||||
cmd += escape(args);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
26
node_modules/gulp-git/lib/init.js
generated
vendored
Normal file
26
node_modules/gulp-git/lib/init.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git init ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
|
||||
};
|
27
node_modules/gulp-git/lib/merge.js
generated
vendored
Normal file
27
node_modules/gulp-git/lib/merge.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!branch) return cb && cb(new Error('gulp-git: Branch name is require git.merge("name")'));
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git merge ' + opt.args + ' ' + escape([branch]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
37
node_modules/gulp-git/lib/pull.js
generated
vendored
Normal file
37
node_modules/gulp-git/lib/pull.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
// pull with callback only
|
||||
if (!cb && typeof remote === 'function') {
|
||||
cb = remote;
|
||||
remote = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git pull ' + opt.args;
|
||||
if (typeof remote === 'string') {
|
||||
cmd += ' ' + escape(remote);
|
||||
}
|
||||
if (branch && typeof branch === 'string' || branch && branch[0]) {
|
||||
cmd += ' ' + escape([].concat(branch));
|
||||
}
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
59
node_modules/gulp-git/lib/push.js
generated
vendored
Normal file
59
node_modules/gulp-git/lib/push.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
var revParse = require('./revParse');
|
||||
|
||||
module.exports = function (remote, branch, opt, cb) {
|
||||
|
||||
if (!remote) remote = 'origin';
|
||||
|
||||
function setBranch(cb2) {
|
||||
if (branch && typeof branch === 'function') {
|
||||
cb = branch;
|
||||
branch = null;
|
||||
}
|
||||
if (branch && Object.prototype.toString.call(branch) === '[object Object]') {
|
||||
opt = branch;
|
||||
branch = null;
|
||||
}
|
||||
if (!branch) {
|
||||
revParse({ args: '--abbrev-ref HEAD' },
|
||||
function callback(err, out) {
|
||||
if (err) return cb2(err);
|
||||
branch = out;
|
||||
cb2();
|
||||
});
|
||||
} else {
|
||||
cb2();
|
||||
}
|
||||
}
|
||||
|
||||
function flush(err) {
|
||||
if (err) return cb(err);
|
||||
if (!cb && typeof opt === 'function') {
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function() {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git push ' + escape([].concat(remote, branch)) + ' ' + opt.args;
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
return exec(cmd, {
|
||||
cwd: opt.cwd,
|
||||
maxBuffer: maxBuffer
|
||||
}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
}
|
||||
|
||||
return setBranch(flush);
|
||||
|
||||
};
|
31
node_modules/gulp-git/lib/removeRemote.js
generated
vendored
Normal file
31
node_modules/gulp-git/lib/removeRemote.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (remote, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!remote || typeof remote !== 'string') {
|
||||
var error = new Error('gulp-git: remote is required git.removeRemote("origin")');
|
||||
if (!cb || typeof cb !== 'function') throw error;
|
||||
return cb(error);
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git remote remove ' + opt.args + ' ' + escape([remote]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
};
|
28
node_modules/gulp-git/lib/reset.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/reset.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (commit, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!commit) commit = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git reset ' + opt.args + ' ' + escape([commit]);
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb();
|
||||
});
|
||||
|
||||
};
|
35
node_modules/gulp-git/lib/revParse.js
generated
vendored
Normal file
35
node_modules/gulp-git/lib/revParse.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
/*
|
||||
great examples:
|
||||
`git rev-parse HEAD`: get current git hash
|
||||
`git rev-parse --short HEAD`: get short git hash
|
||||
`git rev-parse --abbrev-ref HEAD`: get current branch name
|
||||
`git rev-parse --show-toplevel`: working directory path
|
||||
see https://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html
|
||||
*/
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' '; // it will likely not give you what you want
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git rev-parse ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (stdout) stdout = stdout.trim(); // Trim trailing cr-lf
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(err, stdout); // return stdout to the user
|
||||
});
|
||||
};
|
38
node_modules/gulp-git/lib/rm.js
generated
vendored
Normal file
38
node_modules/gulp-git/lib/rm.js
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (opt) {
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var paths = [];
|
||||
var files = [];
|
||||
var fileCwd = process.cwd;
|
||||
var write = function(file, enc, cb) {
|
||||
paths.push(file.path);
|
||||
files.push(file);
|
||||
fileCwd = file.cwd;
|
||||
cb();
|
||||
};
|
||||
|
||||
var flush = function(cb) {
|
||||
var cwd = opt.cwd || fileCwd;
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git rm ' + escape(paths) + ' ' + opt.args;
|
||||
var that = this;
|
||||
exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
files.forEach(that.push.bind(that));
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
return through.obj(write, flush);
|
||||
};
|
23
node_modules/gulp-git/lib/showBranch.js
generated
vendored
Normal file
23
node_modules/gulp-git/lib/showBranch.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var cmd = 'git show-branch ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null, stdout);
|
||||
});
|
||||
};
|
28
node_modules/gulp-git/lib/stash.js
generated
vendored
Normal file
28
node_modules/gulp-git/lib/stash.js
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function(opt, cb) {
|
||||
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.args) opt.args = 'save --include-untracked "gulp-stash"';
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git stash ' + opt.args;
|
||||
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
cb(null);
|
||||
});
|
||||
|
||||
};
|
24
node_modules/gulp-git/lib/status.js
generated
vendored
Normal file
24
node_modules/gulp-git/lib/status.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function (opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
if (!opt.maxBuffer) opt.maxBuffer = 200 * 1024; // Default buffer value for child_process.exec
|
||||
|
||||
var cmd = 'git status ' + opt.args;
|
||||
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err, stderr);
|
||||
if (!opt.quiet) log(cmd + '\n' + stdout, stderr);
|
||||
if (cb) cb(err, stdout);
|
||||
});
|
||||
};
|
49
node_modules/gulp-git/lib/tag.js
generated
vendored
Normal file
49
node_modules/gulp-git/lib/tag.js
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var template = require('lodash.template');
|
||||
var exec = require('child_process').exec;
|
||||
var escape = require('any-shell-escape');
|
||||
|
||||
module.exports = function (version, message, opt, cb) {
|
||||
if (!cb && typeof opt === 'function') {
|
||||
// optional options
|
||||
cb = opt;
|
||||
opt = {};
|
||||
}
|
||||
if (!cb && typeof version === 'function') {
|
||||
cb = version;
|
||||
version = '';
|
||||
message = '';
|
||||
}
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!message) {
|
||||
opt.lightWeight = true;
|
||||
message = '';
|
||||
}
|
||||
else message = escape([message]);
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var signedarg = opt.signed ? ' -s ' : ' -a ';
|
||||
|
||||
var cmd = 'git tag';
|
||||
if (version !== '') {
|
||||
if (!opt.lightWeight) {
|
||||
cmd += ' ' + signedarg + ' -m ' + message + ' ';
|
||||
}
|
||||
cmd += opt.args + ' ' + escape([version]);
|
||||
}
|
||||
var templ = template(cmd)({file: message});
|
||||
return exec(templ, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err) return cb(err);
|
||||
if (!opt.quiet && version !== '') log(stdout, stderr);
|
||||
if (version === '') {
|
||||
stdout = stdout.split('\n');
|
||||
}
|
||||
return cb(null, stdout);
|
||||
});
|
||||
};
|
20
node_modules/gulp-git/lib/updateSubmodule.js
generated
vendored
Normal file
20
node_modules/gulp-git/lib/updateSubmodule.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('fancy-log');
|
||||
var exec = require('child_process').exec;
|
||||
|
||||
module.exports = function(opt, cb) {
|
||||
if (!cb || typeof cb !== 'function') cb = function () {};
|
||||
if (!opt) opt = {};
|
||||
if (!opt.cwd) opt.cwd = process.cwd();
|
||||
if (!opt.args) opt.args = ' ';
|
||||
|
||||
var maxBuffer = opt.maxBuffer || 200 * 1024;
|
||||
|
||||
var cmd = 'git submodule update ' + opt.args;
|
||||
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
|
||||
if (err && cb) return cb(err);
|
||||
if (!opt.quiet) log(stdout, stderr);
|
||||
if (cb) cb();
|
||||
});
|
||||
};
|
9
node_modules/gulp-git/node_modules/through2/LICENSE.md
generated
vendored
Normal file
9
node_modules/gulp-git/node_modules/through2/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# The MIT License (MIT)
|
||||
|
||||
**Copyright (c) Rod Vagg (the "Original Author") and additional contributors**
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
134
node_modules/gulp-git/node_modules/through2/README.md
generated
vendored
Normal file
134
node_modules/gulp-git/node_modules/through2/README.md
generated
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
# through2
|
||||
|
||||
[](https://nodei.co/npm/through2/)
|
||||
|
||||
**A tiny wrapper around Node streams.Transform (Streams2/3) to avoid explicit subclassing noise**
|
||||
|
||||
Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`.
|
||||
|
||||
Note: As 2.x.x this module starts using **Streams3** instead of Stream2. To continue using a Streams2 version use `npm install through2@0` to fetch the latest version of 0.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**.
|
||||
|
||||
```js
|
||||
fs.createReadStream('ex.txt')
|
||||
.pipe(through2(function (chunk, enc, callback) {
|
||||
for (var i = 0; i < chunk.length; i++)
|
||||
if (chunk[i] == 97)
|
||||
chunk[i] = 122 // swap 'a' for 'z'
|
||||
|
||||
this.push(chunk)
|
||||
|
||||
callback()
|
||||
}))
|
||||
.pipe(fs.createWriteStream('out.txt'))
|
||||
.on('finish', () => doSomethingSpecial())
|
||||
```
|
||||
|
||||
Or object streams:
|
||||
|
||||
```js
|
||||
var all = []
|
||||
|
||||
fs.createReadStream('data.csv')
|
||||
.pipe(csv2())
|
||||
.pipe(through2.obj(function (chunk, enc, callback) {
|
||||
var data = {
|
||||
name : chunk[0]
|
||||
, address : chunk[3]
|
||||
, phone : chunk[10]
|
||||
}
|
||||
this.push(data)
|
||||
|
||||
callback()
|
||||
}))
|
||||
.on('data', (data) => {
|
||||
all.push(data)
|
||||
})
|
||||
.on('end', () => {
|
||||
doSomethingSpecial(all)
|
||||
})
|
||||
```
|
||||
|
||||
Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`.
|
||||
|
||||
## API
|
||||
|
||||
<b><code>through2([ options, ] [ transformFunction ] [, flushFunction ])</code></b>
|
||||
|
||||
Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`).
|
||||
|
||||
### options
|
||||
|
||||
The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`).
|
||||
|
||||
The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call:
|
||||
|
||||
```js
|
||||
fs.createReadStream('/tmp/important.dat')
|
||||
.pipe(through2({ objectMode: true, allowHalfOpen: false },
|
||||
(chunk, enc, cb) => {
|
||||
cb(null, 'wut?') // note we can use the second argument on the callback
|
||||
// to provide data as an alternative to this.push('wut?')
|
||||
}
|
||||
)
|
||||
.pipe(fs.createWriteStream('/tmp/wut.txt'))
|
||||
```
|
||||
|
||||
### transformFunction
|
||||
|
||||
The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk.
|
||||
|
||||
To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on.
|
||||
|
||||
Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error.
|
||||
|
||||
If you **do not provide a `transformFunction`** then you will get a simple pass-through stream.
|
||||
|
||||
### flushFunction
|
||||
|
||||
The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress.
|
||||
|
||||
```js
|
||||
fs.createReadStream('/tmp/important.dat')
|
||||
.pipe(through2(
|
||||
(chunk, enc, cb) => cb(null, chunk), // transform is a noop
|
||||
function (cb) { // flush function
|
||||
this.push('tacking on an extra buffer to the end');
|
||||
cb();
|
||||
}
|
||||
))
|
||||
.pipe(fs.createWriteStream('/tmp/wut.txt'));
|
||||
```
|
||||
|
||||
<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b>
|
||||
|
||||
Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances.
|
||||
|
||||
```js
|
||||
var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) {
|
||||
if (record.temp != null && record.unit == "F") {
|
||||
record.temp = ( ( record.temp - 32 ) * 5 ) / 9
|
||||
record.unit = "C"
|
||||
}
|
||||
this.push(record)
|
||||
callback()
|
||||
})
|
||||
|
||||
// Create instances of FToC like so:
|
||||
var converter = new FToC()
|
||||
// Or:
|
||||
var converter = FToC()
|
||||
// Or specify/override options when you instantiate, if you prefer:
|
||||
var converter = FToC({objectMode: true})
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams.
|
||||
- [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams.
|
||||
- [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams.
|
||||
- [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies.
|
||||
- the [mississippi stream utility collection](https://github.com/maxogden/mississippi) includes `through2` as well as many more useful stream modules similar to this one
|
||||
|
||||
## License
|
||||
|
||||
**through2** is Copyright (c) Rod Vagg [@rvagg](https://twitter.com/rvagg) and additional contributors and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
|
33
node_modules/gulp-git/node_modules/through2/package.json
generated
vendored
Normal file
33
node_modules/gulp-git/node_modules/through2/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "through2",
|
||||
"version": "2.0.5",
|
||||
"description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise",
|
||||
"main": "through2.js",
|
||||
"scripts": {
|
||||
"test": "node test/test.js | faucet"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rvagg/through2.git"
|
||||
},
|
||||
"keywords": [
|
||||
"stream",
|
||||
"streams2",
|
||||
"through",
|
||||
"transform"
|
||||
],
|
||||
"author": "Rod Vagg <r@va.gg> (https://github.com/rvagg)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readable-stream": "~2.3.6",
|
||||
"xtend": "~4.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bl": "~2.0.1",
|
||||
"faucet": "0.0.1",
|
||||
"nyc": "~13.1.0",
|
||||
"safe-buffer": "~5.1.2",
|
||||
"stream-spigot": "~3.0.6",
|
||||
"tape": "~4.9.1"
|
||||
}
|
||||
}
|
96
node_modules/gulp-git/node_modules/through2/through2.js
generated
vendored
Normal file
96
node_modules/gulp-git/node_modules/through2/through2.js
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
var Transform = require('readable-stream').Transform
|
||||
, inherits = require('util').inherits
|
||||
, xtend = require('xtend')
|
||||
|
||||
function DestroyableTransform(opts) {
|
||||
Transform.call(this, opts)
|
||||
this._destroyed = false
|
||||
}
|
||||
|
||||
inherits(DestroyableTransform, Transform)
|
||||
|
||||
DestroyableTransform.prototype.destroy = function(err) {
|
||||
if (this._destroyed) return
|
||||
this._destroyed = true
|
||||
|
||||
var self = this
|
||||
process.nextTick(function() {
|
||||
if (err)
|
||||
self.emit('error', err)
|
||||
self.emit('close')
|
||||
})
|
||||
}
|
||||
|
||||
// a noop _transform function
|
||||
function noop (chunk, enc, callback) {
|
||||
callback(null, chunk)
|
||||
}
|
||||
|
||||
|
||||
// create a new export function, used by both the main export and
|
||||
// the .ctor export, contains common logic for dealing with arguments
|
||||
function through2 (construct) {
|
||||
return function (options, transform, flush) {
|
||||
if (typeof options == 'function') {
|
||||
flush = transform
|
||||
transform = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (typeof transform != 'function')
|
||||
transform = noop
|
||||
|
||||
if (typeof flush != 'function')
|
||||
flush = null
|
||||
|
||||
return construct(options, transform, flush)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// main export, just make me a transform stream!
|
||||
module.exports = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(options)
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
||||
|
||||
|
||||
// make me a reusable prototype that I can `new`, or implicitly `new`
|
||||
// with a constructor call
|
||||
module.exports.ctor = through2(function (options, transform, flush) {
|
||||
function Through2 (override) {
|
||||
if (!(this instanceof Through2))
|
||||
return new Through2(override)
|
||||
|
||||
this.options = xtend(options, override)
|
||||
|
||||
DestroyableTransform.call(this, this.options)
|
||||
}
|
||||
|
||||
inherits(Through2, DestroyableTransform)
|
||||
|
||||
Through2.prototype._transform = transform
|
||||
|
||||
if (flush)
|
||||
Through2.prototype._flush = flush
|
||||
|
||||
return Through2
|
||||
})
|
||||
|
||||
|
||||
module.exports.obj = through2(function (options, transform, flush) {
|
||||
var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options))
|
||||
|
||||
t2._transform = transform
|
||||
|
||||
if (flush)
|
||||
t2._flush = flush
|
||||
|
||||
return t2
|
||||
})
|
45
node_modules/gulp-git/package.json
generated
vendored
Normal file
45
node_modules/gulp-git/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "gulp-git",
|
||||
"description": "Git plugin for gulp (gulpjs.com)",
|
||||
"version": "2.10.1",
|
||||
"homepage": "http://github.com/stevelacy/gulp-git",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/stevelacy/gulp-git.git"
|
||||
},
|
||||
"author": "Steve Lacy me@slacy.me (slacy.me)",
|
||||
"main": "./index.js",
|
||||
"dependencies": {
|
||||
"any-shell-escape": "^0.1.1",
|
||||
"fancy-log": "^1.3.2",
|
||||
"lodash.template": "^4.4.0",
|
||||
"plugin-error": "^1.0.1",
|
||||
"require-dir": "^1.0.0",
|
||||
"strip-bom-stream": "^3.0.0",
|
||||
"through2": "^2.0.3",
|
||||
"vinyl": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.7.2",
|
||||
"mocha": "^6.2.2",
|
||||
"mock-require": "^2.0.2",
|
||||
"rimraf": "^2.6.1",
|
||||
"should": "^13.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
"docs": "rimraf docs/* && jsdoc ./index.js ./lib --recurse --destination ./docs",
|
||||
"lint": "rimraf test/repo test/tmp && eslint ./index.js ./examples/ ./lib/ ./test/",
|
||||
"test": "mocha --reporter spec --timeout 6000 test/main.js && npm run lint"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.9.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"gulp",
|
||||
"git",
|
||||
"gulpgit",
|
||||
"gulpplugin",
|
||||
"gulp-plugin"
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue