From b07685291b65e51e0afc2b6cee91251419e0b3c1 Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 10 Jun 2020 12:29:25 -0400 Subject: [PATCH 1/2] Add license to formula DSL --- Library/Homebrew/formula.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 2a37b445dc..23017a3995 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -351,6 +351,9 @@ class Formula # @see .desc= delegate desc: :"self.class" + # The SPDX ID of the software license. + delegate license: :"self.class" + # The homepage for the software. # @method homepage # @see .homepage= @@ -1678,6 +1681,7 @@ class Formula "aliases" => aliases.sort, "versioned_formulae" => versioned_formulae.map(&:name), "desc" => desc, + "license" => license, "homepage" => homepage, "versions" => { "stable" => stable&.version&.to_s, @@ -2199,6 +2203,13 @@ class Formula #
desc "Example formula"
attr_rw :desc + # @!attribute [w] + # The SPDX ID of the open-source license that the formula uses. + # Shows when running `brew info`. + # + #
license " BSD-2-Clause"
+ attr_rw :license + # @!attribute [w] homepage # The homepage for the software. Used by users to get more information # about the software and Homebrew maintainers as a point of contact for From 864cc76b3ba56543627139c99775cb818392823b Mon Sep 17 00:00:00 2001 From: William Ma Date: Wed, 10 Jun 2020 12:29:54 -0400 Subject: [PATCH 2/2] Print license information in brew info --- Library/Homebrew/cmd/info.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index e6db9ec358..c41d2cb5c0 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -211,6 +211,8 @@ module Homebrew puts "From: #{Formatter.url(github_info(f))}" + puts "License: #{f.license}" if f.license + unless f.deps.empty? ohai "Dependencies" %w[build required recommended optional].map do |type|