mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-09 09:38:07 +08:00
fix(grunt): replace shareDir with linuxShareDir to reflect global changes
The `install` task would fail since `linuxShareDir` was undefined for the template `.desktop` file.
This commit is contained in:
parent
3cd42303ae
commit
8182f2ef89
1 changed files with 13 additions and 12 deletions
|
@ -8,6 +8,7 @@ module.exports = (grunt) ->
|
||||||
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
||||||
|
|
||||||
grunt.registerTask 'install', 'Install the built application', ->
|
grunt.registerTask 'install', 'Install the built application', ->
|
||||||
|
appFileName = grunt.config.get('nylasGruntConfig.appFileName')
|
||||||
installDir = grunt.config.get('nylasGruntConfig.installDir')
|
installDir = grunt.config.get('nylasGruntConfig.installDir')
|
||||||
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
|
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
|
||||||
|
|
||||||
|
@ -31,17 +32,17 @@ module.exports = (grunt) ->
|
||||||
fs.renameSync(tempFolder, installDir)
|
fs.renameSync(tempFolder, installDir)
|
||||||
|
|
||||||
else
|
else
|
||||||
binDir = path.join(installDir, 'bin')
|
linuxBinDir = path.join(installDir, 'bin')
|
||||||
shareDir = path.join(installDir, 'share', 'nylas')
|
linuxShareDir = path.join(installDir, 'share', 'nylas')
|
||||||
iconName = path.join(shareDir, 'resources', 'app', 'nylas.png')
|
iconName = path.join(linuxShareDir, 'resources', 'app', 'nylas.png')
|
||||||
|
|
||||||
mkdir binDir
|
mkdir linuxBinDir
|
||||||
# Note that `N1.sh` can't be renamed `nylas.sh` because `apm`
|
# Note that `N1.sh` can't be renamed `nylas.sh` because `apm`
|
||||||
# is currently hard-coded to call `N1.sh`
|
# is currently hard-coded to call `N1.sh`
|
||||||
cp 'N1.sh', path.join(binDir, 'nylas')
|
cp 'N1.sh', path.join(linuxBinDir, 'nylas')
|
||||||
rm shareDir
|
rm linuxShareDir
|
||||||
mkdir path.dirname(shareDir)
|
mkdir path.dirname(linuxShareDir)
|
||||||
cp shellAppDir, shareDir
|
cp shellAppDir, linuxShareDir
|
||||||
|
|
||||||
# Create nylas.desktop if installation not in temporary folder
|
# Create nylas.desktop if installation not in temporary folder
|
||||||
tmpDir = if process.env.TMPDIR? then process.env.TMPDIR else '/tmp'
|
tmpDir = if process.env.TMPDIR? then process.env.TMPDIR else '/tmp'
|
||||||
|
@ -50,13 +51,13 @@ module.exports = (grunt) ->
|
||||||
desktopInstallFile = path.join(installDir, 'share', 'applications', 'nylas.desktop')
|
desktopInstallFile = path.join(installDir, 'share', 'applications', 'nylas.desktop')
|
||||||
|
|
||||||
{description} = grunt.file.readJSON('package.json')
|
{description} = grunt.file.readJSON('package.json')
|
||||||
iconName = path.join(shareDir, 'resources', 'app', 'nylas.png')
|
iconName = path.join(linuxShareDir, 'resources', 'app', 'nylas.png')
|
||||||
installDir = path.join(installDir, '.') # To prevent "Exec=/usr/local//share/nylas/nylas"
|
installDir = path.join(installDir, '.') # To prevent "Exec=/usr/local//share/nylas/nylas"
|
||||||
template = _.template(String(fs.readFileSync(desktopFile)))
|
template = _.template(fs.readFileSync(desktopFile, 'utf8'))
|
||||||
filled = template({description, installDir, iconName})
|
filled = template({appFileName, description, installDir, iconName, linuxShareDir})
|
||||||
|
|
||||||
grunt.file.write(desktopInstallFile, filled)
|
grunt.file.write(desktopInstallFile, filled)
|
||||||
|
|
||||||
fs.chmodSync(path.join(shareDir, 'nylas'), "755")
|
fs.chmodSync(path.join(linuxShareDir, 'nylas'), "755")
|
||||||
|
|
||||||
grunt.log.ok("Installed Nylas into #{installDir}")
|
grunt.log.ok("Installed Nylas into #{installDir}")
|
||||||
|
|
Loading…
Reference in a new issue