FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tidy up comment generation by maxkorp · Pull Request #924 · nodegit/nodegit · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cc  (3) .gyp  (1) .h  (2) .js  (2) All 4 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 10 additions & 6 deletions generate/scripts/generateNativeCode.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,26 @@ module.exports = function generateNativeCode() {
return fse.copy(path.resolve(__dirname, "../templates/manual/src"), path.resolve(__dirname, "../../src"));
}).then(function() {
// Write out single purpose templates.
utils.writeFile("../binding.gyp", beautify(templates.binding.render(enabled)));
utils.writeFile("../src/nodegit.cc", templates.nodegitCC.render(enabled));
utils.writeFile("../lib/nodegit.js", beautify(templates.nodegitJS.render(enabled)));
utils.writeFile("../binding.gyp", beautify(templates.binding.render(enabled)), "binding.gyp");
utils.writeFile("../src/nodegit.cc", templates.nodegitCC.render(enabled), "nodegit.cc");
utils.writeFile("../lib/nodegit.js", beautify(templates.nodegitJS.render(enabled)), "nodegit.js");
// Write out all the classes.
enabled.forEach(function(idef) {
if (idef.type && idef.type != "enum") {
utils.writeFile(
"../src/" + idef.filename + ".cc", templates[idef.type + "_content"].render(idef)
"../src/" + idef.filename + ".cc",
templates[idef.type + "_content"].render(idef),
idef.type + "_content.cc"
);
utils.writeFile(
"../include/" + idef.filename + ".h", templates[idef.type + "_header"].render(idef)
"../include/" + idef.filename + ".h",
templates[idef.type + "_header"].render(idef),
idef.type + "_header.h"
);
}
});

utils.writeFile("../lib/enums.js", beautify(templates.enums.render(enabled)));
utils.writeFile("../lib/enums.js", beautify(templates.enums.render(enabled)), "enums.js");
}).then(function() {
return exec("command -v astyle").then(function(astyle) {
if (astyle) {
Expand Down
11 changes: 10 additions & 1 deletion generate/scripts/utils.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ var util = {
}
},

writeFile: function(file, content) {
writeFile: function(file, content, header) {
try {
var file = local(file);
if (typeof content == "object") {
content = JSON.stringify(content, null, 2)
}

if (header) {
var commentPrefix = ~header.indexOf('.gyp') ? '#' : '//'
content = commentPrefix +
" This is a generated file, modify: generate/templates/" +
header +
"\n\n" +
content;
}

fse.ensureFileSync(file);
fse.writeFileSync(file, content);
return true;
Expand Down
2 changes: 0 additions & 2 deletions generate/templates/templates/binding.gyp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# // This is a generated file, modify: generate/templates/binding.gyp.

{
"targets": [
{
Expand Down
1 change: 0 additions & 1 deletion generate/templates/templates/class_content.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// This is a generated file, modify: generate/templates/class_content.cc.
#include <nan.h>
#include <string.h>

Expand Down
1 change: 0 additions & 1 deletion generate/templates/templates/class_header.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef {{ cppClassName|upper }}_H
#define {{ cppClassName|upper }}_H
// generated from class_header.h
#include <nan.h>
#include <string>
#include <queue>
Expand Down
1 change: 0 additions & 1 deletion generate/templates/templates/nodegit.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// This is a generated file, modify: generate/templates/nodegit.cc.
#include <node.h>
#include <v8.h>

Expand Down
1 change: 0 additions & 1 deletion generate/templates/templates/struct_content.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// This is a generated file, modify: generate/templates/struct_content.cc.
#include <nan.h>
#include <string.h>
#ifdef WIN32
Expand Down
1 change: 0 additions & 1 deletion generate/templates/templates/struct_header.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#ifndef {{ cppClassName|upper }}_H
#define {{ cppClassName|upper }}_H
// generated from struct_header.h
#include <nan.h>
#include <string>
#include <queue>
Expand Down

Back | FazBrowse Home | New Git URL