Merge pull request #31 from jenslind/master

Added --sign to mac
This commit is contained in:
Max Ogden 2015-05-18 16:42:06 -07:00
commit ada31862a7
2 changed files with 22 additions and 5 deletions

26
mac.js
View File

@ -108,24 +108,30 @@ function buildMacApp (opts, cb, newApp) {
if (opts.asar) {
asarApp(function (err) {
if (err) return cb(err)
updateMacIcon()
updateMacIcon(function (err) {
if (err) return cb(err)
codesign()
})
})
} else {
updateMacIcon()
updateMacIcon(function (err) {
if (err) return cb(err)
codesign()
})
}
})
})
}
function updateMacIcon () {
function updateMacIcon (cb) {
var finalPath = path.join(opts.out || process.cwd(), opts.name + '.app')
if (!opts.icon) {
return cb(null, finalPath)
return cb(null)
}
ncp(opts.icon, path.join(finalPath, 'Contents', 'Resources', 'atom.icns'), function copied (err) {
cb(err, finalPath)
cb(err)
})
}
@ -138,5 +144,15 @@ function buildMacApp (opts, cb, newApp) {
rimraf(src, cb)
})
}
function codesign () {
var appPath = path.join(opts.out || process.cwd(), opts.name + '.app')
if (!opts.sign) return cb(null, appPath)
child.exec('codesign --deep --force --sign ' + opts.sign + ' ' + appPath, function (err, stdout, stderr) {
cb(err, appPath)
})
}
})
}

View File

@ -41,6 +41,7 @@ helper-bundle-id bundle identifier to use in the app helper plist
ignore do not copy files into App whose filenames regex .match this string
prune runs `npm prune --production` on the app
asar packages the source code within your app into an archive
sign should contain the identity to be used when running `codesign` (OS X only)
```
This will: