Привязки узла с проектом Libgit2.
Стабильная ([email protected]): 0,28.3
Посетите Slack.libgit2.org, чтобы зарегистрироваться, затем присоединяйтесь к нам в #nodegit.
Тайлер Анг-Ванек @twanek с помощью множества удивительных участников!
Тим Браниен @Tbranyen, Джон Хейли @Johnhaley81, Макс Корп @maxkorp, Стив Смит @orderedlist, Майкл Робинсон @codeofinterest и Ник Каллен @NK
http://www.nodegit.org/
Nodegit будет работать над большинством систем из коробки без каких-либо местных зависимостей.
npm install nodegitЕсли вы получаете ошибки о Libstdc ++, которые обычно испытываются при наращивании на Travis-Ci, вы можете исправить это, обновив до последнего Libstdc ++-4.9.
В Ubuntu:
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Если вы получаете ошибки в отношении жизненных циклов 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