This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmary.js
78 lines (60 loc) · 1.95 KB
/
mary.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env node
(function() {
"use strict";
// prototype Hack functions
String.prototype.PathNormalize = function(array){
var text = this.split("/").reverse();
if(text[0] == ""){
return text.slice(1).reverse().join("/");
}
return this;
}
//core Modules
var articlesGenerator = require("./core/articles"),
indexGenerator = require("./core/index"),
Theme = require("./core/theme"),
assetsGenerator = require("./core/assets"),
Arguments = require("./core/arguments"),
acceptableArguments = require("./core/arguments.json");
// Node Modules
var fs = require('fs'),
mkdirp = require('mkdirp');
//argument strings
var args = process.argv;
var argumentQuery = Arguments(args, acceptableArguments);
//path locations
var path = process.cwd();
var themePath = process.cwd() + "/theme";
//path changer
if (argumentQuery.output !== false && argumentQuery.output !== undefined) {
if (argumentQuery.output[1] != "/") {
path = process.cwd() + "/" + argumentQuery.output;
path = path.PathNormalize();
} else {
path = argumentQuery.output;
}
}
if (argumentQuery.theme !== false && argumentQuery.theme !== undefined) {
if (argumentQuery.theme[1] != "/") {
themePath = process.cwd() + "/" + argumentQuery.theme;
themePath = themePath.PathNormalize();
} else {
themePath = argumentQuery.theme;
}
}
//theme loader
var theme = new Theme(themePath);
//mary Main code
function Mary() {
this.articlesRoutes = [];
};
Mary.prototype = {
assets: assetsGenerator,
articles: articlesGenerator,
index: indexGenerator,
}
var m = new Mary();
m.articles(path,theme);
m.assets(path,theme);
m.index(path, theme);
})();