Mailspring/build/tasks/set-version-task.coffee
Ben Gotow c294eb5df4 fix(sqlite): Connect to sqlite directly rather than sending queries over IPC (twice...)
Summary:
- We now build sqlite3 manually from source in script/bootstrap
- We now allow queries to run in parallel outside of transaction blocks

- When signining in and out, the main window creates the database file and then advances the database "phase", which allows all the windows to connect to the initialized database.

This diff also fixes T2411 where popout drafts opened twice, and several issues around Windows icons and install.

Test Plan: Run existing tests

Reviewers: evan

Reviewed By: evan

Maniphest Tasks: T2411

Differential Revision: https://phab.nylas.com/D1815
2015-07-30 18:09:20 -07:00

58 lines
1.9 KiB
CoffeeScript

fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
getVersion = (callback) ->
onBuildMachine = process.env.JANKY_SHA1 and process.env.JANKY_BRANCH is 'master'
inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git'))
{version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
if onBuildMachine or not inRepository
callback(null, version)
else
cmd = 'git'
args = ['rev-parse', '--short', 'HEAD']
spawn {cmd, args}, (error, {stdout}={}, code) ->
commitHash = stdout?.trim?()
combinedVersion = "#{version}-#{commitHash}"
callback(error, combinedVersion)
grunt.registerTask 'set-version', 'Set the version in the plist and package.json', ->
done = @async()
getVersion (error, version) ->
if error?
done(error)
return
appDir = grunt.config.get('atom.appDir')
# Replace version field of package.json.
packageJsonPath = path.join(appDir, 'package.json')
packageJson = require(packageJsonPath)
packageJson.version = version
packageJsonString = JSON.stringify(packageJson)
fs.writeFileSync(packageJsonPath, packageJsonString)
if process.platform is 'darwin'
cmd = 'script/set-version'
args = [grunt.config.get('atom.buildDir'), version]
spawn {cmd, args}, (error, result, code) -> done(error)
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellExePath = path.join(shellAppDir, 'nylas.exe')
strings =
CompanyName: 'Nylas, Inc.'
FileDescription: 'Nylas'
LegalCopyright: 'Copyright (C) 2014-2015 Nylas, Inc. All rights reserved'
ProductName: 'Nylas'
ProductVersion: version
rcedit = require('rcedit')
rcedit(shellExePath, {'version-string': strings}, done)
else
done()