diff --git a/.gitignore b/.gitignore
index 3c3629e..5cbcf26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+export
diff --git a/index.js b/index.js
index 7eeff26..e3137a5 100644
--- a/index.js
+++ b/index.js
@@ -1,35 +1,141 @@
var nodegit = require('nodegit')
var path = require('path')
+var fs = require('fs')
+
+var all = []
+
+var git_data = []
+
+var cnt = 0;
+
+//var export_path = 'export/';
+var export_path = '/Users/gauthiier/Desktop/vbox/reckon_export/export';
+var export_index_fname = 'index.json';
+var export_index = null;
+
+var template = '';
+
+var imgs_list_ext_valid = ['.png', '.jpeg', '.jpg', '.gif']
+
+fs.readFile('template.html', 'utf8', function(err, data) {
+ if(err) console.log(err);
+ template = data;
+});
+
+// hmm...
+var export_index_path = path.join(export_path, export_index_fname);
+if(fs.existsSync(export_index_path))
+ export_index = JSON.parse(fs.readFileSync(export_index_path, 'utf8'));
nodegit.Repository.open(path.resolve(__dirname, './.git'))
.then(function(repo) {
return repo.getBranchCommit('prototype');
})
.then(function(first_commit) {
- var history = first_commit.history(nodegit.Revwalk.SORT.Time);
+ var history = first_commit.history(nodegit.Revwalk.SORT.REVERSE);
+ //var history = first_commit.history(nodegit.Revwalk.SORT.TIME);
history.on("commit", function(commit) {
- console.log("commit " + commit.sha());
- console.log("Author:", commit.author().name() +
- " <" + commit.author().email() + ">");
- console.log("Date:", commit.date());
- console.log("\n " + commit.message());
+
+ var entry = {};
+
+ entry.commit = commit.sha();
+ entry.author = commit.author().name();
+ entry.date = commit.date();
+ entry.raw = commit.rawHeader();
+ entry.message = commit.message().replace('\n', ' — ');
+ entry.files = [];
+
commit.getTree()
.then(function (tree) {
- var entries = tree.entries();
+ var entries = tree.entries();
- // look at diffs here -- as entries grows and does not specify the *specific* entries of this commit
+ for(e in entries) {
+ var ep = entries[e].path();
+ if(all.indexOf(ep) != -1) continue;
+ all.push(ep);
+ entry.files.push(ep);
+ }
+
+ });
+
+ git_data.push(entry);
- for(e in entries) {
- console.log(entries[e].path());
- }
-
- });
-
});
- history.start();
+ history.on("end", function() {
+ var body = '';
+ git_data.reverse();
+ for(var i in git_data)
+ body += emit_git_entry(git_data[i]);
+ console.log(template.replace('[[_export_]]', body));
+ });
+
+ history.start();
})
- .done();
\ No newline at end of file
+ .done();
+
+function emit_git_entry(entry) {
+
+ var html = '\n';
+
+ html += 'Commit: ' + entry.commit + '
' + entry.message + '
\n';
+ else if(ext === '.pdf') {
+ return '' + emit_git_content_pdf(c) + '';
+ } else {
+ return '' + c + '\n';
+ }
+
+}
+
+function emit_git_content_pdf(c) {
+
+ var index = exists(c);
+ if(!index) return '';
+
+ return '
\n';
+
+}
+
+/// hmmm....
+function exists(fname) {
+
+ if(!export_index) return null;
+ for (var e in export_index) {
+ if(export_index[e].name === fname)
+ return export_index[e];
+ }
+ return null;
+}
+
+
\ No newline at end of file
diff --git a/reckon.css b/reckon.css
new file mode 100644
index 0000000..4bb10f1
--- /dev/null
+++ b/reckon.css
@@ -0,0 +1,43 @@
+body {
+ font-family: "Times New Roman", Times, Georgia, serif;
+ background-color: #ffff99;
+ bbackground-color: #e9d6a8;
+ bbackground-color: #eeeeee;
+}
+
+#listing {
+ width: 100%;
+}
+
+#title {
+ margin-left: auto;
+ margin-right: auto;
+ text-align: center;
+ margin: 3em;
+}
+
+entry {
+ display: block;
+ width: 75%;
+ border: 1px solid grey;
+ min-width: 650px;
+ margin-top: 0.6em;
+ padding: 0.6em;
+ background-color: #ffffcc;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+commit {
+ display: block;
+}
+
+content {
+ display: block;
+}
+
+content img {
+ max-width: 300px;
+ border: 1px solid grey;
+ background-color: white;
+}
\ No newline at end of file
diff --git a/template.html b/template.html
new file mode 100644
index 0000000..0d953c3
--- /dev/null
+++ b/template.html
@@ -0,0 +1,13 @@
+
+