mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 18:32:20 +08:00
e8f002ac5d
Summary: Getting rid of things that I'm pretty sure we don't need. Lmk if you see anything to the otherwise. Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1799
48 lines
1.5 KiB
CoffeeScript
48 lines
1.5 KiB
CoffeeScript
fs = require 'fs'
|
|
path = require 'path'
|
|
_ = require 'underscore'
|
|
|
|
module.exports = (grunt) ->
|
|
{spawn, rm, mkdir} = require('./task-helpers')(grunt)
|
|
|
|
fillTemplate = (filePath, data) ->
|
|
template = _.template(String(fs.readFileSync("#{filePath}.in")))
|
|
filled = template(data)
|
|
|
|
outputPath = path.join(grunt.config.get('atom.buildDir'), path.basename(filePath))
|
|
grunt.file.write(outputPath, filled)
|
|
outputPath
|
|
|
|
grunt.registerTask 'mkrpm', 'Create rpm package', ->
|
|
done = @async()
|
|
|
|
if process.arch is 'ia32'
|
|
arch = 'i386'
|
|
else if process.arch is 'x64'
|
|
arch = 'amd64'
|
|
else
|
|
return done("Unsupported arch #{process.arch}")
|
|
|
|
{name, version, description} = grunt.file.readJSON('package.json')
|
|
buildDir = grunt.config.get('atom.buildDir')
|
|
|
|
rpmDir = path.join(buildDir, 'rpm')
|
|
rm rpmDir
|
|
mkdir rpmDir
|
|
|
|
installDir = grunt.config.get('atom.installDir')
|
|
shareDir = path.join(installDir, 'share', 'nylas')
|
|
iconName = path.join(shareDir, 'resources', 'app', 'resources', 'nylas.png')
|
|
|
|
data = {name, version, description, installDir, iconName}
|
|
specFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'redhat', 'nylas.spec'), data)
|
|
desktopFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'nylas.desktop'), data)
|
|
|
|
cmd = path.join('script', 'mkrpm')
|
|
args = [specFilePath, desktopFilePath, buildDir]
|
|
spawn {cmd, args}, (error) ->
|
|
if error?
|
|
done(error)
|
|
else
|
|
grunt.log.ok "Created rpm package in #{rpmDir}"
|
|
done()
|