Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Better installation flow for developing.
- Detects if libgit2 is already fetched instead of constantly fetching.
- Provides more meta information about libgit2 inside package.json.
  • Loading branch information
tbranyen committed Jun 20, 2014
commit ec4bb7356289221182e9c6f40a5a3c29fc50cb78
14 changes: 7 additions & 7 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var Q = require('q');
var request = require('request');
var tar = require('tar');
var which = require('which');
var rimraf = require('rimraf');

// This will take in an object and find any matching keys in the environment
// to use as overrides.
Expand Down Expand Up @@ -80,19 +79,20 @@ var dependencies = Q.allSettled([
});
})

// Successfully found all dependencies. First step is to clean the vendor
// Successfully found all dependencies. First step is to detect the vendor
// directory.
.then(function() {
console.info('[nodegit] Removing vendor/libgit2.');
console.info('[nodegit] Detecting vendor/libgit2.');

return Q.ninvoke(rimraf, null, paths.libgit2);
return Q.ninvoke(fs, 'stat', paths.libgit2);
})

// Now fetch the libgit2 source from GitHub.
.then(function() {
// If the directory already exists, no need to refetch.
.fail(function() {
// Otherwise fetch the libgit2 source from GitHub.
console.info('[nodegit] Fetching vendor/libgit2.');

var url = 'https://github.com/libgit2/libgit2/tarball/' + pkg.libgit2;
var url = 'https://github.com/libgit2/libgit2/tarball/' + pkg.libgit2.sha;

var extract = tar.Extract({
path: paths.libgit2,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "nodegit",
"description": "Node.js libgit2 asynchronous native bindings",
"version": "0.1.4",
"libgit2": "a50086d174658914d4d6462afbc83b02825b1f5b",
"libgit2": {
"sha": "a50086d174658914d4d6462afbc83b02825b1f5b",
"libgit2": "a50086d174658914d4d6462afbc83b02825b1f5b"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is used pkg.libgit2.libgit2?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nowhere, must be remnant from something else. Good catch, removed.

},
"homepage": "https://github.com/tbranyen/nodegit",
"keywords": [
"libgit2",
Expand Down Expand Up @@ -63,4 +66,4 @@
"codegen": "node build/codegen/generate.js",
"publish": "node-pre-gyp package && node-pre-gyp publish"
}
}
}