Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
9277eb2
Enabled most of Git Clone support
tbranyen Jul 11, 2014
4252a14
Skip network related tests
tbranyen Jul 13, 2014
80ef9c2
Ensure that function names are generated properly
tbranyen Oct 7, 2014
193738c
Enabling broken tests as acceptance critera
tbranyen Oct 7, 2014
d6f7ffb
Fixes the build and removes src and include from Git
tbranyen Oct 7, 2014
63e0a29
Included libssh2 in the build
Oct 8, 2014
198f2e8
Enabled SSH for Git
Oct 8, 2014
2af57be
Enabled SSL protocol
Oct 8, 2014
424c18d
Starting work on CloneOptions
Oct 8, 2014
016f61f
Refactored options normalization to be more generic
tbranyen Oct 8, 2014
1504d33
Starting work on getting structs to be wrapped properly
Oct 10, 2014
7a423b0
Clone test now actually constructs a git_clone_options object
Oct 10, 2014
61205d5
Apparently don't need to free the struct from memory.
Oct 10, 2014
2fcd278
Added version property to CloneOptions
tbranyen Oct 10, 2014
f64eba1
Fixed memory getting overwritten
Oct 10, 2014
2aaed86
Fixed cert errors with clone
Oct 10, 2014
2af4f78
Added git protocol
tbranyen Oct 10, 2014
c313718
Ensure that clone is loaded and normalize works
tbranyen Oct 11, 2014
1766aad
Added in GitCred
tbranyen Oct 11, 2014
7239378
Correctly add function documentation
tbranyen Oct 13, 2014
6a0b289
Fix a few entries showing incorrect types
tbranyen Oct 13, 2014
1c563e7
Added more descriptions to the idefs file
tbranyen Oct 13, 2014
2bf45b3
Objects can now store enums/structs and opaque structs
Oct 13, 2014
14189e0
Cleaned up source code and bumped Combyne
tbranyen Oct 14, 2014
318ed1c
Clean up more templates
tbranyen Oct 14, 2014
22a6ec2
Trying to get nested objects to work
Oct 15, 2014
961a664
Forgot to remove pointer deference
Oct 15, 2014
b2c19f7
Nested objects work for generated structs now
Oct 16, 2014
de04c08
Introduced a new segfault woot
tbranyen Oct 16, 2014
d6a2fed
Removed a new segfault woot
Oct 16, 2014
9fa1a86
Creating C++ wrapper for C->C++->JS callbacks
Oct 16, 2014
064b9dd
Getter/setter for functions
Oct 16, 2014
2ff3440
Added header declaration for callbacks
Oct 16, 2014
2df8dd6
Shell for internal C++ callback wrapper
Oct 16, 2014
a70dad9
Callbacks now build
Oct 17, 2014
5459e38
Normalize the remote callbacks
tbranyen Oct 17, 2014
22afe87
Ensure remoteCallbacks aren't initialized as an object
tbranyen Oct 17, 2014
a7bc444
Callback returns are compiling now.
Oct 17, 2014
5b5ce73
Better function assignment
tbranyen Oct 17, 2014
96af2b7
Getting close to having callbacks
Oct 17, 2014
7b8be79
Forgot to take out a test line
Oct 17, 2014
e841d8e
Added in git credentials lookup and libssh2 build
tbranyen Oct 18, 2014
f9486e9
Ensure that sshKeyFromAgent is prototype
tbranyen Oct 18, 2014
ee99948
Attempt to pass libssh on Windows
tbranyen Oct 18, 2014
5997af5
Callbacks are now working
Oct 20, 2014
4ca3ae4
Ensure the c++11 compiler is used
tbranyen Oct 20, 2014
5479d3b
Return the correct cred instance
tbranyen Oct 20, 2014
bef8796
Bring back the prototype
tbranyen Oct 20, 2014
e33ed5e
Credentials are passing but getting seg faults
Oct 21, 2014
61d7382
Upgrade Travis-CI to latest GCC and SSH
tbranyen Oct 21, 2014
925b4c9
Added open ssl
Oct 21, 2014
abec2e1
Fixed single quotes
Oct 21, 2014
f4ab43c
Trying to get openssh building
Oct 21, 2014
f9ace65
Removed openssl fixed build
tbranyen Oct 21, 2014
8ab40d8
Fix clone with filesytem for windows
tbranyen Oct 21, 2014
c3c5b8d
Pass http and https tests in Windows
tbranyen Oct 22, 2014
a02cb9e
Only add WINHTTP in windows
tbranyen Oct 22, 2014
5eb962e
Maybe starts the agent
tbranyen Oct 22, 2014
dbfba2b
Skip ssh test in Windows until we figure out how
tbranyen Oct 22, 2014
8b9a7ac
Building mostly with 0.11 some build errors
tbranyen Oct 22, 2014
aa006c3
I've made a mess of things
tbranyen Oct 22, 2014
3732a02
Mostly working in 0.11
tbranyen Oct 22, 2014
aa3c7fb
Getfunction
tbranyen Oct 22, 2014
d52bce7
Windows uses winhttp and doesn't need SSL
Oct 22, 2014
f1459e5
Yay contributors!!
Oct 22, 2014
f45726f
Updated comment, fixed if check
tbranyen Oct 22, 2014
17ef8ba
Fixed seg faults for callback functions
Oct 23, 2014
9c77a10
Increase builds jobs to enable parallel builds
tbranyen Oct 23, 2014
b7ad1c4
Fix http_parser woes
tbranyen Oct 23, 2014
bebd459
Ensures that the correct http_parser is used
tbranyen Oct 23, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/node_modules/
/vendor/libgit2/
/vendor/libssh2/
/vendor/http_parser/
/build/
/coverage/
/test/repos/
/src/
/include/

