| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,3 @@ | |||
| 4 | 4 | [submodule "vendor/rimraf"] | |
| 5 | 5 | path = vendor/rimraf | |
| 6 | 6 | url = git://github.com/isaacs/rimraf.git | |
| 7 | - [submodule "vendor/libgit2"] | ||
| 8 | - path = vendor/libgit2 | ||
| 9 | - url = git://github.com/libgit2/libgit2.git | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,57 @@ | |||
| 1 | + /* | ||
| 2 | + Copyright (c) 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com> | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | + #include <v8.h> | ||
| 6 | + #include <node.h> | ||
| 7 | + #include <node_events.h> | ||
| 8 | + | ||
| 9 | + #include <git2.h> | ||
| 10 | + | ||
| 11 | + #include "repo.h" | ||
| 12 | + #include "blob.h" | ||
| 13 | + | ||
| 14 | + using namespace v8; | ||
| 15 | + using namespace node; | ||
| 16 | + | ||
| 17 | + void Blob::Initialize (Handle<v8::Object> target) { | ||
| 18 | + HandleScope scope; | ||
| 19 | + | ||
| 20 | + Local<FunctionTemplate> t = FunctionTemplate::New(New); | ||
| 21 | + | ||
| 22 | + constructor_template = Persistent<FunctionTemplate>::New(t); | ||
| 23 | + constructor_template->InstanceTemplate()->SetInternalFieldCount(1); | ||
| 24 | + constructor_template->SetClassName(String::NewSymbol("Blob")); | ||
| 25 | + | ||
| 26 | + target->Set(String::NewSymbol("Blob"), constructor_template->GetFunction()); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + git_blob* Blob::GetValue() { | ||
| 30 | + return this->blob; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + void Blob::SetValue(git_blob* blob) { | ||
| 34 | + this->blob = blob; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + int Blob::New(git_repository* repo) { | ||
| 38 | + return git_blob_new(&this->blob, repo); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + Handle<Value> Blob::New(const Arguments& args) { | ||
| 42 | + HandleScope scope; | ||
| 43 | + | ||
| 44 | + Blob *blob = new Blob(); | ||
| 45 | + | ||
| 46 | + if(args.Length() == 0 || !args[0]->IsObject()) { | ||
| 47 | + return ThrowException(Exception::Error(String::New("Repo is required and must be an Object."))); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + Repo *repo = ObjectWrapper::Unwrap<Repo>(args[0]); | ||
| 51 | + int err = blob->New(repo); | ||
| 52 | + | ||
| 53 | + blob->Wrap(args.This()); | ||
| 54 | + | ||
| 55 | + return args.This(); | ||
| 56 | + } | ||
| 57 | + Persistent<FunctionTemplate> Blob::constructor_template; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,38 @@ | |||
| 1 | + /* | ||
| 2 | + Copyright (c) 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com> | ||
| 3 | + */ | ||
| 4 | + | ||
| 5 | + #ifndef BLOB_H | ||
| 6 | + #define BLOB_H | ||
| 7 | + | ||
| 8 | + #include <v8.h> | ||
| 9 | + #include <node.h> | ||
| 10 | + #include <node_events.h> | ||
| 11 | + | ||
| 12 | + #include <git2.h> | ||
| 13 | + | ||
| 14 | + #include "repo.h" | ||
| 15 | + | ||
| 16 | + using namespace v8; | ||
| 17 | + using namespace node; | ||
| 18 | + | ||
| 19 | + class Blob : public EventEmitter { | ||
| 20 | + public: | ||
| 21 | + static Persistent<FunctionTemplate> constructor_template; | ||
| 22 | + static void Initialize(Handle<v8::Object> target); | ||
| 23 | + // Synchronous | ||
| 24 | + int New(git_blob **blob, git_repository *repo) | ||
| 25 | + git_blob* GetValue(); | ||
| 26 | + void SetValue(git_blob* blob); | ||
| 27 | + | ||
| 28 | + protected: | ||
| 29 | + Blob() {}; | ||
| 30 | + ~Blob() {}; | ||
| 31 | + | ||
| 32 | + static Handle<Value> New(const Arguments& args); | ||
| 33 | + | ||
| 34 | + private: | ||
| 35 | + git_blob *blob; | ||
| 36 | + }; | ||
| 37 | + | ||
| 38 | + #endif | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,10 @@ git_commit* Commit::GetValue() { | |||
| 34 | 34 | return this->commit; | |
| 35 | 35 | } | |
| 36 | 36 | ||
| 37 | + void Commit::SetValue(git_commit* commit) { | ||
| 38 | + this->commit = commit; | ||
| 39 | + } | ||
| 40 | + | ||
| 37 | 41 | int Commit::Lookup(Repo *repo, Oid *oid) { | |
| 38 | 42 | return git_commit_lookup(&this->commit, repo->GetValue(), oid->GetValue()); | |
| 39 | 43 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ class Commit : public EventEmitter { | |||
| 26 | 26 | int Lookup(Repo *repo, Oid *oid); | |
| 27 | 27 | // Synchronous | |
| 28 | 28 | git_commit* GetValue(); | |
| 29 | + void SetValue(git_commit* commit); | ||
| 29 | 30 | ||
| 30 | 31 | protected: | |
| 31 | 32 | Commit() {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,10 +2,17 @@ import Options, Utils | |||
| 2 | 2 | from os import system | |
| 3 | 3 | from os.path import exists, abspath | |
| 4 | 4 | ||
| 5 | + VERSION = '0.0.1' | ||
| 6 | + APPNAME = 'nodegit2' | ||
| 7 | + srcdir = '.' | ||
| 8 | + blddir = 'build' | ||
| 9 | + | ||
| 5 | 10 | def set_options(opt): | |
| 11 | + opt.tool_options('gcc') | ||
| 6 | 12 | opt.tool_options('compiler_cxx') | |
| 7 | 13 | ||
| 8 | 14 | def configure(conf): | |
| 15 | + conf.check_tool('gcc') | ||
| 9 | 16 | conf.check_tool('compiler_cxx') | |
| 10 | 17 | conf.check_tool('node_addon') | |
| 11 | 18 | ||
@@ -19,9 +26,11 @@ def configure(conf): | |||
| 19 | 26 | #Popen('python waf configure build-static', shell=True).wait() | |
| 20 | 27 | ||
| 21 | 28 | def build(bld): | |
| 22 | - system('cd vendor/libgit2/; python waf configure build-static') | ||
| 29 | + #libgit2 = bld.new_task_gen('wafadmin') | ||
| 30 | + #libgit2.features = 'waf configure build-static' | ||
| 31 | + #libgit2.target = 'libgit2' | ||
| 23 | 32 | ||
| 24 | 33 | obj = bld.new_task_gen('cxx', 'shlib', 'node_addon') | |
| 25 | 34 | obj.target = 'nodegit2' | |
| 26 | 35 | obj.source = 'src/base.cc src/error.cc src/reference.cc src/repo.cc src/commit.cc src/oid.cc src/revwalk.cc' | |
| 27 | - obj.uselib = 'GIT2' | ||
| 36 | + #obj.uselib_local = 'libgit2' | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments