Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,2 @@ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
@@ -25,2 +26,3 @@ var util = require('util'); | ||
* Pass any custom function to implement your own remote fetch mapper. | ||
* `options.girrorfile`: if `true` a '.girror.json' file will be created at the root of the worktree with metadata on the girror operation. | ||
*/ | ||
@@ -38,2 +40,3 @@ function girror(remote, worktree, options, callback) { | ||
var branch = options.branch || null; | ||
var girrorfile = 'girrorfile' in options ? options.girrorfile : '.girror.json'; | ||
@@ -86,2 +89,5 @@ if (!remote) throw new Error('`remote` url is required'); | ||
// create girrorfile | ||
$girrorfile(worktree, girrorfile), | ||
], callback); | ||
@@ -100,3 +106,3 @@ } | ||
return cb(); | ||
} | ||
}; | ||
} | ||
@@ -116,3 +122,3 @@ | ||
return git(args, opts, cb); | ||
} | ||
}; | ||
} | ||
@@ -126,6 +132,26 @@ | ||
return mkdirp(dir, cb); | ||
} | ||
}; | ||
} | ||
/** | ||
* Promise to create a girror file in `file` | ||
*/ | ||
function $girrorfile(worktree, file) { | ||
return function(cb) { | ||
if (!file) return cb(); // no girror file | ||
logger.info('creating: ' + path.join(worktree, file)); | ||
var contents = { | ||
remote: remote, | ||
branch: branch, | ||
updated: new Date(), | ||
}; | ||
return fs.writeFile(path.join(worktree, file), JSON.stringify(contents, true, 2), cb); | ||
}; | ||
} | ||
/** | ||
* Returns the system's temp directory | ||
@@ -132,0 +158,0 @@ */ |
@@ -5,3 +5,3 @@ { | ||
"description": "Efficient mirror of git repositories. Great for continuous deployment", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -57,2 +57,3 @@ # girror - Efficient mirroring of git remotes # | ||
SSH URL (e.g. `git@github.com/account/repo.git`) | ||
* `options.girrorfile` - The name of the girror file to create under the worktree (contains some metadata on the last girror operation). Set to `false` to disable. Default is `.girror.json`. | ||
@@ -59,0 +60,0 @@ ### girror.git(args, options, callback) ### |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
31216
221
87
50
5