/vendor/Release
/vendor/*.vcxproj
Expand All @@ -12,12 +16,4 @@
/generate/idefs.json
/binding.gyp

/src/*
!/src/functions/copy.cc
!/src/wrapper.cc

/include/*
!/include/functions/copy.h
!/include/wrapper.h

*.log
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Install GCC 4.8 for C++11 support.
before_install:
- "sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test"
- "sudo apt-get -qq update"
- "sudo apt-get -qq install g++-4.8"
- "export CXX='g++-4.8'"
- "export JOBS=4"
# This is a random private key used purely for testing.
before_script:
- echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- echo -e "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDkTcgXnHuqR0gbwegnr9Zxz4hTkjjV/SpgJNPJz7mo/HKNbx0rqjj1P0yGR053R9GSFFim2ut4NK9DPPUkQdyucw+DoLkYRHJmlJ4BNa9NTCD0sl+eSXO2969kZojCYSOgbmkCJx8mdgTwhzdgE/jhBrsY0hPE6pRTlU+H68/zeNdJUAIJf0LLXOm3hpTKLA19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gU/CSCLf8pCYa6pA/GmsaXxloeJGLvT4fzOZRsVav80/92XHRhAoGBAOu2\nmKh4Gr1EjgN9QNbk9cQTSFDtlBEqO/0pTepvL73UvNp/BAn4iYZFU4WnklFVBSWc\nL84Sc732xU12TAbTTUsa6E7W29pS8u7zVTxlIdQIIU5pzDyU1pNNk2kpxzte5p3Y\nPDtniPFsoYLWoH0LpsKL93t2pLAj+IOkE6f3XBq5AoGAIKaYo5N1FxQr952frx/x\nQUpK0N/R5Ng8v18SiLG26rhmM5iVSrQXC7TrHI7wfR8a9tC6qP/NqnM9NuwC/bQ0\nEEo7/GhaWxKNRwZRkmWiSFLNGk9t1hbtGU+N1lUdFtmloPIQdRNiw0kN3JTj474Q\nYI7O1EItFORnK6yxZfR6HEECgYEA1CT7MGUoa8APsMRCXyaiq15Pb8bjxK8mXquW\nHLEFXuzhLCW1FORDoj0y9s/iuKC0iS0ROX8R/J7k5NrbgikbH8WP36UxKkYNr1IC\nHOFImPTYRSKjVsL+fIUNb1DSp3S6SsYbL7v3XJJQqtlQiDq8U8x1aQFXJ9C4EoLR\nzhKrKsECgYBtU/TSF/TATZY5XtrN9O+HX1Fbz70Ci8XgvioheVI2fezOcXPRzDcC\nOYPaCMNKA5E8gHdg4s0TN7uDvKTJ+KhSg2V7gZ39A28dHrJaRX7Nz4k6t2uEBjX9\na1JidpAIbJ+3w7+hj6L299tVZvS+Y/6Dz/uuEQGXfJg/l/5CCvQPsA==\n-----END RSA PRIVATE KEY-----" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa*
- eval `ssh-agent -s`
- ssh-add ~/.ssh/id_rsa
language: node_js
node_js:
- "0.10"
Expand All @@ -7,3 +22,4 @@ git:
branches:
only:
- master

2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- cmd: SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
- cmd: SET PATH=c:\python27;%PATH%
- cmd: SET JOBS=4
- cmd: ssh-agent -s
- cmd: npm install -g node-gyp
- npm install --msvs_version=2013

Expand Down
130 changes: 128 additions & 2 deletions generate/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,76 @@
},

"git_checkout_init_options": {
"ignore": false
"ignore": true
}
}
},

"checkout_options": {
"isStruct": true,
"cType": "git_checkout_options",
"dependencies": [
"../include/strarray.h",
"../include/functions/copy.h",
"../include/checkout_options.h",
"../include/tree.h"
],
"fields": []
},

"clone": {
"cType": null
"cType": null,
"trim": false,

"dependencies": [
"../include/signature.h",
"../include/checkout_options.h",
"../include/repository.h",
"../include/remote.h"
],

"functions": {
"git_clone": {
"ignore": false,
"isConstructorMethod": true,
"args": [{}, {}, {}, { "isOptional": true }]
},

"git_clone_into": {
"ignore": false,
"isConstructorMethod": true,
"args": [{}, {}, { "isOptional": true }]
}
}
},

"clone_options": {
"cType": "git_clone_options",
"isStruct": true,
"dependencies": [
"../include/checkout_options.h",
"../include/remote_callbacks.h"
],

"fields": [{
"name": "version",
"cType": "int"
}, {
"name": "remote_callbacks",
"cType": "git_remote_callbacks"
}, {
"name": "bare",
"cType": "int"
}, {
"name": "ignore_cert_errors",
"cType": "int"
}, {
"name": "remote_name",
"cType": "const char *"
}, {
"name": "checkout_branch",
"cType": "const char *"
}]
},

"commit": {
Expand Down Expand Up @@ -223,6 +280,19 @@
"config": {
},

"cred": {
"isStruct": true,
"cType": "git_cred",
"functions": {
"git_cred_ssh_key_from_agent": {
"ignore": false,
"isPrototypeMethod": false,
"args": [{ "isSelf": false }],
"isAsync": false
}
}
},

"cred_helpers": {
},

Expand Down Expand Up @@ -627,6 +697,53 @@
}
},

"remote_callbacks": {
"isStruct": true,
"cType": "git_remote_callbacks",
"dependencies": [
"../include/cred.h"
],
"fields": [{
"name": "version",
"cType": "int"
}, {
"name": "credentials",
"cType": "git_cred_acquire_cb",
"isFunction": true,
"args": [
{
"name": "cred",
"cType": "git_cred **",
"isReturn": true
},
{
"name": "url",
"cType": "const char *"
},
{
"name": "username_from_url",
"cType": "const char *"
},
{
"name": "allowed_types",
"cType": "unsigned int"
},
{
"name": "payload",
"cType": "void *"
}
],
"returnType": "int",
"returnNoResults": 1,
"returnSuccess": 0,
"returnError": -1
}, {
"name": "payload",
"cType": "void *",
"payloadFor": "*"
}]
},

"repository": {
"dependencies": [
"../include/functions/copy.h",
Expand Down Expand Up @@ -822,6 +939,15 @@
},

"transport": {
"cType": null,
"trim": false,

"functions": {
"git_cred_ssh_key_from_agent": {
"ignore": false,
"isConstructorMethod": true
}
}
},

"tree": {
Expand Down
14 changes: 14 additions & 0 deletions generate/filters/payload_for.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = function(fields, payloadForField) {
fields = fields || [];

var result = fields.filter(function (field) {
return field.payloadFor && (field.payloadFor === payloadForField || field.payloadFor === "*");
});

if (result.length > 0) {
return result[0].name;
}
else {
return "";
}
};
9 changes: 9 additions & 0 deletions generate/filters/title_case.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function(str) {
return str.split(/_|\//).map(function(val, index) {
if (val.length) {
return val[0].toUpperCase() + val.slice(1);
}

return val;
}).join("");
};
24 changes: 18 additions & 6 deletions generate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ var partials = {
doc: file.read("partials/doc.cc"),
fields: file.read("partials/fields.cc"),
guardArguments: file.read("partials/guard_arguments.cc"),
syncFunction: file.read("partials/sync_function.cc")
syncFunction: file.read("partials/sync_function.cc"),
fieldAccessors: file.read("partials/field_accessors.cc")
};

var templates = {
class: file.read("templates/class.cc"),
header: file.read("templates/header.h"),
class_content: file.read("templates/class_content.cc"),
struct_content: file.read("templates/struct_content.cc"),
class_header: file.read("templates/class_header.h"),
struct_header: file.read("templates/struct_header.h"),
binding: file.read("templates/binding.gyp"),
nodegit: file.read("templates/nodegit.cc")
};

var filters = {
upper: require("./filters/upper"),
replace: require("./filters/replace"),
titleCase: require("./filters/title_case"),
or: require("./filters/or"),
and: require("./filters/and"),
defaultValue: require("./filters/default_value"),
Expand All @@ -41,6 +45,7 @@ var filters = {
isPointer: require("./filters/is_pointer"),
isDoublePointer: require("./filters/is_double_pointer"),
unPointer: require("./filters/un_pointer"),
payloadFor: require("./filters/payload_for"),
hasReturnType: require("./filters/has_return_type"),
hasReturns: require("./filters/has_returns"),
returnsCount: require("./filters/returns_count"),
Expand All @@ -60,7 +65,8 @@ Object.keys(templates).forEach(function(template) {

// Attach all partials to select templates.
Object.keys(partials).forEach(function(partial) {
templates.class.registerPartial(partial, combyne(partials[partial]));
templates.class_content.registerPartial(partial, combyne(partials[partial]));
templates.struct_content.registerPartial(partial, combyne(partials[partial]));
});


Expand Down Expand Up @@ -88,7 +94,13 @@ fse.remove(path.resolve(__dirname, "../src")).then(function() {

// Write out all the classes.
enabled.forEach(function(idef) {
file.write("../src/" + idef.name + ".cc", templates.class.render(idef));
file.write("../include/" + idef.name + ".h", templates.header.render(idef));
if (idef.hasConstructor) {
file.write("../src/" + idef.name + ".cc", templates.struct_content.render(idef));
file.write("../include/" + idef.name + ".h", templates.struct_header.render(idef));
}
else {
file.write("../src/" + idef.name + ".cc", templates.class_content.render(idef));
file.write("../include/" + idef.name + ".h", templates.class_header.render(idef));
}
});
});
5 changes: 4 additions & 1 deletion generate/partials/async_function.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

{%partial doc .%}
NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
NanScope();
{%partial guardArguments .%}

if (args.Length() == {{args|jsArgsCount}} || !args[{{args|jsArgsCount}}]->IsFunction()) {
return NanThrowError("Callback is required and must be a Function.");
}

{{ cppFunctionName }}Baton* baton = new {{ cppFunctionName }}Baton;

baton->error_code = GIT_OK;
baton->error = NULL;

{%each args|argsInfo as arg %}
{%if not arg.isReturn %}
{%if arg.isSelf %}
Expand Down Expand Up @@ -72,6 +74,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}Worker::Execute() {

void {{ cppClassName }}::{{ cppFunctionName }}Worker::HandleOKCallback() {
TryCatch try_catch;

if (baton->error_code == GIT_OK) {
{%if not .|returnsCount %}
Handle<Value> result = NanUndefined();
Expand Down
31 changes: 19 additions & 12 deletions generate/partials/convert_from_v8.cc
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
{%if not isPayload %}
{{ cType }} from_{{ name }};
{%if isOptional %}
if (args[{{ jsArg }}]->Is{{ cppClassName|cppToV8 }}()) {

if (args[{{ jsArg }}]->Is{{ cppClassName|cppToV8 }}()) {
{%endif%}
{%if cppClassName == 'String' %}
String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});

String::Utf8Value {{ name }}(args[{{ jsArg }}]->ToString());
from_{{ name }} = ({{ cType }}) strdup(*{{ name }});
{%elsif cppClassName == 'Array' %}
Array *tmp_{{ name }} = Array::Cast(*args[{{ jsArg }}]);
from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|replace '**' '*' }}));

Array *tmp_{{ name }} = Array::Cast(*args[{{ jsArg }}]);
from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|replace '**' '*' }}));
for (unsigned int i = 0; i < tmp_{{ name }}->Length(); i++) {
{%--
// FIXME: should recursively call convertFromv8.
--%}
from_{{ name }}[i] = ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(tmp_{{ name }}->Get(NanNew<Number>(static_cast<double>(i)))->ToObject())->GetValue();
from_{{ name }}[i] = ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(tmp_{{ name }}->Get(NanNew<Number>(static_cast<double>(i)))->ToObject())->GetValue();
}
{%elsif cppClassName == 'Function' %}
{%elsif cppClassName == 'Buffer' %}
from_{{ name }} = Buffer::Data(args[{{ jsArg }}]->ToObject());

from_{{ name }} = Buffer::Data(args[{{ jsArg }}]->ToObject());
{%elsif cppClassName|isV8Value %}
from_{{ name }} = ({{ cType }}) {{ additionalCast }} {{ cast }} args[{{ jsArg }}]->To{{ cppClassName }}()->Value();

from_{{ name }} = ({{ cType }}) {{ additionalCast }} {{ cast }} args[{{ jsArg }}]->To{{ cppClassName }}()->Value();
{%else%}
from_{{ name }} = ObjectWrap::Unwrap<{{ cppClassName }}>(args[{{ jsArg }}]->ToObject())->GetValue();
from_{{ name }} = ObjectWrap::Unwrap<{{ cppClassName }}>(args[{{ jsArg }}]->ToObject())->GetValue();
{%endif%}

{%if isOptional %}
} else {
from_{{ name }} = 0;
}
}
else {
from_{{ name }} = 0;
}

{%endif%}
{%endif%}
Loading