11<!doctype html>
22< html lang ="en ">
3- < head >
4- < meta charset ="utf-8 ">
5- < meta http-equiv ="X-UA-Compatible " content ="IE=edge,chrome=1 ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge,chrome=1 ">
66
7- < title > NodeGit: Native Node bindings to Git.</ title >
8- < link rel ="stylesheet " href ="http://yui.yahooapis.com/pure/0.4.2/pure-min .css ">
9- < link type ="text/css " rel ="stylesheet " href ="styles/common .css ">
10- < link type =" text/ css" rel =" stylesheet " href =" styles/ir_black. css" >
11- </ head >
7+ < title > NodeGit: Native Node bindings to Git.</ title >
8+ < link type =" text/css " rel ="stylesheet " href ="styles/common .css ">
9+ < link type ="text/css " rel ="stylesheet " href ="styles/ir_black .css ">
10+ < link href =' http://fonts.googleapis.com/ css?family=Open+Sans:400,300,600,700 ' rel =' stylesheet ' type =' text/ css' >
11+ </ head >
1212
13- < body >
14-
15- < header >
16- < h1 class ="brand "> NodeGit</ h1 >
17-
18- <!--
19- <nav>
20- <div class="pure-menu pure-menu-open pure-menu-horizontal">
13+ < body >
14+ < div id ="wrapper ">
15+ < header >
16+ < div class ="brand "> NodeGit</ div >
17+ < nav >
2118 < ul >
22- <li><a href="#">Home</a></li>
23- <li class="pure-menu-selected"><a href="#">Flickr</a></li>
24- <li><a href="#">Messenger</a></li>
25- <li><a href="#">Sports</a></li>
26- <li><a href="#">Finance</a></li>
19+ < li > < a href ="# "> CLASSES</ a > </ li >
20+ < li > < a href ="# "> EVENTS</ a > </ li >
21+ < li > < a href ="# "> NAMESPACES</ a > </ li >
22+ < li > < a href ="# "> GLOBAL</ a > </ li >
2723 </ ul >
28- </div>
29- </nav>
30- -->
31- <!--
32- <nav><a href="#">Test</a> </nav>
33- <nav><a href="#">Test</a> </nav>
34- -->
35- </ header >
24+ </ nav >
25+ </ header >
26+
27+ < section class ="block ">
28+ <!-- Branding -->
29+ < section class ="branding ">
30+ < a class ="download " href ="http://github.com/tbranyen/nodegit/zipball/master ">
31+ < img src ="http://github.com/images/modules/download/zip.png ">
32+ </ a >
33+ < a class ="download " href ="http://github.com/tbranyen/nodegit/tarball/master ">
34+ < img src ="http://github.com/images/modules/download/tar.png ">
35+ </ a >
36+ < div class ="headline ">
37+ < a href ="http://github.com/tbranyen/nodegit "> nodegit</ a >
38+ < a class ="travis " href ="https://travis-ci.org/tbranyen/nodegit "> < img src ="https://travis-ci.org/tbranyen/nodegit.png " alt ="Build Status " style ="max-width:100%; "> </ a >
39+ </ div >
40+ < span class ="small "> by < a href ="http://github.com/tbranyen "> tbranyen</ a > & < a href ="http://github.com/faceleg "> faceleg</ a > </ span >
41+ </ section >
42+
43+ < div class ="social ">
44+ < iframe src ="http://ghbtns.com/github-btn.html?count=true&user=tbranyen&repo=nodegit&type=watch " allowtransparency ="true " frameborder ="0 " scrolling ="0 " width ="100 " height ="20 "> </ iframe >
45+ < iframe id ="twitter-widget-0 " scrolling ="no " frameborder ="0 " allowtransparency ="true " src ="http://platform.twitter.com/widgets/tweet_button.1400006231.html#_=1400268411265&count=horizontal&hashtags=nodejs&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.nodegit.org%2F&size=m&text=When%20I%20need%20git%20tools%20in%20Node.js%2C%20I%20use%20nodegit&url=http%3A%2F%2Fnodegit.github.com%2F " class ="twitter-share-button twitter-tweet-button twitter-share-button twitter-count-horizontal " title ="Twitter Tweet Button " data-twttr-rendered ="true " style ="width: 107px; height: 20px; "> </ iframe >
46+ </ div >
47+
48+ < p > Version < strong > 0.0.79</ strong > Node.js libgit2 asynchronous native bindings</ p >
49+ < p > A collection of non-blocking Node.js libgit2 bindings, raw api, convenience api, unit tests, documentation and accomodations to make contributing easier.</ p >
50+ < h4 > require</ h4 >
51+ < ul > < li > < a href ="http://nodejs.org/ "> Node.js >=0.8</ a > </ li > < li > < a href ="http://npmjs.org/ "> npm</ a > < em > (if you want the premiere install experience)</ em > </ li > < li > < a href ="http://git-scm.com/ "> Git</ a > < em > (if you want to unit test )</ em > </ li > </ ul >
52+ < h4 > install</ h4 >
53+ < pre > < code class ="" data-result ="[object Object] "> npm install nodegit</ code > </ pre >
54+ < h4 > use</ h4 >
55+ < p > < em > emulate git log</ em > </ p >
56+ < pre >
57+ < code class ="javascript " data-result ="[object Object] "> < span class ="comment "> // Load in the module.</ span >
58+ < span class ="keyword "> var</ span > git = require(< span class ="string "> 'nodegit'</ span > ),
59+ async = require(< span class ="string "> 'async'</ span > );
60+
61+ < span class ="comment "> // Open the repository in the current directory.</ span >
62+ git.repo(< span class ="string "> '.git'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, repository)</ span > {</ span >
63+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
64+
65+ < span class ="comment "> // Use the master branch (a branch is the HEAD commit)</ span >
66+ repository.branch(< span class ="string "> 'master'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, branch)</ span > {</ span >
67+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
68+
69+ < span class ="comment "> // History returns an event, and begins walking the history</ span >
70+ < span class ="keyword "> var</ span > history = branch.history();
71+
72+ < span class ="comment "> // History emits 'commit' event for each commit in the branch's history</ span >
73+ history.on(< span class ="string "> 'commit'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, commit)</ span > {</ span >
74+ < span class ="comment "> // Print out `git log` emulation.</ span >
75+ async.series([
76+ < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (callback)</ span > {</ span >
77+ commit.sha(callback);
78+ },
79+ < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (callback)</ span > {</ span >
80+ commit.date(callback);
81+ },
82+ < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (callback)</ span > {</ span >
83+ commit.author(< span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, author)</ span > {</ span >
84+ author.name(callback);
85+ });
86+ },
87+ < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (callback)</ span > {</ span >
88+ commit.author(< span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, author)</ span > {</ span >
89+ author.email(callback);
90+ });
91+ },
92+ < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (callback)</ span > {</ span >
93+ commit.message(callback);
94+ }
95+ ], < span class ="function "> < span class ="keyword "> function</ span > < span class ="title "> printCommit</ span > < span class ="params "> (error, results)</ span > {</ span >
96+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
97+ console.log(< span class ="string "> 'SHA '</ span > + results[< span class ="number "> 0</ span > ]);
98+ console.log(results[< span class ="number "> 1</ span > ] * < span class ="number "> 1000</ span > );
99+ console.log(results[< span class ="number "> 2</ span > ] + < span class ="string "> ' <'</ span > + results[< span class ="number "> 3</ span > ] + < span class ="string "> '>'</ span > );
100+ console.log(results[< span class ="number "> 4</ span > ]);
101+ });
102+ });
103+ });
104+ });
105+ </ code >
106+ </ pre >
107+
108+ < p > < em > view commit tree and blob information</ em > </ p >
109+
110+ < pre >
111+ < code class ="javascript " data-result ="[object Object] "> < span class ="comment "> // Load in the module.</ span >
112+ < span class ="keyword "> var</ span > git = require(< span class ="string "> 'nodegit'</ span > );
113+
114+ < span class ="comment "> // Open the repository in the current directory.</ span >
115+ git.repo(< span class ="string "> '.git'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, repository)</ span > {</ span >
116+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
117+
118+ < span class ="comment "> // Use the master branch.</ span >
119+ repository.branch(< span class ="string "> 'master'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, branch)</ span > {</ span >
120+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
121+
122+ < span class ="comment "> // Iterate over the revision history.</ span >
123+ branch.tree(< span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, tree)</ span > {</ span >
124+ < span class ="keyword "> if</ span > (error) < span class ="keyword "> throw</ span > error;
125+ tree.walk().on(< span class ="string "> 'entry'</ span > , < span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, entry)</ span > {</ span >
126+ entry.name(< span class ="function "> < span class ="keyword "> function</ span > < span class ="params "> (error, name)</ span > {</ span >
127+ console.log(name);
128+ });
129+ });
130+ });
131+ });
132+ });
133+ </ code >
134+ </ pre >
135+
136+ < h4 > download</ h4 >
137+ < p > You can download this project in either < a href ="http://github.com/tbranyen/nodegit/zipball/master "> zip</ a > or < a href ="http://github.com/tbranyen/nodegit/tarball/master "> tar</ a > formats.</ p >
138+ < p > You can also clone and build the project with < a href ="http://git-scm.com "> Git</ a > by running:</ p >
139+ < pre > < code class ="" data-result ="[object Object] "> $ git clone git://github.com/tbranyen/nodegit $ cd nodegit $ node install</ code > </ pre >
140+ </ section >
141+ < footer > NodeGit development is sponsored by < a href ="http://bocoup.com/ "> Bocoup</ a > </ footer >
142+ </ div >
143+
144+ </ body >
36145
37146 < script src ="scripts/highlight.pack.js "> </ script >
38147 < script >
@@ -48,5 +157,4 @@ <h1 class="brand">NodeGit</h1>
48157 ga ( 'create' , 'UA-21174385-2' , 'github.com' ) ;
49158 ga ( 'send' , 'pageview' ) ;
50159 </ script >
51- </ body >
52160</ html >
0 commit comments