mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-16 15:23:47 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
32
node_modules/gitconfiglocal/README.md
generated
vendored
Normal file
32
node_modules/gitconfiglocal/README.md
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
[](https://travis-ci.org/soldair/node-gitconfiglocal)
|
||||
|
||||
gitconfiglocal
|
||||
==============
|
||||
|
||||
parse the .git/config file into a useful data structure
|
||||
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
```js
|
||||
var gitconfig = require('gitconfiglocal');
|
||||
|
||||
gitconfig('./',function(err,config){
|
||||
console.log(config);
|
||||
/* prints:
|
||||
{ core:
|
||||
{ repositoryformatversion: '0',
|
||||
filemode: true,
|
||||
bare: false,
|
||||
logallrefupdates: true },
|
||||
remote:
|
||||
{ origin:
|
||||
{ url: 'git@github.com:soldair/node-gitconfiglocal.git',
|
||||
fetch: '+refs/heads/*:refs/remotes/origin/*' } } }
|
||||
*/
|
||||
});
|
||||
|
||||
|
||||
```
|
||||
44
node_modules/gitconfiglocal/index.js
generated
vendored
Normal file
44
node_modules/gitconfiglocal/index.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
var fs = require('fs');
|
||||
var ini = require('ini');
|
||||
var path = require('path');
|
||||
|
||||
|
||||
module.exports = function(dir,cb){
|
||||
findGit(dir,function(config) {
|
||||
if(!config) return cb(new Error('no gitconfig to be found at '+dir))
|
||||
fs.readFile(config,function(err,data){
|
||||
if(err) return cb(err);
|
||||
try{
|
||||
var formatted = format(ini.parse(data.toString()));
|
||||
} catch (e){
|
||||
return cb(e);
|
||||
}
|
||||
cb(false,formatted);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function format(data){
|
||||
var out = {};
|
||||
Object.keys(data).forEach(function(k){
|
||||
if(k.indexOf('"')> -1) {
|
||||
var parts = k.split('"');
|
||||
var parentKey = parts.shift().trim();
|
||||
var childKey = parts.shift().trim();
|
||||
if(!out[parentKey]) out[parentKey] = {};
|
||||
out[parentKey][childKey] = data[k];
|
||||
} else {
|
||||
out[k] = data[k];
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function findGit(dir, cb) {
|
||||
var folder = path.join(dir, '.git/config')
|
||||
fs.exists(folder,function(exists) {
|
||||
if(exists) return cb(folder)
|
||||
if(dir === path.resolve(dir, '..')) return cb(false)
|
||||
findGit(path.resolve(dir, '..'), cb)
|
||||
})
|
||||
}
|
||||
28
node_modules/gitconfiglocal/package.json
generated
vendored
Normal file
28
node_modules/gitconfiglocal/package.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "gitconfiglocal",
|
||||
"version": "1.0.0",
|
||||
"description": "parse the .git/config file into a useful data structure",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node test/test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/soldair/node-gitconfiglocal.git"
|
||||
},
|
||||
"keywords": [
|
||||
"git",
|
||||
"config"
|
||||
],
|
||||
"author": "Ryan Day",
|
||||
"license": "BSD",
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"ini": "^1.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tape": "^3.4.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user