روابط العقدة لمشروع libgit2.
مستقر ([email protected]): 0.28.3
تفضل بزيارة slack.libgit2.org للتسجيل ، ثم انضم إلينا في #Nodegit.
Tyler Ang-Wanektwwanek بمساعدة من الكثير من المساهمين الرائعين!
Tim Branyen @Tbranyen ، John Haley @Johnhaley81 ، Max KorpMaxkorp ، Steve Smith OrderedList ، Michael robinsoncodeofinterest ، و Nick Kallennk
http://www.nodegit.org/
ستعمل Nodegit على معظم الأنظمة خارج الصندوق دون أي تبعيات أصلية.
npm install nodegitإذا تلقيت أخطاء حول libstdc ++ ، والتي يتم تجربتها عادة عند البناء على Travis-CI ، يمكنك إصلاح ذلك عن طريق الترقية إلى أحدث libstdc ++-4.9.
في أوبونتو:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install libstdc++-4.9-devفي ترافيس:
addons :
apt :
sources :
- ubuntu-toolchain-r-test
packages :
- libstdc++-4.9-devفي Circleci:
dependencies :
pre :
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update
- sudo apt-get install -y libstdc++-4.9-devإذا تلقيت أخطاء حول Lifecycles Preinstall/تثبيت ، فربما تفوت libssl-dev في Ubuntu:
sudo apt-get install libssl-dev
ستحتاج إلى المكتبات التالية المثبتة على جهاز Linux الخاص بك:
عند البناء محليًا ، ستحتاج أيضًا إلى حزم تطوير لـ Kerberos و PCRE ، لذلك يجب أن يكون كل من هذه الأدوات المساعدة موجودة على جهازك:
إذا كنت لا تزال تواجه مشاكل أثناء التثبيت ، فيجب عليك تجربة المبنى من تعليمات المصدر.
var Git = require ( "nodegit" ) ;
// Clone a given repository into the `./tmp` folder.
Git . Clone ( "https://github.com/nodegit/nodegit" , "./tmp" )
// Look up this known commit.
. then ( function ( repo ) {
// Use a known commit sha from this repository.
return repo . getCommit ( "59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5" ) ;
} )
// Look up a specific file within that commit.
. then ( function ( commit ) {
return commit . getEntry ( "README.md" ) ;
} )
// Get the blob contents from the file.
. then ( function ( entry ) {
// Patch the blob to contain a reference to the entry.
return entry . getBlob ( ) . then ( function ( blob ) {
blob . entry = entry ;
return blob ;
} ) ;
} )
// Display information about the blob.
. then ( function ( blob ) {
// Show the path, sha, and filesize in bytes.
console . log ( blob . entry . path ( ) + blob . entry . sha ( ) + blob . rawsize ( ) + "b" ) ;
// Show a spacer.
console . log ( Array ( 72 ) . join ( "=" ) + "nn" ) ;
// Show the entire file.
console . log ( String ( blob ) ) ;
} )
. catch ( function ( err ) { console . log ( err ) ; } ) ; var Git = require ( "nodegit" ) ;
// Open the repository directory.
Git . Repository . open ( "tmp" )
// Open the master branch.
. then ( function ( repo ) {
return repo . getMasterCommit ( ) ;
} )
// Display information about commits on master.
. then ( function ( firstCommitOnMaster ) {
// Create a new history event emitter.
var history = firstCommitOnMaster . history ( ) ;
// Create a counter to only show up to 9 entries.
var count = 0 ;
// Listen for commit events from the history.
history . on ( "commit" , function ( commit ) {
// Disregard commits past 9.
if ( ++ count >= 9 ) {
return ;
}
// Show the commit sha.
console . log ( "commit " + commit . sha ( ) ) ;
// Store the author object.
var author = commit . author ( ) ;
// Display author information.
console . log ( "Author:t" + author . name ( ) + " <" + author . email ( ) + ">" ) ;
// Show the commit date.
console . log ( "Date:t" + commit . date ( ) ) ;
// Give some space and show the message.
console . log ( "n " + commit . message ( ) ) ;
} ) ;
// Start emitting events.
history . start ( ) ;
} ) ; لمزيد من الأمثلة ، تحقق examples/ المجلد.
ستحتاج إلى البناء محليًا قبل إجراء الاختبارات. انظر أعلاه.
npm test