mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-15 03:04:37 +03:00
Write LICENSE to the appDir during build task
This commit is contained in:
parent
324ae3fe3a
commit
878831bfc7
@ -74,7 +74,7 @@ module.exports = (grunt) ->
|
||||
unless /.+\.plist/.test(sourcePath)
|
||||
grunt.file.copy(sourcePath, path.resolve(appDir, '..', subDirectory, filename))
|
||||
|
||||
dependencies = ['compile']
|
||||
dependencies = ['compile', "generate-license:save"]
|
||||
dependencies.push('copy-info-plist') if process.platform is 'darwin'
|
||||
dependencies.push('set-exe-icon') if process.platform is 'win32'
|
||||
grunt.task.run(dependencies...)
|
||||
|
@ -1,6 +1,8 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.registerTask 'generate-license', 'Generate the license, including the licenses of all dependencies', ->
|
||||
grunt.registerTask 'generate-license', 'Generate the license, including the licenses of all dependencies', (mode) ->
|
||||
legalEagle = require 'legal-eagle'
|
||||
done = @async()
|
||||
|
||||
@ -8,19 +10,30 @@ module.exports = (grunt) ->
|
||||
path: process.cwd()
|
||||
overrides: require './license-overrides'
|
||||
|
||||
legalEagle options, (err, summary) ->
|
||||
legalEagle options, (err, dependencyLicenses) ->
|
||||
if err?
|
||||
console.error(err)
|
||||
exit 1
|
||||
console.log getSummaryText(summary)
|
||||
|
||||
licenseText = getLicenseText(dependencyLicenses)
|
||||
if mode is 'save'
|
||||
targetPath = path.join(grunt.config.get('atom.appDir'), 'LICENSE')
|
||||
fs.writeFileSync(targetPath, licenseText)
|
||||
else
|
||||
console.log licenseText
|
||||
done()
|
||||
|
||||
getSummaryText = (summary) ->
|
||||
getLicenseText = (dependencyLicenses) ->
|
||||
{keys} = require 'underscore-plus'
|
||||
text = ""
|
||||
names = keys(summary).sort()
|
||||
text = """
|
||||
Copyright 2014 GitHub, Inc.
|
||||
|
||||
This application bundles the following third-party packages in accordance
|
||||
with the following licenses:\n\n
|
||||
"""
|
||||
names = keys(dependencyLicenses).sort()
|
||||
for name in names
|
||||
{license, source, sourceText} = summary[name]
|
||||
{license, source, sourceText} = dependencyLicenses[name]
|
||||
|
||||
text += "-------------------------------------------------------------------------\n\n"
|
||||
text += "Package: #{name}\n"
|
||||
|
Loading…
Reference in New Issue
Block a user