diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 7836f069a9..78b9f3e333 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -35,6 +35,6 @@ module Homebrew ohai "git add" safe_system "git", "add", SPDX::JSON_PATH ohai "git commit" - system "git", "commit", "--message", "data/spdx.json: update to #{latest_tag}" + system "git", "commit", "--message", "data/spdx.json: update to #{SPDX.latest_tag}" end end diff --git a/Library/Homebrew/utils/spdx.rb b/Library/Homebrew/utils/spdx.rb index 4ee6b59eb4..ffa2de8054 100644 --- a/Library/Homebrew/utils/spdx.rb +++ b/Library/Homebrew/utils/spdx.rb @@ -12,8 +12,11 @@ module SPDX @spdx_data ||= JSON.parse(JSON_PATH.read) end + def latest_tag + @latest_tag ||= GitHub.open_api(API_URL)["tag_name"] + end + def download_latest_license_data!(to: JSON_PATH) - latest_tag = GitHub.open_api(API_URL)["tag_name"] data_url = "https://raw.githubusercontent.com/spdx/license-list-data/#{latest_tag}/json/licenses.json" curl_download(data_url, to: to, partial: false) end