Skip to content

Commit 1bc48bc

Browse files
committed
Merge pull request #2 from benjohnde/master
Latest upstream changes.
2 parents ed25f84 + 54946b1 commit 1bc48bc

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 2.1.1 April 16, 2015
2+
3+
Update package.json with async dependency (tomasdev)
4+
5+
Emit error if it failed to sign the zip with manifest file (tomasdev)
6+
7+
8+
## 2.1.0 March 2, 2015
9+
10+
Add support for Node.js 0.12 and io.js 1.4
11+
12+
Fix failing image tests on Node.js 0.12 and io.js 1.4
13+
14+
Fix failing signature check on Node.js 0.12 and io.js 1.4
15+
16+
Remove unused async dependency
17+
18+
119
## 2.0.1 November 14, 2012
220

321
Fix addImage not working with buffers.

lib/images.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ function applyImageMethods(constructor) {
2020
// pass.icon(function(callback) { ... };
2121
// console.log(pass.icon());
2222
//
23-
// The 2x suffix is used for high resolution version (file name uses @2x
24-
// suffix).
23+
// The 2x and 3x suffix is used for high resolution version (file name uses
24+
// @2x or @3x suffix).
2525
//
2626
// pass.icon2x("[email protected]");
2727
// console.log(pass.icon2x());
28+
//
29+
// pass.icon3x("[email protected]");
30+
// console.log(pass.icon3x());
2831
IMAGES.forEach(function(key) {
2932
prototype[key] = function(value) {
3033
if (arguments.length === 0) {

lib/pass.js

+21-16
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var HTTPS = require("https");
1212
var Path = require("path");
1313
var Zip = require("./zip");
1414
var async = require("async");
15+
var zlib = require("zlib");
1516

1617

1718
// Top-level pass fields.
@@ -268,15 +269,20 @@ Pass.prototype.pipe = function(output) {
268269
zip.close();
269270
self.emit("error", lastError);
270271
} else {
271-
self.signZip(zip, manifest, function(error) {
272-
zip.close();
273-
zip.on("end", function() {
274-
self.emit("end");
275-
});
276-
zip.on("error", function(error) {
277-
self.emit("error", error);
278-
});
279-
}, self.mockSignature, self.mockModifiedDate);
272+
process.nextTick(function() {
273+
self.signZip(zip, manifest, function(error) {
274+
if (error) {
275+
return self.emit("error", error);
276+
}
277+
zip.close();
278+
zip.on("end", function() {
279+
self.emit("end");
280+
});
281+
zip.on("error", function(error) {
282+
self.emit("error", error);
283+
});
284+
}, self.mockSignature, self.mockModifiedDate);
285+
});
280286
}
281287
}
282288
};
@@ -305,8 +311,12 @@ function writeFile(file, source, callback) {
305311
var protocol = /^https:/i.test(source) ? HTTPS : HTTP;
306312
protocol.get(source, function(response) {
307313
if (response.statusCode == 200) {
308-
response.on("end", callback);
309-
response.pipe(file);
314+
file.on("close", callback);
315+
if (response.headers['content-encoding'] === "gzip") {
316+
response.pipe(zlib.createGunzip()).pipe(file);
317+
} else {
318+
response.pipe(file);
319+
}
310320
response.resume();
311321
} else
312322
callback(new Error("Server returned " + response.statusCode + " for " + source));
@@ -441,11 +451,6 @@ function SHAWriteStream(manifest, filename, output) {
441451
this.sha = Crypto.createHash("sha1");
442452
output.on("close", this.emit.bind(this, "close"));
443453
output.on("error", this.emit.bind(this, "error"));
444-
var self = this;
445-
this.on("pipe", function(source) {
446-
source.on("data", self.write.bind(self));
447-
source.resume();
448-
});
449454
}
450455

451456
inherits(SHAWriteStream, Stream);

lib/template.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var TEMPLATE = [ "passTypeIdentifier", "teamIdentifier",
1616
// Create a new template.
1717
//
1818
// style - Pass style (coupon, eventTicket, etc)
19-
// fields - Pass fields (passTypeIdentifier, teamIdentifier, etc)
19+
// fields - Pass fields (passTypeIdentifier, teamIdentifier, etc)
2020
function Template(style, fields) {
2121
if (!~STYLES.indexOf(style))
2222
throw new Error("Unsupported pass style " + style);

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ "name": "passbook",
22
"description": "iOS Passbook for the Node hacker",
33
"homepage": "https://github.com/assaf/node-passbook",
4-
"version": "2.0.2",
4+
"version": "2.1.1",
55
"author": {
66
"name": "Assaf Arkin",
77
"email": "[email protected]"
@@ -11,11 +11,11 @@
1111
"node-passbook": "./bin/node-passbook"
1212
},
1313
"dependencies": {
14-
"async": "0.2.9",
15-
"cli": "0.4.5"
14+
"async": "^0.9.0",
15+
"cli": "0.6.5"
1616
},
1717
"devDependencies": {
18-
"mocha": "1.12.0"
18+
"mocha": "2.1.0"
1919
},
2020
"scripts": {
2121
"test": "mocha"
@@ -28,7 +28,7 @@
2828
],
2929
"repository": {
3030
"type": "git",
31-
"url": "git://github.com/assaf/node-passbook"
31+
"url": "git://github.com/assaf/node-passbook.git"
3232
},
3333
"bugs": {
3434
"url": "http://github.com/assaf/node-passbook/issues"

0 commit comments

Comments
 (0)