mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Add check-licenses task and break license-overrides into their own file
This commit is contained in:
25
build/tasks/check-licenses-task.coffee
Normal file
25
build/tasks/check-licenses-task.coffee
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
|
||||
legalEagle = require 'legal-eagle'
|
||||
{size, keys} = require 'underscore-plus'
|
||||
done = @async()
|
||||
|
||||
options =
|
||||
path: process.cwd()
|
||||
omitPermissive: true
|
||||
overrides: require './license-overrides'
|
||||
|
||||
legalEagle options, (err, summary) ->
|
||||
if err?
|
||||
console.error(err)
|
||||
exit 1
|
||||
|
||||
if size(summary)
|
||||
console.error "Found dependencies without permissive licenses:"
|
||||
for name in keys(summary).sort()
|
||||
console.error "#{name}"
|
||||
console.error " License: #{summary[name].license}"
|
||||
console.error " Repository: #{summary[name].repository}"
|
||||
exit 1
|
||||
done()
|
||||
@@ -1,37 +1,4 @@
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.registerTask 'report-licenses', 'Report the licenses of all dependencies', ->
|
||||
legalEagle = require 'legal-eagle'
|
||||
done = @async()
|
||||
|
||||
options =
|
||||
path: process.cwd()
|
||||
overrides: ManualOverrides
|
||||
|
||||
legalEagle options, (err, summary) ->
|
||||
if err?
|
||||
console.error(err)
|
||||
exit 1
|
||||
console.log getSummaryText(summary)
|
||||
done()
|
||||
|
||||
getSummaryText = (summary) ->
|
||||
{keys} = require 'underscore-plus'
|
||||
text = ""
|
||||
names = keys(summary).sort()
|
||||
for name in names
|
||||
{license, source, sourceText} = summary[name]
|
||||
text += "## #{name}\n\n"
|
||||
text += "* License: #{license}\n"
|
||||
text += "* License Source: #{source}\n" if source?
|
||||
if sourceText?
|
||||
text += "* Source Text:\n"
|
||||
for line in sourceText.split('\n')
|
||||
text += "> #{line}\n"
|
||||
text += '\n'
|
||||
text
|
||||
|
||||
ManualOverrides =
|
||||
module.exports =
|
||||
'underscore@1.4.4':
|
||||
repository: 'https://github.com/documentcloud/underscore'
|
||||
license: 'MIT'
|
||||
32
build/tasks/report-licenses-task.coffee
Normal file
32
build/tasks/report-licenses-task.coffee
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
module.exports = (grunt) ->
|
||||
grunt.registerTask 'report-licenses', 'Report the licenses of all dependencies', ->
|
||||
legalEagle = require 'legal-eagle'
|
||||
done = @async()
|
||||
|
||||
options =
|
||||
path: process.cwd()
|
||||
overrides: require './license-overrides'
|
||||
|
||||
legalEagle options, (err, summary) ->
|
||||
if err?
|
||||
console.error(err)
|
||||
exit 1
|
||||
console.log getSummaryText(summary)
|
||||
done()
|
||||
|
||||
getSummaryText = (summary) ->
|
||||
{keys} = require 'underscore-plus'
|
||||
text = ""
|
||||
names = keys(summary).sort()
|
||||
for name in names
|
||||
{license, source, sourceText} = summary[name]
|
||||
text += "## #{name}\n\n"
|
||||
text += "* License: #{license}\n"
|
||||
text += "* License Source: #{source}\n" if source?
|
||||
if sourceText?
|
||||
text += "* Source Text:\n"
|
||||
for line in sourceText.split('\n')
|
||||
text += "> #{line}\n"
|
||||
text += '\n'
|
||||
text
|
||||
Reference in New Issue
Block a user