Mailspring/build/tasks/install-task.coffee
Ben Gotow 8133cc88d6 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

66 lines
2.5 KiB
CoffeeScript

path = require 'path'
_ = require 'underscore'
fs = require 'fs-plus'
runas = null
temp = require 'temp'
module.exports = (grunt) ->
{cp, mkdir, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'install', 'Install the built application', ->
installDir = grunt.config.get('atom.installDir')
shellAppDir = grunt.config.get('atom.shellAppDir')
if process.platform is 'win32'
runas ?= require 'runas'
copyFolder = path.resolve 'script', 'copy-folder.cmd'
if runas('cmd', ['/c', copyFolder, shellAppDir, installDir], admin: true) isnt 0
grunt.log.error("Failed to copy #{shellAppDir} to #{installDir}")
createShortcut = path.resolve 'script', 'create-shortcut.cmd'
runas('cmd', ['/c', createShortcut, path.join(installDir, 'nylas.exe'), 'Nylas'])
else if process.platform is 'darwin'
rm installDir
mkdir path.dirname(installDir)
tempFolder = temp.path()
mkdir tempFolder
cp shellAppDir, tempFolder
fs.renameSync(tempFolder, installDir)
else
binDir = path.join(installDir, 'bin')
shareDir = path.join(installDir, 'share', 'nylas')
iconName = path.join(shareDir,'resources', 'app', 'resources', 'nylas.png')
mkdir binDir
# Note that `atom.sh` can't be renamed `nylas.sh` because `apm`
# is currently hard-coded to call `atom.sh`
cp 'atom.sh', path.join(binDir, 'nylas')
rm shareDir
mkdir path.dirname(shareDir)
cp shellAppDir, shareDir
# Create nylas.desktop if installation not in temporary folder
tmpDir = if process.env.TMPDIR? then process.env.TMPDIR else '/tmp'
if installDir.indexOf(tmpDir) isnt 0
desktopFile = path.join('resources', 'linux', 'nylas.desktop.in')
desktopInstallFile = path.join(installDir, 'share', 'applications', 'nylas.desktop')
{description} = grunt.file.readJSON('package.json')
iconName = path.join(shareDir, 'resources', 'app', 'resources', 'nylas.png')
installDir = path.join(installDir, '.') # To prevent "Exec=/usr/local//share/nylas/nylas"
template = _.template(String(fs.readFileSync(desktopFile)))
filled = template({description, installDir, iconName})
grunt.file.write(desktopInstallFile, filled)
# Create relative symbol link for apm.
process.chdir(binDir)
rm('apm')
fs.symlinkSync(path.join('..', 'share', 'nylas', 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), 'apm')
fs.chmodSync(path.join(shareDir, 'nylas'), "755")
grunt.log.ok("Installed Nylas into #{installDir}")