| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,22 +107,26 @@ module.exports = function generateNativeCode() { | |||
| 107 | 107 | return fse.copy(path.resolve(__dirname, "../templates/manual/src"), path.resolve(__dirname, "../../src")); | |
| 108 | 108 | }).then(function() { | |
| 109 | 109 | // Write out single purpose templates. | |
| 110 | - utils.writeFile("../binding.gyp", beautify(templates.binding.render(enabled))); | ||
| 111 | - utils.writeFile("../src/nodegit.cc", templates.nodegitCC.render(enabled)); | ||
| 112 | - utils.writeFile("../lib/nodegit.js", beautify(templates.nodegitJS.render(enabled))); | ||
| 110 | + utils.writeFile("../binding.gyp", beautify(templates.binding.render(enabled)), "binding.gyp"); | ||
| 111 | + utils.writeFile("../src/nodegit.cc", templates.nodegitCC.render(enabled), "nodegit.cc"); | ||
| 112 | + utils.writeFile("../lib/nodegit.js", beautify(templates.nodegitJS.render(enabled)), "nodegit.js"); | ||
| 113 | 113 | // Write out all the classes. | |
| 114 | 114 | enabled.forEach(function(idef) { | |
| 115 | 115 | if (idef.type && idef.type != "enum") { | |
| 116 | 116 | utils.writeFile( | |
| 117 | - "../src/" + idef.filename + ".cc", templates[idef.type + "_content"].render(idef) | ||
| 117 | + "../src/" + idef.filename + ".cc", | ||
| 118 | + templates[idef.type + "_content"].render(idef), | ||
| 119 | + idef.type + "_content.cc" | ||
| 118 | 120 | ); | |
| 119 | 121 | utils.writeFile( | |
| 120 | - "../include/" + idef.filename + ".h", templates[idef.type + "_header"].render(idef) | ||
| 122 | + "../include/" + idef.filename + ".h", | ||
| 123 | + templates[idef.type + "_header"].render(idef), | ||
| 124 | + idef.type + "_header.h" | ||
| 121 | 125 | ); | |
| 122 | 126 | } | |
| 123 | 127 | }); | |
| 124 | 128 | ||
| 125 | - utils.writeFile("../lib/enums.js", beautify(templates.enums.render(enabled))); | ||
| 129 | + utils.writeFile("../lib/enums.js", beautify(templates.enums.render(enabled)), "enums.js"); | ||
| 126 | 130 | }).then(function() { | |
| 127 | 131 | return exec("command -v astyle").then(function(astyle) { | |
| 128 | 132 | if (astyle) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,13 +20,22 @@ var util = { | |||
| 20 | 20 | } | |
| 21 | 21 | }, | |
| 22 | 22 | ||
| 23 | - writeFile: function(file, content) { | ||
| 23 | + writeFile: function(file, content, header) { | ||
| 24 | 24 | try { | |
| 25 | 25 | var file = local(file); | |
| 26 | 26 | if (typeof content == "object") { | |
| 27 | 27 | content = JSON.stringify(content, null, 2) | |
| 28 | 28 | } | |
| 29 | 29 | ||
| 30 | + if (header) { | ||
| 31 | + var commentPrefix = ~header.indexOf('.gyp') ? '#' : '//' | ||
| 32 | + content = commentPrefix + | ||
| 33 | + " This is a generated file, modify: generate/templates/" + | ||
| 34 | + header + | ||
| 35 | + "\n\n" + | ||
| 36 | + content; | ||
| 37 | + } | ||
| 38 | + | ||
| 30 | 39 | fse.ensureFileSync(file); | |
| 31 | 40 | fse.writeFileSync(file, content); | |
| 32 | 41 | return true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,3 @@ | |||
| 1 | - # // This is a generated file, modify: generate/templates/binding.gyp. | ||
| 2 | - | ||
| 3 | 1 | { | |
| 4 | 2 | "targets": [ | |
| 5 | 3 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - // This is a generated file, modify: generate/templates/class_content.cc. | ||
| 2 | 1 | #include <nan.h> | |
| 3 | 2 | #include <string.h> | |
| 4 | 3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,5 @@ | |||
| 1 | 1 | #ifndef {{ cppClassName|upper }}_H | |
| 2 | 2 | #define {{ cppClassName|upper }}_H | |
| 3 | - // generated from class_header.h | ||
| 4 | 3 | #include <nan.h> | |
| 5 | 4 | #include <string> | |
| 6 | 5 | #include <queue> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - // This is a generated file, modify: generate/templates/nodegit.cc. | ||
| 2 | 1 | #include <node.h> | |
| 3 | 2 | #include <v8.h> | |
| 4 | 3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - // This is a generated file, modify: generate/templates/struct_content.cc. | ||
| 2 | 1 | #include <nan.h> | |
| 3 | 2 | #include <string.h> | |
| 4 | 3 | #ifdef WIN32 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,5 @@ | |||
| 1 | 1 | #ifndef {{ cppClassName|upper }}_H | |
| 2 | 2 | #define {{ cppClassName|upper }}_H | |
| 3 | - // generated from struct_header.h | ||
| 4 | 3 | #include <nan.h> | |
| 5 | 4 | #include <string> | |
| 6 | 5 | #include <queue> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments