brew/Library/Homebrew/dev-cmd/update-license-data.rb

35 lines
761 B
Ruby
Raw Normal View History

2020-11-25 17:03:23 +01:00
# typed: true
# frozen_string_literal: true
require "cli/parser"
2020-08-04 10:07:57 -07:00
require "utils/spdx"
require "system_command"
module Homebrew
2024-01-31 20:00:54 -08:00
extend SystemCommand::Mixin
2020-10-20 12:03:48 +02:00
sig { returns(CLI::Parser) }
2024-01-31 20:00:54 -08:00
def self.update_license_data_args
2020-06-25 05:46:18 +08:00
Homebrew::CLI::Parser.new do
description <<~EOS
Update SPDX license data in the Homebrew repository.
2020-06-25 05:10:29 +08:00
EOS
2021-01-10 14:26:40 -05:00
named_args :none
end
2020-06-25 05:46:18 +08:00
end
2024-01-31 20:00:54 -08:00
def self.update_license_data
update_license_data_args.parse
2020-08-04 10:07:57 -07:00
SPDX.download_latest_license_data!
diff = system_command "git", args: [
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", SPDX::DATA_PATH
]
if diff.status.success?
ofail "No changes to SPDX license data."
else
puts "SPDX license data updated."
end
end
2020-06-25 05:46:18 +08:00
end