Mailspring/build/tasks/codesign-task.coffee
Ben Gotow 8599bc0397 feat(logging): Developer bar, verbose logging to logstash, Electron 0.26.0
Summary:
- We now make verbose log files continuously as you use the app
- We ship the logs to LogStash via S3 when an exception occurs
- We log the DatabaseStore, ActionBridge and Analytics packages

- We are now on the latest version of Electron 0.26.0
- We are now on Chrome 42 and io.js 1.4.3
- We should be setup to use ASAR soon.

Update atom.sh to reflect that we're now electron

oniguruma was unnecessary

correctly find log files that haven't been shipped yet

Fix a small issue with nodeIsVisible after upgrade to Chrome 42

Delete old logs, better logging from database store, don't ship empty logs

Test Plan: Run existing tests

Reviewers: evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D1531
2015-05-19 17:02:46 -07:00

61 lines
2.1 KiB
CoffeeScript

path = require 'path'
fs = require 'fs-plus'
# Edgehill introduces the KEYCHAIN_ACCESS environment variable. This is
# injected via Jenkins. It is of the form:
#
# /full/keychain/path/login.keychain:password
#
# The KEYCHAIN_ACCESS variable is saved in a Jenkins Credential and
# injected via the Credentials Binding Plugin.
#
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'codesign', 'Codesign the app', ->
done = @async()
if process.platform is 'darwin' and (process.env.XCODE_KEYCHAIN or process.env.KEYCHAIN_ACCESS)
unlockKeychain (error) ->
if error?
done(error)
else
signApp(done)
else
signApp(done)
unlockKeychain = (callback) ->
cmd = 'security'
{XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN, KEYCHAIN_ACCESS} = process.env
if KEYCHAIN_ACCESS?
[XCODE_KEYCHAIN, XCODE_KEYCHAIN_PASSWORD] = KEYCHAIN_ACCESS.split(":")
args = ['unlock-keychain', '-p', XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN]
spawn {cmd, args}, (error) -> callback(error)
signApp = (callback) ->
switch process.platform
when 'darwin'
cmd = 'codesign'
args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: InboxApp, Inc.', grunt.config.get('atom.shellAppDir')]
spawn {cmd, args}, (error) -> callback(error)
when 'win32'
# TODO: Don't do anything now, because we need a certificate pfx file
# issued from a certificate authority, and we don't have one.
return callback()
spawn {cmd: 'taskkill', args: ['/F', '/IM', 'nylas.exe']}, ->
cmd = process.env.JANKY_SIGNTOOL ? 'signtool'
args = ['sign', path.join(grunt.config.get('atom.shellAppDir'), 'nylas.exe')]
spawn {cmd, args}, (error) ->
return callback(error) if error?
setupExePath = path.resolve(grunt.config.get('atom.buildDir'), 'installer', 'NylasSetup.exe')
if fs.isFileSync(setupExePath)
args = ['sign', setupExePath]
spawn {cmd, args}, (error) -> callback(error)
else
callback()
else
callback()