| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,6 @@ | |||
| 1 | + --style=linux | ||
| 2 | + --indent=spaces=2 | ||
| 3 | + --attach-namespaces | ||
| 4 | + --attach-classes | ||
| 5 | + --attach-inlines | ||
| 6 | + --attach-extern-c | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,21 @@ const file = require("./util/file"); | |||
| 4 | 4 | const idefs = require("./idefs"); | |
| 5 | 5 | const promisify = require("promisify-node"); | |
| 6 | 6 | const fse = promisify(require("fs-extra")); | |
| 7 | + const js_beautify = require('js-beautify').js_beautify; | ||
| 8 | + const beautify = function (input) { | ||
| 9 | + return js_beautify(input, { | ||
| 10 | + "brace_style": "end-expand", | ||
| 11 | + "max_preserve_newlines": 2, | ||
| 12 | + "preserve_newlines": true, | ||
| 13 | + "indent_size": 2, | ||
| 14 | + "indent_char": " " | ||
| 15 | + }); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + var exec = promisify(function(command, opts, callback) { | ||
| 20 | + return require("child_process").exec(command, opts, callback); | ||
| 21 | + }); | ||
| 7 | 22 | ||
| 8 | 23 | // Customize the delimiters so as to not process `{{{` or `}}}`. | |
| 9 | 24 | combyne.settings.delimiters = { | |
@@ -83,7 +98,7 @@ fse.remove(path.resolve(__dirname, "../src")).then(function() { | |||
| 83 | 98 | return fse.copy(path.resolve(__dirname, "./manual/"), path.resolve(__dirname, "../")); | |
| 84 | 99 | }).then(function() { | |
| 85 | 100 | // Write out single purpose templates. | |
| 86 | - file.write("../binding.gyp", templates.binding.render(enabled)); | ||
| 101 | + file.write("../binding.gyp", beautify(templates.binding.render(enabled))); | ||
| 87 | 102 | file.write("../src/nodegit.cc", templates.nodegit.render(enabled)); | |
| 88 | 103 | ||
| 89 | 104 | ||
@@ -106,5 +121,22 @@ fse.remove(path.resolve(__dirname, "../src")).then(function() { | |||
| 106 | 121 | } | |
| 107 | 122 | }); | |
| 108 | 123 | ||
| 109 | - file.write("../lib/enums.js", templates.enums.render(enabled)); | ||
| 124 | + | ||
| 125 | + file.write("../lib/enums.js", beautify(templates.enums.render(enabled))); | ||
| 126 | + }).then(function() { | ||
| 127 | + return exec('command -v astyle').then(function(astyle) { | ||
| 128 | + if (astyle) { | ||
| 129 | + return exec( | ||
| 130 | + 'astyle --options=\".astylerc\" ' | ||
| 131 | + + path.resolve(__dirname, "../src") + "/*.cc " | ||
| 132 | + + path.resolve(__dirname, "../include") + "/*.h" | ||
| 133 | + ).then(function() { | ||
| 134 | + return exec( | ||
| 135 | + 'rm ' | ||
| 136 | + + path.resolve(__dirname, "../src") + "/*.cc.orig " | ||
| 137 | + + path.resolve(__dirname, "../include") + "/*.h.orig " | ||
| 138 | + ); | ||
| 139 | + }); | ||
| 140 | + } | ||
| 141 | + }) | ||
| 110 | 142 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,6 +64,7 @@ | |||
| 64 | 64 | "fs-extra": "^0.12.0", | |
| 65 | 65 | "lodash": "^2.4.1", | |
| 66 | 66 | "istanbul": "~0.3.2", | |
| 67 | + "js-beautify": "^1.5.4", | ||
| 67 | 68 | "jshint": "~2.5.6", | |
| 68 | 69 | "mocha": "~1.21.4", | |
| 69 | 70 | "nan": "~1.3.0", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments