mirror of
https://gitee.com/dcloud/uni-preset-vue
synced 2026-05-29 00:00:06 +08:00
ignore bin
This commit is contained in:
-31
@@ -1,31 +0,0 @@
|
||||
# git-clone
|
||||
|
||||
Clone a git repository via shell command.
|
||||
|
||||
## Installation
|
||||
|
||||
Install:
|
||||
|
||||
$ npm install git-clone
|
||||
|
||||
Require:
|
||||
|
||||
var clone = require('git-clone');
|
||||
|
||||
## API
|
||||
|
||||
#### `clone(repo, targetPath, [options], cb)`
|
||||
|
||||
Clone `repo` to `targetPath`, calling `cb` on completion.
|
||||
|
||||
Supported `options`:
|
||||
|
||||
* `git`: path to `git` binary; default: `git` (optional).
|
||||
* `shallow`: when `true`, clone with depth 1 (optional).
|
||||
* `checkout`: revision/branch/tag to check out (optional).
|
||||
|
||||
## Copyright & License
|
||||
|
||||
© 2014 Jason Frame [ [@jaz303](http://twitter.com/jaz303) / [jason@onehackoranother.com](mailto:jason@onehackoranother.com) ]
|
||||
|
||||
Released under the ISC license.
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
module.exports = function(repo, targetPath, opts, cb) {
|
||||
|
||||
if (typeof opts === 'function') {
|
||||
cb = opts;
|
||||
opts = null;
|
||||
}
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var git = opts.git || 'git';
|
||||
var args = ['clone'];
|
||||
|
||||
if (opts.shallow) {
|
||||
args.push('--depth');
|
||||
args.push('1');
|
||||
}
|
||||
|
||||
args.push('--');
|
||||
args.push(repo);
|
||||
args.push(targetPath);
|
||||
|
||||
var process = spawn(git, args);
|
||||
process.on('close', function(status) {
|
||||
if (status == 0) {
|
||||
if (opts.checkout) {
|
||||
_checkout();
|
||||
} else {
|
||||
cb && cb();
|
||||
}
|
||||
} else {
|
||||
cb && cb(new Error("'git clone' failed with status " + status));
|
||||
}
|
||||
});
|
||||
|
||||
function _checkout() {
|
||||
var args = ['checkout', opts.checkout];
|
||||
var process = spawn(git, args, { cwd: targetPath });
|
||||
process.on('close', function(status) {
|
||||
if (status == 0) {
|
||||
cb && cb();
|
||||
} else {
|
||||
cb && cb(new Error("'git checkout' failed with status " + status));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "git-clone",
|
||||
"version": "0.1.0",
|
||||
"description": "Clone a git repository",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jaz303/git-clone.git"
|
||||
},
|
||||
"keywords": [
|
||||
"git",
|
||||
"clone",
|
||||
"shell"
|
||||
],
|
||||
"author": "Jason Frame <jason@onehackoranother.com> (http://jasonframe.co.uk)",
|
||||
"license": "ISC",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jaz303/git-clone/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jaz303/git-clone"
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
test-checkout
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
var gitClone = require('../index');
|
||||
|
||||
gitClone('git@github.com:jaz303/tpl-simple-site.git', './test-checkout', {
|
||||
checkout: 'a76362b0705d4126fa4462916cabb2506ecfe8e2' },
|
||||
function(err) {
|
||||
console.log("complete!");
|
||||
console.log(err);
|
||||
});
|
||||
Reference in New Issue
Block a user