From 605c1355a8e535a3254899a5671cb676cad67e87 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 19 Nov 2018 11:39:13 -0500 Subject: [PATCH] Add updates to UI license grabber from jlmitch5. --- awx/ui/utils/get_licenses.js | 23 ++++++++-------- awx/ui/utils/license_texts.js | 7 +++++ docs/licenses/ui/angular-gettext.txt | 2 +- docs/licenses/ui/complex.js.txt | 4 +-- docs/licenses/ui/d3.txt | 2 +- docs/licenses/ui/decimal.js.txt | 23 +++------------- docs/licenses/ui/hamsterjs.txt | 2 +- docs/licenses/ui/javascript-natural-sort.txt | 2 +- docs/licenses/ui/lodash.txt | 29 ++++++++++++++++++-- docs/licenses/ui/timezone-js.txt | 7 ++++- docs/licenses/ui/titlecase.txt | 21 +++----------- 11 files changed, 66 insertions(+), 56 deletions(-) diff --git a/awx/ui/utils/get_licenses.js b/awx/ui/utils/get_licenses.js index 39a2b949b4..17ceb79b8c 100755 --- a/awx/ui/utils/get_licenses.js +++ b/awx/ui/utils/get_licenses.js @@ -6,7 +6,7 @@ const { join } = require('path'); const licenseTexts = require('./license_texts'); // path to shrinkwrap file -const SHRINKWRAP_PATH = `${__dirname}/../npm-shrinkwrap.json`; +const SHRINKWRAP_PATH = `${__dirname}/../package-lock.json`; // folder that npm install node_modules to const NODE_MODULES_FOLDER = `${__dirname}/../node_modules`; // the folder which we will put the ui license files @@ -16,7 +16,7 @@ const OMITTED_NODE_MODULES_FOLDERS = ['@uirouter', '.bin', 'cycle']; // all the ways in which deps with license files have license files named const LICENSE_FILE_NAMES = ['LICENSE', 'LICENCE', 'LICENSE.md', 'LICENSE.txt', 'MIT-LICENSE.txt', 'LICENSE-MIT.txt', 'LICENSE-MIT', 'LICENSE.MIT', 'LICENSE.APACHE2', 'LICENSE.BSD']; // all the ways in which deps with license info included in readme have the license header -const LICENSE_HEADER_NAMES = ['LICENSE', 'License', 'Licence']; +const LICENSE_HEADER_NAMES = ['## License']; // all the ways in which deps with license info included in readme have readme files named const README_FILE_NAMES = ['README', 'README.md', 'README.markdown']; // deps that we need to manually grab the license info (and that info) @@ -89,7 +89,7 @@ const licenseTextIncludedInReadme = (readmeText, returnLicenseText) => LICENSE_H } else if (a !== false) { licenseVal = a; } else if (readmeText.includes(b)) { - licenseVal = readmeText.split(b).slice(-1); + licenseVal = readmeText.split(b).slice(1, readmeText.split(b).length); } else { licenseVal = false; } @@ -175,7 +175,8 @@ const licenseCheck = () => { if (noLicensePackage.length === 0) { console.log('Success! All modules probably have a license associated.'); } else { - console.log(`Warning! The following modules do not have license info associated with them: ${noLicensePackage.join(', ')}.`); + console.log(`ERROR! The following modules do not have license info associated with them: ${noLicensePackage.join(', ')}.`); + process.exit(1); } }; @@ -195,7 +196,7 @@ const licenseWrite = () => { modulesWithLicenseFile.forEach(path => { writeFileSync( - join(UI_LICENSE_FOLDER, getModulename(path)), + join(UI_LICENSE_FOLDER, `${getModulename(path)}.txt`), readFileSync(hasLicenseFile(path, true)).toString() ); }); @@ -207,14 +208,14 @@ const licenseWrite = () => { modulesWithPackageJSONLicenseAttr.forEach(path => { const licenseType = hasLicenseAttrInNPM(path, true); - let licenseText = LICENSE_TEXTS[licenseType]; + const licenseText = LICENSE_TEXTS[licenseType]; if (!licenseText) { - console.log(`WARNING! License text for ${licenseType} is not in license_texts.js. Please add it. Just adding the license type to the module's file for now.`); - licenseText = licenseType; + console.log(`ERROR! License text for ${licenseType} is not in license_texts.js.`); + process.exit(1); } - writeFileSync(join(UI_LICENSE_FOLDER, getModulename(path)), licenseText); + writeFileSync(join(UI_LICENSE_FOLDER, `${getModulename(path)}.txt`), licenseText); }); const modulesWithLicenseInfoInReadme = getSubdirectories(NODE_MODULES_FOLDER) @@ -225,13 +226,13 @@ const licenseWrite = () => { console.log(`${modulesWithLicenseInfoInReadme.length} modules with license text in readme.`); modulesWithLicenseInfoInReadme.forEach(path => { - writeFileSync(join(UI_LICENSE_FOLDER, getModulename(path)), hasLicenseInReadme(path, true)); + writeFileSync(join(UI_LICENSE_FOLDER, `${getModulename(path)}.txt`), hasLicenseInReadme(path, true)); }); console.log(`${MANUAL_NODE_MODULES_LICENSE_INFO.length} modules with license info manually added to this script.`); MANUAL_NODE_MODULES_LICENSE_INFO.forEach(mod => { - writeFileSync(join(UI_LICENSE_FOLDER, mod.module_name), mod.license_info); + writeFileSync(join(UI_LICENSE_FOLDER, `${getModulename(mod.module_name)}.txt`), mod.license_info); }); }; diff --git a/awx/ui/utils/license_texts.js b/awx/ui/utils/license_texts.js index af4f422a68..0c0f2ee1f1 100644 --- a/awx/ui/utils/license_texts.js +++ b/awx/ui/utils/license_texts.js @@ -130,6 +130,13 @@ express Statement of Purpose. party to this document and has no duty or obligation with respect to this CC0 or use of the Work. `, + 'MIT OR GPL-2.0': ` +MIT +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`, ISC: ` ISC Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. diff --git a/docs/licenses/ui/angular-gettext.txt b/docs/licenses/ui/angular-gettext.txt index c8a5229104..431758043e 100644 --- a/docs/licenses/ui/angular-gettext.txt +++ b/docs/licenses/ui/angular-gettext.txt @@ -1,4 +1,4 @@ -Copyright (C) 2013-2018 by Ruben Vermeersch +Copyright (C) 2013-2017 by Ruben Vermeersch Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/docs/licenses/ui/complex.js.txt b/docs/licenses/ui/complex.js.txt index d60b28e60a..6b5c324a32 100644 --- a/docs/licenses/ui/complex.js.txt +++ b/docs/licenses/ui/complex.js.txt @@ -1,7 +1,7 @@ -Copyright (c) 2015, [Robert Eisele](http://www.xarg.org/) +MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/docs/licenses/ui/d3.txt b/docs/licenses/ui/d3.txt index 0bc47f33ef..ff3f2e5419 100644 --- a/docs/licenses/ui/d3.txt +++ b/docs/licenses/ui/d3.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013, Michael Bostock +Copyright (c) 2010-2016, Michael Bostock All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/docs/licenses/ui/decimal.js.txt b/docs/licenses/ui/decimal.js.txt index 9f558dcb59..86e03102ef 100644 --- a/docs/licenses/ui/decimal.js.txt +++ b/docs/licenses/ui/decimal.js.txt @@ -1,22 +1,7 @@ -The MIT Licence. -Copyright (c) 2016, 2017 Michael Mclaughlin +MIT +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/docs/licenses/ui/hamsterjs.txt b/docs/licenses/ui/hamsterjs.txt index 03ab987840..86e03102ef 100644 --- a/docs/licenses/ui/hamsterjs.txt +++ b/docs/licenses/ui/hamsterjs.txt @@ -1,5 +1,5 @@ -Copyright Scott Boyle +MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/docs/licenses/ui/javascript-natural-sort.txt b/docs/licenses/ui/javascript-natural-sort.txt index 2217a66346..86e03102ef 100644 --- a/docs/licenses/ui/javascript-natural-sort.txt +++ b/docs/licenses/ui/javascript-natural-sort.txt @@ -1,5 +1,5 @@ -Copyright Jim Palmer (based on chunking idea from Dave Koelle, packaged by @khous of Bill4Time)" +MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. diff --git a/docs/licenses/ui/lodash.txt b/docs/licenses/ui/lodash.txt index 9cd87e5dce..c6f2f6145e 100644 --- a/docs/licenses/ui/lodash.txt +++ b/docs/licenses/ui/lodash.txt @@ -1,7 +1,17 @@ -Copyright 2012-2015 The Dojo Foundation -Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +Copyright JS Foundation and other contributors + +Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/lodash/lodash + +The following license applies to all parts of this software except as +documented below: + +==== + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including @@ -20,3 +30,18 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code displayed within the prose of the +documentation. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +Files located in the node_modules and vendor directories are externally +maintained libraries used by this software which have their own +licenses; we recommend you read them, as their terms may differ from the +terms above. diff --git a/docs/licenses/ui/timezone-js.txt b/docs/licenses/ui/timezone-js.txt index c6bdf7c833..769f4fc059 100644 --- a/docs/licenses/ui/timezone-js.txt +++ b/docs/licenses/ui/timezone-js.txt @@ -1,4 +1,9 @@ --2.0 + + + +Copyright 2010 Matthew Eernisse (mde@fleegix.org) and Open Source Applications Foundation. + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/docs/licenses/ui/titlecase.txt b/docs/licenses/ui/titlecase.txt index 430d423d85..d93b89d8f8 100644 --- a/docs/licenses/ui/titlecase.txt +++ b/docs/licenses/ui/titlecase.txt @@ -1,19 +1,6 @@ -Copyright © 2008–2013 David Gouch. Licensed under the MIT License. +MIT +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.