Skip to content

Commit 58b71fc

Browse files
committed
Merge pull request nodegit#140 from nodegit/new-installer
WIP New installer.
2 parents 4d7d4ff + 334d3e4 commit 58b71fc

Some content is hidden

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

72 files changed

+2904
-2904
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/build/*
22
!/build/codegen/
3+
/node_modules/
4+
/vendor/libgit2/
35
/doc/*
46
!/doc/Theme.css
5-
/node_modules
67
/test/.reposCache

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013 Tim Branyen
1+
Copyright (c) 2014 Tim Branyen
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

appveyor.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# appveyor file
2+
# http://www.appveyor.com/docs/appveyor-yml
3+
project_id: "e5a5q75l9yfhnfv2"
4+
5+
# build version format
6+
version: "{build}"
7+
8+
# fix lineendings in Windows
9+
init:
10+
- git config --global core.autocrlf input
11+
12+
# what combinations to test
13+
environment:
14+
matrix:
15+
- nodejs_version: 0.10
16+
- nodejs_version: 0.8
17+
18+
# Get the latest stable version of Node 0.STABLE.latest
19+
install:
20+
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
21+
- npm install
22+
23+
build: off

binding.gyp

Lines changed: 71 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,80 @@
11
{
2-
'targets': [
3-
{
4-
'target_name': 'nodegit',
5-
'sources': [
6-
'src/base.cc',
7-
'src/blob.cc',
8-
'src/commit.cc',
9-
'src/oid.cc',
10-
'src/reference.cc',
11-
'src/object.cc',
12-
'src/repo.cc',
13-
'src/index.cc',
14-
'src/index_entry.cc',
15-
'src/index_time.cc',
16-
'src/tag.cc',
17-
'src/revwalk.cc',
18-
'src/signature.cc',
19-
'src/time.cc',
20-
'src/tree.cc',
21-
'src/tree_builder.cc',
22-
'src/tree_entry.cc',
23-
'src/diff_find_options.cc',
24-
'src/diff_options.cc',
25-
'src/diff_list.cc',
26-
'src/patch.cc',
27-
'src/delta.cc',
28-
'src/diff_file.cc',
29-
'src/diff_range.cc',
30-
'src/threads.cc',
31-
'src/wrapper.cc',
32-
'src/refdb.cc',
33-
'src/odb_object.cc',
34-
'src/odb.cc',
35-
'src/submodule.cc',
36-
'src/remote.cc',
37-
'src/clone_options.cc',
38-
'src/functions/copy.cc',
2+
"targets": [
3+
{
4+
"target_name": "nodegit",
395

40-
],
6+
"sources": [
7+
"src/base.cc",
8+
"src/blob.cc",
9+
"src/commit.cc",
10+
"src/oid.cc",
11+
"src/reference.cc",
12+
"src/object.cc",
13+
"src/repo.cc",
14+
"src/index.cc",
15+
"src/index_entry.cc",
16+
"src/index_time.cc",
17+
"src/tag.cc",
18+
"src/revwalk.cc",
19+
"src/signature.cc",
20+
"src/time.cc",
21+
"src/tree.cc",
22+
"src/tree_builder.cc",
23+
"src/tree_entry.cc",
24+
"src/diff_find_options.cc",
25+
"src/diff_options.cc",
26+
"src/diff_list.cc",
27+
"src/patch.cc",
28+
"src/delta.cc",
29+
"src/diff_file.cc",
30+
"src/diff_range.cc",
31+
"src/threads.cc",
32+
"src/wrapper.cc",
33+
"src/refdb.cc",
34+
"src/odb_object.cc",
35+
"src/odb.cc",
36+
"src/submodule.cc",
37+
"src/remote.cc",
38+
"src/clone_options.cc",
39+
"src/functions/copy.cc",
40+
],
4141

42-
'include_dirs': [
43-
'vendor/libv8-convert',
44-
'vendor/libgit2/include',
45-
"<!(node -e \"require('nan')\")"
46-
],
42+
"include_dirs": [
43+
"vendor/libv8-convert",
44+
"vendor/libgit2/include",
45+
"<!(node -e \"require('nan')\")"
46+
],
4747

48-
'libraries': [
49-
'-L<!(pwd)/vendor/libgit2/build',
50-
'-lgit2'
51-
],
48+
"cflags": [
49+
"-Wall"
50+
],
5251

53-
'cflags': [
54-
'-Wall'
55-
],
52+
"ldflags": [
53+
"-Wl,-rpath,\$$ORIGIN/../../vendor/libgit2/build"
54+
],
5655

57-
'ldflags': [
58-
'-Wl,-rpath,\$$ORIGIN/../../vendor/libgit2/build'
56+
"conditions": [
57+
[
58+
"OS=='win'", {
59+
"libraries": [
60+
"-l../vendor/libgit2/build/Debug/git2.lib"
5961
],
60-
61-
'conditions': [
62-
['OS=="mac"', {
63-
'xcode_settings': {
64-
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
65-
}
66-
}]
62+
}, { # 'OS!="win"'
63+
"libraries": [
64+
"-L<!(pwd)/vendor/libgit2/build",
65+
"-lgit2"
6766
]
68-
}
69-
]
67+
}
68+
],
69+
70+
[
71+
"OS=='mac'", {
72+
"xcode_settings": {
73+
"GCC_ENABLE_CPP_EXCEPTIONS": "YES"
74+
}
75+
}
76+
]
77+
]
78+
}
79+
]
7080
}

build/codegen/templates/convertFromV8.cc.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<% } else if (arg.cppClassName == 'Buffer') { -%>
2121
from_<%- arg.name %> = Buffer::Data(args[<%- jsArg %>]->ToObject());
2222
<% } else if (isV8Value(arg.cppClassName)) { -%>
23-
from_<%- arg.name %> = (<%- arg.cType %>) args[<%- jsArg %>]->To<%- arg.cppClassName %>()->Value();
23+
from_<%- arg.name %> = (<%- arg.cType %>) <%- arg.additionalCast %> <%- arg.cast %> args[<%- jsArg %>]->To<%- arg.cppClassName %>()->Value();
2424
<% } else { -%>
2525
from_<%- arg.name %> = ObjectWrap::Unwrap<<%- arg.cppClassName %>>(args[<%- jsArg %>]->ToObject())->GetValue();
2626
<% } -%>
@@ -29,4 +29,4 @@
2929
from_<%- arg.name %> = 0;
3030
}
3131
<% } -%>
32-
<% } -%>
32+
<% } -%>

build/codegen/v0.18.0.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10380,7 +10380,8 @@
1038010380
"cType": "git_direction",
1038110381
"cppClassName": "Number",
1038210382
"jsClassName": "Number",
10383-
"comment": "GIT_DIRECTION_FETCH if you want to fetch or GIT_DIRECTION_PUSH if you want to push"
10383+
"comment": "GIT_DIRECTION_FETCH if you want to fetch or GIT_DIRECTION_PUSH if you want to push",
10384+
"additionalCast": "(int)"
1038410385
}
1038510386
],
1038610387
"isAsync": true,
@@ -17283,7 +17284,8 @@
1728317284
"cType": "git_filemode_t",
1728417285
"cppClassName": "Number",
1728517286
"jsClassName": "Number",
17286-
"comment": "Folder attributes of the entry. This parameter must be valued with one of the following entries: 0040000, 0100644, 0100755, 0120000 or 0160000."
17287+
"comment": "Folder attributes of the entry. This parameter must be valued with one of the following entries: 0040000, 0100644, 0100755, 0120000 or 0160000.",
17288+
"additionalCast": "(int)"
1728717289
}
1728817290
],
1728917291
"isAsync": false,
Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,66 @@
11
#!/usr/bin/env node
2+
// vim: ft=javascript
23

3-
// Copyright 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
4+
// Copyright 2011-2014, Tim Branyen @tbranyen <tim@tabdeveloper.com>
45
// Dual licensed under the MIT and GPL licenses.
5-
// Script to detect cursewords in commit messages and provide the
6-
// offending commit sha's.
7-
// vim: ft=javascript
6+
// Script to detect cursewords in commit messages and provide the offending
7+
// commit sha's.
8+
//
9+
// Usage:
10+
//
11+
// node git_profanity_check some/repo/.git
12+
//
813
var git = require('../../');
914

10-
var curses = ['add', 'swears', 'here'],
11-
path = '../../.git',
12-
branchName = 'master',
13-
reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');
14-
15+
var curses = ['put', 'curse', 'words', 'here'];
16+
var path = './.git';
17+
var branch = 'master';
18+
var reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');
1519

20+
// Default path is `.git`.
1621
if (process.argv.length < 3) {
17-
console.log('No git path passed as argument, defaulting to ./.git');
18-
} else {
22+
console.log('No path passed as argument, defaulting to .git.');
23+
}
24+
// Otherwise defaults.
25+
else {
1926
path = process.argv[2];
2027

28+
// Set repo branch
2129
if (process.argv.length < 4) {
22-
console.log('No repo branchName passed as argument, defaulting to master');
23-
} else {
24-
branchName = process.argv[3];
30+
console.log('No branch passed as argument, defaulting to master.');
31+
}
32+
else {
33+
branch = process.argv[3];
2534
}
2635
}
2736

28-
git.Repo.open(path, function(error, repo) {
29-
if (error) throw error;
37+
// Open repository.
38+
git.Repo.open(path, function(err, repo) {
39+
if (err) {
40+
throw new Error(err);
41+
}
3042

31-
repo.getBranch(branchName, function(error, branch) {
32-
if (error) throw error;
43+
// Open branch, default to master.
44+
repo.getBranch(branch, function(err, branch) {
45+
if (err) {
46+
throw new Error(err);
47+
}
3348

49+
// Iterate history
3450
var history = branch.history();
51+
52+
// Iterate over every commit message and test for words.
3553
history.on('commit', function(commit) {
36-
if (reCurse.test(commit.message()))
37-
console.log('Curse detected in commit', commit.sha(), 'message', commit.message());
38-
}).start();
54+
var message = commit.message();
55+
56+
if (reCurse.test(message)) {
57+
console.log('Curse detected in commit', commit.sha());
58+
console.log('=> ', message);
59+
return;
60+
}
61+
});
62+
63+
// Start history iteration.
64+
history.start();
3965
});
4066
});

include/blob.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <v8.h>
99
#include <node.h>
1010
#include <string>
11-
#include "nan.h"
1211

1312
#include "git2.h"
1413

@@ -18,7 +17,7 @@ using namespace v8;
1817
class GitBlob : public ObjectWrap {
1918
public:
2019

21-
static Persistent<FunctionTemplate> constructor_template;
20+
static Persistent<Function> constructor_template;
2221
static void Initialize (Handle<v8::Object> target);
2322

2423
git_blob *GetValue();
@@ -29,12 +28,13 @@ class GitBlob : public ObjectWrap {
2928
GitBlob(git_blob *raw);
3029
~GitBlob();
3130

32-
static NAN_METHOD(New);
31+
static Handle<Value> New(const Arguments& args);
3332

34-
static NAN_METHOD(Oid);
35-
static NAN_METHOD(Content);
36-
static NAN_METHOD(Size);
37-
static NAN_METHOD(IsBinary);
33+
34+
static Handle<Value> Oid(const Arguments& args);
35+
static Handle<Value> Content(const Arguments& args);
36+
static Handle<Value> Size(const Arguments& args);
37+
static Handle<Value> IsBinary(const Arguments& args);
3838
git_blob *raw;
3939
};
4040

include/branch.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <node.h>
1010
#include <string>
1111

12-
#include "nan.h"
13-
1412
#include "git2.h"
1513

1614
using namespace node;
@@ -19,7 +17,7 @@ using namespace v8;
1917
class Branch : public ObjectWrap {
2018
public:
2119

22-
static Persistent<FunctionTemplate> constructor_template;
20+
static Persistent<Function> constructor_template;
2321
static void Initialize (Handle<v8::Object> target);
2422

2523
git_branch *GetValue();
@@ -30,19 +28,20 @@ class Branch : public ObjectWrap {
3028
Branch(git_branch *raw);
3129
~Branch();
3230

33-
static NAN_METHOD(New);
34-
35-
static NAN_METHOD(Create);
36-
static NAN_METHOD(Delete);
37-
static NAN_METHOD(Foreach);
38-
static NAN_METHOD(Move);
39-
static NAN_METHOD(Lookup);
40-
static NAN_METHOD(Name);
41-
static NAN_METHOD(Upstream);
42-
static NAN_METHOD(SetUpstream);
43-
static NAN_METHOD(UpstreamName);
44-
static NAN_METHOD(IsHead);
45-
static NAN_METHOD(RemoteName);
31+
static Handle<Value> New(const Arguments& args);
32+
33+
34+
static Handle<Value> Create(const Arguments& args);
35+
static Handle<Value> Delete(const Arguments& args);
36+
static Handle<Value> Foreach(const Arguments& args);
37+
static Handle<Value> Move(const Arguments& args);
38+
static Handle<Value> Lookup(const Arguments& args);
39+
static Handle<Value> Name(const Arguments& args);
40+
static Handle<Value> Upstream(const Arguments& args);
41+
static Handle<Value> SetUpstream(const Arguments& args);
42+
static Handle<Value> UpstreamName(const Arguments& args);
43+
static Handle<Value> IsHead(const Arguments& args);
44+
static Handle<Value> RemoteName(const Arguments& args);
4645
git_branch *raw;
4746
};
4847

0 commit comments

Comments
 (0)