electron-installer-codesign
Advanced tools
Comparing version 0.1.1 to 0.2.0
67
index.js
@@ -52,3 +52,41 @@ /* eslint no-console:0 */ | ||
function codesign(pattern, opts, fn) { | ||
function _signAll(files, opts, fn) { | ||
async.parallel(files.map(function(src) { | ||
return function(cb) { | ||
debug('signing %s...', path.basename(src)); | ||
runCodesign(src, opts, cb); | ||
}; | ||
}), function(_err, _files) { | ||
if (_err) { | ||
return fn(_err); | ||
} | ||
debug('%d files signed successfully!', _files.length); | ||
fn(null, _files); | ||
}); | ||
} | ||
function _filterFiles(files, fn) { | ||
async.parallel(files.map(function(file) { | ||
return function(cb) { | ||
fs.lstat(file, function(err, stat) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (!stat.isFile() || stat.isSymbolicLink()) { | ||
return cb(null, null); | ||
} | ||
cb(null, file); | ||
}); | ||
}; | ||
}), function(_err, _files) { | ||
if (_err) { | ||
return fn(_err); | ||
} | ||
fn(null, _files.filter(function(f) { | ||
return f !== null; | ||
})); | ||
}); | ||
} | ||
function _collectFiles(pattern, opts, fn) { | ||
glob.glob(pattern, function(err, files) { | ||
@@ -63,17 +101,20 @@ if (err) { | ||
} | ||
async.parallel(files.map(function(src) { | ||
return function(cb) { | ||
debug('signing %s...', path.basename(src)); | ||
runCodesign(src, opts, cb); | ||
}; | ||
}), function(_err, _files) { | ||
if (_err) { | ||
return fn(_err); | ||
} | ||
debug('%d files signed successfully!', _files.length); | ||
fn(null, _files); | ||
}); | ||
fn(null, files); | ||
}); | ||
} | ||
function codesign(pattern, opts, fn) { | ||
async.waterfall([ | ||
function(cb) { | ||
_collectFiles(pattern, opts, cb); | ||
}, | ||
function(files, cb) { | ||
_filterFiles(files, cb); | ||
}, | ||
function(files, cb) { | ||
_signAll(files, opts, cb); | ||
} | ||
], fn); | ||
} | ||
function verify(src, fn) { | ||
@@ -80,0 +121,0 @@ debug('verifying signature on `%s`...', src); |
{ | ||
"name": "electron-installer-codesign", | ||
"description": "Sign your electron apps on OSX.", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"author": "Lucas Hrabovsky <lucas@mongodb.com> (http://imlucas.com)", | ||
@@ -38,2 +38,3 @@ "homepage": "http://github.com/mongodb-js/electron-installer-codesign", | ||
"mongodb-js-fmt": "0.0.3", | ||
"mongodb-js-precommit": "^0.2.8", | ||
"pre-commit": "^1.1.2" | ||
@@ -40,0 +41,0 @@ }, |
@@ -45,3 +45,3 @@ # electron-installer-codesign [![travis][travis_img]][travis_url] [![npm][npm_img]][npm_url] | ||
``` | ||
#### createDMG(opts, callback) | ||
#### codesign(opts, callback) | ||
@@ -48,0 +48,0 @@ ##### opts |
19900
204
5