Skip to content

Commit f2a7944

Browse files
committed
Experimenting with prebuilt release directories.
1 parent 870f766 commit f2a7944

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NodeGit
77
Status](https://travis-ci.org/tbranyen/nodegit.png)](https://travis-ci.org/nodegit/nodegit)
88
<a href="https://ci.appveyor.com/project/TimBranyen/nodegit"><img src="https://ci.appveyor.com/api/projects/status/e5a5q75l9yfhnfv2/branch/master" alt="Build Status: Windows" height="18" /></a>
99

10-
**Stable: 0.1.3**
10+
**Stable: 0.1.4**
1111

1212
Maintained by Tim Branyen [@tbranyen](http://twitter.com/tbranyen), Michael
1313
Robinson [@codeofinterest](http://twitter.com/codeofinterest), and Nick Kallen

install.js

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ var paths = envOverride({
4747
pkg: __dirname + '/package',
4848
libgit2: __dirname + '/vendor/libgit2/',
4949
build: __dirname + '/vendor/libgit2/build/',
50+
release: __dirname + '/build/Release'
5051
});
5152

5253
// Load the package.json.
@@ -67,20 +68,12 @@ var dependencies = Q.allSettled([
6768
.then(function(results) {
6869
console.info('[nodegit] Determining dependencies.');
6970

71+
//throw new Error("can't build");
72+
7073
// Assign to reusable variables.
7174
python = results[0].value || results[1].value;
7275
cmake = results[2].value;
7376

74-
// Missing Python.
75-
if (!python) {
76-
throw new Error('Python is required to build libgit2.');
77-
}
78-
79-
// Missing CMake.
80-
if (!cmake) {
81-
//throw new Error('CMake is required to build libgit2.');
82-
}
83-
8477
// Now lets check the Python version to ensure it's < 3.
8578
return Q.nfcall(exec, python + ' --version').then(function(version) {
8679
if (version[1].indexOf('Python 3') === 0) {
@@ -190,4 +183,35 @@ var dependencies = Q.allSettled([
190183
console.info('[nodegit] Failed to build nodegit.');
191184
console.info(message.message);
192185
console.info(message.stack);
193-
});
186+
187+
// Attempt the prebuilt fallback.
188+
console.info('[nodegit] Removing vendor/libgit2.');
189+
190+
return Q.ninvoke(rimraf, null, paths.release).then(function() {
191+
console.info('[nodegit] Creating build/Release.');
192+
193+
// Attempt to fetch prebuilt binary.
194+
return Q.ninvoke(fs, 'mkdir', paths.release).then(function() {
195+
console.info('[nodegit] Attempting to fetch a prebuilt binary.');
196+
197+
var version = [
198+
process.platform, process.arch, require("./package.json").version
199+
].join('_');
200+
201+
var url = 'https://s3.amazonaws.com/nodegit/' + version;
202+
203+
var extract = tar.Extract({
204+
path: paths.release,
205+
strip: true
206+
});
207+
208+
var expand = request.get(url).pipe(zlib.createUnzip()).pipe(extract);
209+
210+
return Q.ninvoke(expand, 'on', 'end');
211+
})
212+
213+
.then(function() {
214+
console.info('[nodegit] Completed installation successfully.');
215+
});
216+
});
217+
})

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "nodegit",
33
"description": "Node.js libgit2 asynchronous native bindings",
4-
"version": "0.1.3",
4+
"version": "0.1.4",
55
"libgit2": "e953c1606d0d7aea680c9b19db0b955b34ae63c2",
66
"homepage": "https://github.com/tbranyen/nodegit",
77
"keywords": [

0 commit comments

Comments
 (0)