Initial Commit
This commit is contained in:
17
node_modules/gitignore/.npmignore
generated
vendored
Normal file
17
node_modules/gitignore/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
lib-cov
|
||||
lcov.info
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
build
|
||||
.grunt
|
||||
|
||||
node_modules
|
||||
56
node_modules/gitignore/README.md
generated
vendored
Normal file
56
node_modules/gitignore/README.md
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# gitignore
|
||||
|
||||
Automatically fetch github's excellent `.gitignore` files for any of your new projects
|
||||
|
||||
[Here is the list of available types](https://github.com/github/gitignore)
|
||||
|
||||
## Use as a global utility
|
||||
|
||||
### Install
|
||||
|
||||
npm install gitignore -g
|
||||
|
||||
### Usage
|
||||
|
||||
To list out all of the available types:
|
||||
|
||||
gitignore -types
|
||||
|
||||
To create a `.gitignore` for rails:
|
||||
|
||||
gitignore rails
|
||||
|
||||
That's it.
|
||||
|
||||
## Use programmatically as a module
|
||||
|
||||
### Install
|
||||
|
||||
npm install gitignore
|
||||
|
||||
### and `require`
|
||||
|
||||
var gi = require(`gitignore`);
|
||||
|
||||
## API
|
||||
|
||||
### `.getTypes(callback)`
|
||||
|
||||
Gets the types via `https` request to GitHub.
|
||||
|
||||
#### `callback(err, types)`
|
||||
|
||||
If an error occurred, or the request failed, an `Error` object is passed as the first parameter. If the types were successfully requested, an array of types is passed as the second parameter with `null` as the first.
|
||||
|
||||
### `.writeFile(options, callback)`
|
||||
|
||||
Gets the `.gitignore` file from GitHub of the specified `options.type` and stores it in the writable stream at `options.file` or `options.writable`.
|
||||
|
||||
#### `options`
|
||||
|
||||
`.type` (string) - The type associated with the `.gitignore` file to be fetched
|
||||
`.file`, `.writable` (writable stream) - A writable stream (a file, sdtout, etc) that the results should be written to
|
||||
|
||||
#### `callback(err)`
|
||||
|
||||
If an error occurred or the request did not go through, an error obect is passed as the first parameter. If the request was successful, the first parameter is `null` or `undefined`.
|
||||
5
node_modules/gitignore/bin/gitignore.js
generated
vendored
Normal file
5
node_modules/gitignore/bin/gitignore.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib/main.js');
|
||||
require(lib);
|
||||
51
node_modules/gitignore/lib/library.js
generated
vendored
Normal file
51
node_modules/gitignore/lib/library.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
var https = require('https');
|
||||
|
||||
var GitIgnore = {};
|
||||
|
||||
GitIgnore.getTypes = function(callback){
|
||||
var types = [];
|
||||
https.get({host: "api.github.com", path: "/repos/github/gitignore/contents", headers: {"User-Agent": "gitignore node app"}}, function(res) {
|
||||
if (res.statusCode !== 200) {
|
||||
var err = new Error("somethingWentWrong");
|
||||
err.statusCode = res.statusCode;
|
||||
return callback(err);
|
||||
}
|
||||
var body = "";
|
||||
res.on("data", function(chunk) {
|
||||
body += chunk;
|
||||
});
|
||||
res.on("end", function() {
|
||||
var json = JSON.parse(body);
|
||||
for(var i = 0; i < json.length; ++i) {
|
||||
var name = json[i].name;
|
||||
var cleanName = name.substr(0, name.indexOf('.'));
|
||||
if (cleanName.length > 0 && name.match(/\.gitignore$/)){
|
||||
types.push(cleanName);
|
||||
}
|
||||
}
|
||||
callback(null, types);
|
||||
});
|
||||
}).on("error", callback);
|
||||
};
|
||||
|
||||
GitIgnore.writeFile = function(options, callback){
|
||||
if(!options.type){
|
||||
return callback(new Error("noTypeProvided"));
|
||||
}
|
||||
if(!options.file && !options.writable){
|
||||
return callback(new Error("noWritableProvided"));
|
||||
}
|
||||
https.get("https://raw.githubusercontent.com/github/gitignore/master/" + options.type + ".gitignore", function(res) {
|
||||
if (res.statusCode !== 200) {
|
||||
var err = new Error("typeDoesNotExist");
|
||||
err.statusCode = res.statusCode;
|
||||
return callback(err);
|
||||
}
|
||||
res.pipe(options.file || options.writable);
|
||||
return callback();
|
||||
}).on("error", callback);
|
||||
};
|
||||
|
||||
module.exports = GitIgnore;
|
||||
55
node_modules/gitignore/lib/main.js
generated
vendored
Normal file
55
node_modules/gitignore/lib/main.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
var GitIgnore = require('./library');
|
||||
var fs = require('fs');
|
||||
var OS = require('os');
|
||||
|
||||
(function() {
|
||||
var types = process.argv.slice(2);
|
||||
|
||||
if (!types || types.length === 0) {
|
||||
console.log("Usage: gitignore [PROJECT TYPE]");
|
||||
console.log("Example: gitignore rails");
|
||||
console.log("Available project types can be found by running `gitignore -types` or at https://github.com/github/gitignore");
|
||||
return;
|
||||
}
|
||||
|
||||
if (/^((--?)?types|-t)$/i.test(types.join())) {
|
||||
console.log("Fetching available types...");
|
||||
GitIgnore.getTypes(function(err, types){
|
||||
if(err){
|
||||
if(err.statusCode){
|
||||
console.error("Could not access file from GitHub. Recieved status code "+err.statusCode);
|
||||
} else {
|
||||
console.error("An unexpected error occurred.");
|
||||
console.error(err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
console.log(types.join(OS.EOL));
|
||||
});
|
||||
} else {
|
||||
types.forEach(function(type) {
|
||||
type = type.charAt(0).toUpperCase() + type.slice(1);
|
||||
var file = fs.createWriteStream(".gitignore", {'flags': 'a'});
|
||||
GitIgnore.writeFile({
|
||||
type: type,
|
||||
file: file
|
||||
}, function(err){
|
||||
if(err){
|
||||
if(err.statusCode){
|
||||
console.log("There is no gitignore for " + type);
|
||||
console.log("Available project types can be found by running `gitignore -types` or at https://github.com/github/gitignore");
|
||||
console.error("Recieved status code "+err.statusCode);
|
||||
} else {
|
||||
console.error("An unexpected error occurred.");
|
||||
console.error(err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
console.log("Created .gitignore file for type "+type+" :)");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
51
node_modules/gitignore/package.json
generated
vendored
Normal file
51
node_modules/gitignore/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"_from": "gitignore",
|
||||
"_id": "gitignore@0.6.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-hRjjnR4S+JbrCXHg+MmC5hbtdl4=",
|
||||
"_location": "/gitignore",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "gitignore",
|
||||
"name": "gitignore",
|
||||
"escapedName": "gitignore",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gitignore/-/gitignore-0.6.0.tgz",
|
||||
"_shasum": "8518e39d1e12f896eb0971e0f8c982e616ed765e",
|
||||
"_spec": "gitignore",
|
||||
"_where": "D:\\WORK\\Menui\\menui_backend",
|
||||
"author": {
|
||||
"name": "Michael Feldstein"
|
||||
},
|
||||
"bin": {
|
||||
"gitignore": "bin/gitignore.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/msfeldstein/gitignore/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Automatically fetch gitignore files for any project type from github into your new project",
|
||||
"devDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/msfeldstein/gitignore#readme",
|
||||
"main": "./lib/library.js",
|
||||
"name": "gitignore",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"url": "git+https://github.com/msfeldstein/gitignore.git"
|
||||
},
|
||||
"version": "0.6.0"
|
||||
}
|
||||
Reference in New Issue
Block a user