bunch of style fixes
This commit is contained in:
parent
2970abdc73
commit
fbd5c32d22
@ -8,37 +8,37 @@ require "json"
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
SPDX_FOLDER_PATH = (HOMEBREW_LIBRARY_PATH/"data").freeze
|
||||
FILE_NAME = "spdx.json"
|
||||
SPDX_DATA_URL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
|
||||
SPDX_FOLDER_PATH = (HOMEBREW_LIBRARY_PATH/"data").freeze
|
||||
FILE_NAME = "spdx.json"
|
||||
SPDX_DATA_URL = "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json"
|
||||
|
||||
def update_license_data_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`update_license_data` <cmd>
|
||||
def update_license_data_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
usage_banner <<~EOS
|
||||
`update_license_data` <cmd>
|
||||
|
||||
Update SPDX license data in the Homebrew repository.
|
||||
EOS
|
||||
switch "--fail-if-changed",
|
||||
description: "Return a failing status code if current license data's version is different from the upstream. This "\
|
||||
"can be used to notify CI when the SPDX license data is out of date."
|
||||
switch "--fail-if-changed",
|
||||
description: "Return a failing status code if current license data's version is different from"\
|
||||
"the upstream. This can be used to notify CI when the SPDX license data is out of date."
|
||||
|
||||
max_named 0
|
||||
end
|
||||
end
|
||||
|
||||
def update_license_data
|
||||
update_license_data_args.parse
|
||||
puts "Fetching newest version of SPDX License data..."
|
||||
open(SPDX_DATA_URL) do |json|
|
||||
File.open(SPDX_FOLDER_PATH/FILE_NAME, "wb") do |file|
|
||||
file.write(json.read)
|
||||
end
|
||||
end
|
||||
|
||||
if args.fail_if_changed?
|
||||
Homebrew.failed = true
|
||||
system("git diff --stat --exit-code #{FILE_NAME}")
|
||||
end
|
||||
max_named 0
|
||||
end
|
||||
end
|
||||
|
||||
def update_license_data
|
||||
update_license_data_args.parse
|
||||
puts "Fetching newest version of SPDX License data..."
|
||||
File.open(SPDX_DATA_URL) do |json|
|
||||
File.open(SPDX_FOLDER_PATH/FILE_NAME, "wb") do |file|
|
||||
file.write(json.read)
|
||||
end
|
||||
end
|
||||
|
||||
return unless args.fail_if_changed?
|
||||
|
||||
Homebrew.failed = true
|
||||
system("git diff --stat --exit-code #{FILE_NAME}")
|
||||
end
|
||||
end
|
||||
|
||||
@ -166,7 +166,7 @@ module Homebrew
|
||||
RUBY
|
||||
|
||||
fa.audit_license
|
||||
expect(fa.problems).to be_empty
|
||||
expect(fa.problems).to be_empty
|
||||
end
|
||||
|
||||
it "checks online and detects that a formula-specified license is not "\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user