Skip to content

Commit a33e3ae

Browse files
committed
Merging master
2 parents 572ae33 + 814de3c commit a33e3ae

55 files changed

Lines changed: 375 additions & 64 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.npmignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
/build/
22
/example/
33
/examples/
4-
/generate/
54
/test/
65
/vendor/Release/
76

7+
/generate/output
8+
/generate/**/*.json
9+
!/generate/input/*.json
10+
811
.astylerc
912
.editorconfig
1013
.gitignore
1114
.gitmodules
1215
.jshintrc
1316
.travis.yml
14-
.appveyor.yml
17+
appveyor.yml
1518
.didntcomefromthenpmregistry
1619

1720
*.vcxproj

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
env:
22
matrix:
33
- export NODE_VERSION="0.10"
4-
- export NODE_VERSION="0.11"
54
before_install:
65
- git clone https://github.com/creationix/nvm.git ./.nvm
76
- source ./.nvm/nvm.sh

README.md

Lines changed: 3 additions & 10 deletions
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var nodegit = require("../");
2+
var promisify = require("promisify-node");
3+
var fse = promisify(require("fs-extra"));
4+
var path = "/tmp/nodegit-github-2factor-demo";
5+
6+
var token = "{Your GitHub user token}";
7+
var repoOwner = "{The orgname or username that owns the repo}";
8+
var repoName = "{The name of the repo}";
9+
10+
// To clone with 2 factor auth enabled, you have to use a github oauth token
11+
// over https, it can't be done with actual 2 factor.
12+
// https://github.com/blog/1270-easier-builds-and-deployments-using-git-over-https-and-oauth
13+
14+
// The token has to be included in the URL if the repo is private.
15+
// Otherwise, github just wont respond, so a normal credential callback
16+
// wont work.
17+
var repoUrl = "https://" + token +
18+
":-oauth-basic@github.com/" +
19+
repoOwner + "/" +
20+
repoName + ".git";
21+
22+
var opts = { ignoreCertErrors: 1};
23+
24+
// If the repo is public, you can use a callback instead
25+
var repoUrl = "https://github.com/" + repoOwner + "/" + repoName + ".git";
26+
27+
var opts = {
28+
ignoreCertErrors: 1,
29+
remoteCallbacks: {
30+
credentials: function() {
31+
return nodegit.Cred.userpassPlaintextNew (token, "x-oauth-basic");
32+
}
33+
}
34+
};
35+
36+
fse.remove(path).then(function() {
37+
nodegit.Clone.clone(repoUrl, path, opts)
38+
.done(function(repo) {
39+
if (repo instanceof nodegit.Repository) {
40+
console.info("We cloned the repo!");
41+
}
42+
else {
43+
console.error("Something borked :(");
44+
}
45+
});
46+
});

generate/input/descriptor.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,26 @@
364364
"cred": {
365365
"cType": "git_cred",
366366
"functions": {
367+
"git_cred_default_new": {
368+
"isAsync": false
369+
},
367370
"git_cred_ssh_custom_new": {
368371
"ignore": true
369372
},
370373
"git_cred_ssh_interactive_new": {
371374
"ignore": true
372375
},
373-
"git_cred_ssh_key_from_agent":{
376+
"git_cred_ssh_key_from_agent": {
374377
"isAsync": false
375378
},
376379
"git_cred_ssh_key_new": {
377380
"isAsync": false
378381
},
379382
"git_cred_userpass": {
380383
"ignore": true
384+
},
385+
"git_cred_userpass_plaintext_new": {
386+
"isAsync": false
381387
}
382388
}
383389
},

generate/scripts/generateNativeCode.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,49 @@ module.exports = function generateNativeCode() {
2727
};
2828

2929
var partials = {
30-
asyncFunction: utils.readFile("combyne/partials/async_function.cc"),
31-
callbackHelpers: utils.readFile("combyne/partials/callback_helpers.cc"),
32-
convertFromV8: utils.readFile("combyne/partials/convert_from_v8.cc"),
33-
convertToV8: utils.readFile("combyne/partials/convert_to_v8.cc"),
34-
doc: utils.readFile("combyne/partials/doc.cc"),
35-
fields: utils.readFile("combyne/partials/fields.cc"),
36-
guardArguments: utils.readFile("combyne/partials/guard_arguments.cc"),
37-
syncFunction: utils.readFile("combyne/partials/sync_function.cc"),
38-
fieldAccessors: utils.readFile("combyne/partials/field_accessors.cc")
30+
asyncFunction: utils.readFile("templates/partials/async_function.cc"),
31+
callbackHelpers: utils.readFile("templates/partials/callback_helpers.cc"),
32+
convertFromV8: utils.readFile("templates/partials/convert_from_v8.cc"),
33+
convertToV8: utils.readFile("templates/partials/convert_to_v8.cc"),
34+
doc: utils.readFile("templates/partials/doc.cc"),
35+
fields: utils.readFile("templates/partials/fields.cc"),
36+
guardArguments: utils.readFile("templates/partials/guard_arguments.cc"),
37+
syncFunction: utils.readFile("templates/partials/sync_function.cc"),
38+
fieldAccessors: utils.readFile("templates/partials/field_accessors.cc")
3939
};
4040

4141
var templates = {
42-
class_content: utils.readFile("combyne/templates/class_content.cc"),
43-
struct_content: utils.readFile("combyne/templates/struct_content.cc"),
44-
class_header: utils.readFile("combyne/templates/class_header.h"),
45-
struct_header: utils.readFile("combyne/templates/struct_header.h"),
46-
binding: utils.readFile("combyne/templates/binding.gyp"),
47-
nodegitCC: utils.readFile("combyne/templates/nodegit.cc"),
48-
nodegitJS: utils.readFile("combyne/templates/nodegit.js"),
49-
enums: utils.readFile("combyne/templates/enums.js")
42+
class_content: utils.readFile("templates/templates/class_content.cc"),
43+
struct_content: utils.readFile("templates/templates/struct_content.cc"),
44+
class_header: utils.readFile("templates/templates/class_header.h"),
45+
struct_header: utils.readFile("templates/templates/struct_header.h"),
46+
binding: utils.readFile("templates/templates/binding.gyp"),
47+
nodegitCC: utils.readFile("templates/templates/nodegit.cc"),
48+
nodegitJS: utils.readFile("templates/templates/nodegit.js"),
49+
enums: utils.readFile("templates/templates/enums.js")
5050
};
5151

5252
var filters = {
53-
upper: require("../combyne/filters/upper"),
54-
replace: require("../combyne/filters/replace"),
55-
titleCase: require("../combyne/filters/title_case"),
56-
or: require("../combyne/filters/or"),
57-
and: require("../combyne/filters/and"),
58-
defaultValue: require("../combyne/filters/default_value"),
59-
argsInfo: require("../combyne/filters/args_info"),
60-
cppToV8: require("../combyne/filters/cpp_to_v8"),
61-
jsArgsCount: require("../combyne/filters/js_args_count"),
62-
isV8Value: require("../combyne/filters/is_v8_value"),
63-
isPointer: require("../combyne/filters/is_pointer"),
64-
isDoublePointer: require("../combyne/filters/is_double_pointer"),
65-
isOid: require("../combyne/filters/is_oid"),
66-
unPointer: require("../combyne/filters/un_pointer"),
67-
payloadFor: require("../combyne/filters/payload_for"),
68-
hasReturnType: require("../combyne/filters/has_return_type"),
69-
hasReturns: require("../combyne/filters/has_returns"),
70-
returnsCount: require("../combyne/filters/returns_count"),
71-
returnsInfo: require("../combyne/filters/returns_info"),
72-
fieldsInfo: require("../combyne/filters/fields_info")
53+
upper: require("../templates/filters/upper"),
54+
replace: require("../templates/filters/replace"),
55+
titleCase: require("../templates/filters/title_case"),
56+
or: require("../templates/filters/or"),
57+
and: require("../templates/filters/and"),
58+
defaultValue: require("../templates/filters/default_value"),
59+
argsInfo: require("../templates/filters/args_info"),
60+
cppToV8: require("../templates/filters/cpp_to_v8"),
61+
jsArgsCount: require("../templates/filters/js_args_count"),
62+
isV8Value: require("../templates/filters/is_v8_value"),
63+
isPointer: require("../templates/filters/is_pointer"),
64+
isDoublePointer: require("../templates/filters/is_double_pointer"),
65+
isOid: require("../templates/filters/is_oid"),
66+
unPointer: require("../templates/filters/un_pointer"),
67+
payloadFor: require("../templates/filters/payload_for"),
68+
hasReturnType: require("../templates/filters/has_return_type"),
69+
hasReturns: require("../templates/filters/has_returns"),
70+
returnsCount: require("../templates/filters/returns_count"),
71+
returnsInfo: require("../templates/filters/returns_info"),
72+
fieldsInfo: require("../templates/filters/fields_info")
7373
};
7474

7575
// Convert Buffers to Combyne templates.
@@ -100,7 +100,7 @@ module.exports = function generateNativeCode() {
100100
fse.remove(path.resolve(__dirname, "../../src")).then(function() {
101101
return fse.remove(path.resolve(__dirname, "../../include"));
102102
}).then(function() {
103-
return fse.copy(path.resolve(__dirname, "../combyne/manual/"), path.resolve(__dirname, "../../"));
103+
return fse.copy(path.resolve(__dirname, "../templates/manual/"), path.resolve(__dirname, "../../"));
104104
}).then(function() {
105105
// Write out single purpose templates.
106106
utils.writeFile("../binding.gyp", beautify(templates.binding.render(enabled)));
File renamed without changes.

0 commit comments

Comments
 (0)