1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-12 10:52:47 +00:00

updated bunch of file paths and changed the way posts are loaded

This commit is contained in:
2016-01-05 12:28:04 -06:00
parent 719ae331ae
commit c96a84d0ff
13249 changed files with 317868 additions and 2101398 deletions

205
node_modules/optimist/index.js generated vendored
View File

@@ -1,5 +1,4 @@
var path = require('path');
var minimist = require('minimist');
var wordwrap = require('wordwrap');
/* Hack an instance of Argv with process.argv into Argv
@@ -18,7 +17,7 @@ Object.keys(inst).forEach(function (key) {
});
var exports = module.exports = Argv;
function Argv (processArgs, cwd) {
function Argv (args, cwd) {
var self = {};
if (!cwd) cwd = process.cwd();
@@ -38,44 +37,50 @@ function Argv (processArgs, cwd) {
);
}
var options = {
boolean: [],
string: [],
alias: {},
default: []
};
var flags = { bools : {}, strings : {} };
self.boolean = function (bools) {
options.boolean.push.apply(options.boolean, [].concat(bools));
if (!Array.isArray(bools)) {
bools = [].slice.call(arguments);
}
bools.forEach(function (name) {
flags.bools[name] = true;
});
return self;
};
self.string = function (strings) {
options.string.push.apply(options.string, [].concat(strings));
return self;
};
self.default = function (key, value) {
if (typeof key === 'object') {
Object.keys(key).forEach(function (k) {
self.default(k, key[k]);
});
}
else {
options.default[key] = value;
}
if (!Array.isArray(strings)) {
strings = [].slice.call(arguments);
}
strings.forEach(function (name) {
flags.strings[name] = true;
});
return self;
};
var aliases = {};
self.alias = function (x, y) {
if (typeof x === 'object') {
Object.keys(x).forEach(function (key) {
self.alias(key, x[key]);
});
}
else {
options.alias[x] = (options.alias[x] || []).concat(y);
else if (Array.isArray(y)) {
y.forEach(function (yy) {
self.alias(x, yy);
});
}
else {
var zs = (aliases[x] || []).concat(aliases[y] || []).concat(x, y);
aliases[x] = zs.filter(function (z) { return z != x });
aliases[y] = zs.filter(function (z) { return z != y });
}
return self;
};
@@ -123,6 +128,20 @@ function Argv (processArgs, cwd) {
return self;
};
var defaults = {};
self.default = function (key, value) {
if (typeof key === 'object') {
Object.keys(key).forEach(function (k) {
self.default(k, key[k]);
});
}
else {
defaults[key] = value;
}
return self;
};
var descriptions = {};
self.describe = function (key, desc) {
if (typeof key === 'object') {
@@ -137,7 +156,7 @@ function Argv (processArgs, cwd) {
};
self.parse = function (args) {
return parseArgs(args);
return Argv(args).argv;
};
self.option = self.options = function (key, opt) {
@@ -184,7 +203,7 @@ function Argv (processArgs, cwd) {
var keys = Object.keys(
Object.keys(descriptions)
.concat(Object.keys(demanded))
.concat(Object.keys(options.default))
.concat(Object.keys(defaults))
.reduce(function (acc, key) {
if (key !== '_') acc[key] = true;
return acc;
@@ -198,7 +217,7 @@ function Argv (processArgs, cwd) {
}
var switches = keys.reduce(function (acc, key) {
acc[key] = [ key ].concat(options.alias[key] || [])
acc[key] = [ key ].concat(aliases[key] || [])
.map(function (sw) {
return (sw.length > 1 ? '--' : '-') + sw
})
@@ -235,8 +254,8 @@ function Argv (processArgs, cwd) {
var type = null;
if (options.boolean[key]) type = '[boolean]';
if (options.string[key]) type = '[string]';
if (flags.bools[key]) type = '[boolean]';
if (flags.strings[key]) type = '[string]';
if (!wrap && dpadding.length > 0) {
desc += dpadding;
@@ -249,8 +268,8 @@ function Argv (processArgs, cwd) {
? '[required]'
: null
,
options.default[key] !== undefined
? '[default: ' + JSON.stringify(options.default[key]) + ']'
defaults[key] !== undefined
? '[default: ' + JSON.stringify(defaults[key]) + ']'
: null
,
].filter(Boolean).join(' ');
@@ -279,13 +298,110 @@ function Argv (processArgs, cwd) {
};
Object.defineProperty(self, 'argv', {
get : function () { return parseArgs(processArgs) },
get : parseArgs,
enumerable : true,
});
function parseArgs (args) {
var argv = minimist(args, options);
argv.$0 = self.$0;
function parseArgs () {
var argv = { _ : [], $0 : self.$0 };
Object.keys(flags.bools).forEach(function (key) {
setArg(key, defaults[key] || false);
});
function setArg (key, val) {
var num = Number(val);
var value = typeof val !== 'string' || isNaN(num) ? val : num;
if (flags.strings[key]) value = val;
setKey(argv, key.split('.'), value);
(aliases[key] || []).forEach(function (x) {
argv[x] = argv[key];
});
}
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (arg === '--') {
argv._.push.apply(argv._, args.slice(i + 1));
break;
}
else if (arg.match(/^--.+=/)) {
// Using [\s\S] instead of . because js doesn't support the
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
setArg(m[1], m[2]);
}
else if (arg.match(/^--no-.+/)) {
var key = arg.match(/^--no-(.+)/)[1];
setArg(key, false);
}
else if (arg.match(/^--.+/)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !next.match(/^-/)
&& !flags.bools[key]
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, next);
i++;
}
else if (/^(true|false)$/.test(next)) {
setArg(key, next === 'true');
i++;
}
else {
setArg(key, true);
}
}
else if (arg.match(/^-[^-]+/)) {
var letters = arg.slice(1,-1).split('');
var broken = false;
for (var j = 0; j < letters.length; j++) {
if (letters[j+1] && letters[j+1].match(/\W/)) {
setArg(letters[j], arg.slice(j+2));
broken = true;
break;
}
else {
setArg(letters[j], true);
}
}
if (!broken) {
var key = arg.slice(-1)[0];
if (args[i+1] && !args[i+1].match(/^-/)
&& !flags.bools[key]
&& (aliases[key] ? !flags.bools[aliases[key]] : true)) {
setArg(key, args[i+1]);
i++;
}
else if (args[i+1] && /true|false/.test(args[i+1])) {
setArg(key, args[i+1] === 'true');
i++;
}
else {
setArg(key, true);
}
}
}
else {
var n = Number(arg);
argv._.push(flags.strings['_'] || isNaN(n) ? arg : n);
}
}
Object.keys(defaults).forEach(function (key) {
if (!(key in argv)) {
argv[key] = defaults[key];
if (key in aliases) {
argv[aliases[key]] = defaults[key];
}
}
});
if (demanded._ && argv._.length < demanded._) {
fail('Not enough non-option arguments: got '
@@ -341,3 +457,22 @@ function rebase (base, dir) {
).replace(/\/$/,'').replace(/^$/, '.');
return p.match(/^[.\/]/) ? p : './' + p;
};
function setKey (obj, keys, value) {
var o = obj;
keys.slice(0,-1).forEach(function (key) {
if (o[key] === undefined) o[key] = {};
o = o[key];
});
var key = keys[keys.length - 1];
if (o[key] === undefined || typeof o[key] === 'boolean') {
o[key] = value;
}
else if (Array.isArray(o[key])) {
o[key].push(value);
}
else {
o[key] = [ o[key], value ];
}
}

35
node_modules/optimist/package.json generated vendored
View File

@@ -1,12 +1,12 @@
{
"_args": [
[
"optimist@0.6.0",
"/home/mywebsite/node_modules/nconf"
"optimist@~0.3.5",
"/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/transformers/node_modules/uglify-js"
]
],
"_from": "optimist@0.6.0",
"_id": "optimist@0.6.0",
"_from": "optimist@>=0.3.5 <0.4.0",
"_id": "optimist@0.3.7",
"_inCache": true,
"_installable": true,
"_location": "/optimist",
@@ -14,24 +14,24 @@
"email": "mail@substack.net",
"name": "substack"
},
"_npmVersion": "1.3.0",
"_npmVersion": "1.2.2",
"_phantomChildren": {},
"_requested": {
"name": "optimist",
"raw": "optimist@0.6.0",
"rawSpec": "0.6.0",
"raw": "optimist@~0.3.5",
"rawSpec": "~0.3.5",
"scope": null,
"spec": "0.6.0",
"type": "version"
"spec": ">=0.3.5 <0.4.0",
"type": "range"
},
"_requiredBy": [
"/nconf"
"/transformers/uglify-js"
],
"_resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.0.tgz",
"_shasum": "69424826f3405f79f142e6fc3d9ae58d4dbb9200",
"_resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz",
"_shasum": "c90941ad59e4273328923074d2cf2e7cbc6ec0d9",
"_shrinkwrap": null,
"_spec": "optimist@0.6.0",
"_where": "/home/mywebsite/node_modules/nconf",
"_spec": "optimist@~0.3.5",
"_where": "/home/mitchell/Desktop/test-mywebsite/mywebsite/node_modules/transformers/node_modules/uglify-js",
"author": {
"email": "mail@substack.net",
"name": "James Halliday",
@@ -41,7 +41,6 @@
"url": "https://github.com/substack/node-optimist/issues"
},
"dependencies": {
"minimist": "~0.0.1",
"wordwrap": "~0.0.2"
},
"description": "Light-weight option parsing with an argv hash. No optstrings attached.",
@@ -51,8 +50,8 @@
},
"directories": {},
"dist": {
"shasum": "69424826f3405f79f142e6fc3d9ae58d4dbb9200",
"tarball": "http://registry.npmjs.org/optimist/-/optimist-0.6.0.tgz"
"shasum": "c90941ad59e4273328923074d2cf2e7cbc6ec0d9",
"tarball": "http://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz"
},
"engine": {
"node": ">=0.4"
@@ -85,5 +84,5 @@
"scripts": {
"test": "tap ./test/*.js"
},
"version": "0.6.0"
"version": "0.3.7"
}

View File

@@ -465,19 +465,6 @@ This lets you organize arguments into nested objects.
'$0': 'node ./examples/reflect.js',
foo: { bar: { baz: 33 }, quux: 5 } }
short numbers
-------------
Short numeric `head -n5` style argument work too:
$ node reflect.js -n123 -m456
{ '3': true,
'6': true,
_: [],
'$0': 'node ./reflect.js',
n: 123,
m: 456 }
installation
============

31
node_modules/optimist/test/dash.js generated vendored
View File

@@ -1,31 +0,0 @@
var optimist = require('../index');
var test = require('tap').test;
test('-', function (t) {
t.plan(5);
t.deepEqual(
fix(optimist.parse([ '-n', '-' ])),
{ n: '-', _: [] }
);
t.deepEqual(
fix(optimist.parse([ '-' ])),
{ _: [ '-' ] }
);
t.deepEqual(
fix(optimist.parse([ '-f-' ])),
{ f: '-', _: [] }
);
t.deepEqual(
fix(optimist([ '-b', '-' ]).boolean('b').argv),
{ b: true, _: [ '-' ] }
);
t.deepEqual(
fix(optimist([ '-s', '-' ]).string('s').argv),
{ s: '-', _: [] }
);
});
function fix (obj) {
delete obj.$0;
return obj;
}

View File

@@ -1,14 +0,0 @@
var optimist = require('../');
var test = require('tap').test;
test('parse with modifier functions' , function (t) {
t.plan(1);
var argv = optimist().boolean('b').parse([ '-b', '123' ]);
t.deepEqual(fix(argv), { b: true, _: ['123'] });
});
function fix (obj) {
delete obj.$0;
return obj;
}

16
node_modules/optimist/test/short.js generated vendored
View File

@@ -1,16 +0,0 @@
var optimist = require('../index');
var test = require('tap').test;
test('-n123', function (t) {
t.plan(1);
var parse = optimist.parse([ '-n123' ]);
t.equal(parse.n, 123);
});
test('-123', function (t) {
t.plan(3);
var parse = optimist.parse([ '-123', '456' ]);
t.equal(parse['1'], true);
t.equal(parse['2'], true);
t.equal(parse['3'], 456);
});

View File

@@ -1,8 +0,0 @@
var optimist = require('../');
var test = require('tap').test;
test('whitespace should be whitespace' , function (t) {
t.plan(1);
var x = optimist.parse([ '-x', '\t' ]).x;
t.equal(x, '\t');
});