2017-05-29 21:32:44 +00:00
|
|
|
# Copyright:: Copyright (c) 2017 Chef Software, Inc.
|
|
|
|
# License:: Apache License, Version 2.0
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2017-06-15 16:10:47 +00:00
|
|
|
UTILS_DIR = File.expand_path(File.join(__dir__, '..', 'lib/utils')).freeze
|
2017-05-29 21:32:44 +00:00
|
|
|
|
|
|
|
desc 'Updates the list of the spdx valid licenses'
|
|
|
|
task :spdx do
|
|
|
|
# Kudos to Foodcritic for providing that idea
|
|
|
|
# @see https://github.com/Foodcritic/foodcritic/pull/530/files
|
|
|
|
# list of valid SPDX.org license strings. To build an array run this:
|
|
|
|
require 'json'
|
|
|
|
require 'net/http'
|
|
|
|
json_data = JSON.parse(Net::HTTP.get(URI('https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json')))
|
|
|
|
licenses = json_data['licenses'].map { |l| l['licenseId'] }
|
2017-06-28 11:14:19 +00:00
|
|
|
# "All Rights Reserved" is non-standard extra value to cover proprietary license
|
2017-05-29 21:32:44 +00:00
|
|
|
licenses.push('All Rights Reserved')
|
2018-12-20 19:41:11 +00:00
|
|
|
licenses.sort!
|
2017-05-29 21:32:44 +00:00
|
|
|
File.write(File.join(UTILS_DIR, 'spdx.txt'), licenses.join("\n"))
|
|
|
|
end
|