From 5fead8eb5ec9613799f51774f90050b475e5e166 Mon Sep 17 00:00:00 2001 From: David Yun Date: Thu, 6 Oct 2016 21:27:44 +0800 Subject: Deprecate license stanza --- Library/Homebrew/cask/lib/hbc/audit.rb | 1 - Library/Homebrew/cask/lib/hbc/cask.rb | 1 - Library/Homebrew/cask/lib/hbc/dsl.rb | 12 ----- Library/Homebrew/cask/lib/hbc/dsl/license.rb | 70 ---------------------------- 4 files changed, 84 deletions(-) delete mode 100644 Library/Homebrew/cask/lib/hbc/dsl/license.rb (limited to 'Library/Homebrew/cask/lib') diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index 476f2aec0..533ede70d 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -50,7 +50,6 @@ module Hbc %i{version sha256 url homepage}.each do |sym| add_error "a #{sym} stanza is required" unless cask.send(sym) end - add_error "a license stanza is required (:unknown is OK)" unless cask.license add_error "at least one name stanza is required" if cask.name.empty? # TODO: specific DSL knowledge should not be spread around in various files like this # TODO: nested_container should not still be a pseudo-artifact at this point diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 1e2056efc..b66f16a8e 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -102,7 +102,6 @@ module Hbc :url, :appcast, :version, - :license, :sha256, :artifacts, :caveats, diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index 8e0a7715a..f074830cb 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -9,7 +9,6 @@ require "hbc/dsl/container" require "hbc/dsl/depends_on" require "hbc/dsl/gpg" require "hbc/dsl/installer" -require "hbc/dsl/license" require "hbc/dsl/postflight" require "hbc/dsl/preflight" require "hbc/dsl/stanza_proxy" @@ -66,7 +65,6 @@ module Hbc :gpg, :homepage, :language, - :license, :name, :sha256, :staged_path, @@ -206,16 +204,6 @@ module Hbc @sha256 ||= arg end - def license(arg = nil) - return @license if arg.nil? - assert_only_one_stanza_allowed :license, !arg.nil? - @license ||= begin - DSL::License.new(arg) unless arg.nil? - rescue StandardError => e - raise CaskInvalidError.new(token, e) - end - end - # depends_on uses a load method so that multiple stanzas can be merged def depends_on(*args) return @depends_on if args.empty? diff --git a/Library/Homebrew/cask/lib/hbc/dsl/license.rb b/Library/Homebrew/cask/lib/hbc/dsl/license.rb deleted file mode 100644 index affbc08f5..000000000 --- a/Library/Homebrew/cask/lib/hbc/dsl/license.rb +++ /dev/null @@ -1,70 +0,0 @@ -module Hbc - class DSL - class License - # a generic category can always be given as a license, so - # category names should be given as both key and value - VALID_LICENSES = { - # license category - unknown: :unknown, - - other: :other, - - closed: :closed, - commercial: :closed, - gratis: :closed, - freemium: :closed, - - oss: :oss, - affero: :oss, - apache: :oss, - arphic: :oss, - artistic: :oss, - bsd: :oss, - cc: :oss, - eclipse: :oss, - gpl: :oss, - isc: :oss, - lppl: :oss, - ncsa: :oss, - mit: :oss, - mpl: :oss, - ofl: :oss, - public_domain: :oss, - ubuntu_font: :oss, - x11: :oss, - }.freeze - - DEFAULT_LICENSE = :unknown - DEFAULT_CATEGORY = VALID_LICENSES[DEFAULT_LICENSE] - - attr_reader :value - - def self.check_constants - categories = Set.new(VALID_LICENSES.values) - categories.each do |cat| - next if VALID_LICENSES.key?(cat) - raise "license category is not a value: '#{@cat.inspect}'" - end - end - - def self.category(license) - VALID_LICENSES.fetch(license, DEFAULT_CATEGORY) - end - - def initialize(arg) - @value = arg - @value = DEFAULT_LICENSE if @value.nil? - return if VALID_LICENSES.key?(@value) - raise "invalid license value: '#{@value.inspect}'" - end - - def category - self.class.category(@value) - end - - def to_s - @value.inspect - end - end - end -end -- cgit v1.2.3 From d4927815a510a867bb5d674fc0e38bf1b3ac1e88 Mon Sep 17 00:00:00 2001 From: David Yun Date: Thu, 6 Oct 2016 22:23:37 +0800 Subject: Remove license from all documentation --- Library/Homebrew/cask/lib/hbc/cli/create.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'Library/Homebrew/cask/lib') diff --git a/Library/Homebrew/cask/lib/hbc/cli/create.rb b/Library/Homebrew/cask/lib/hbc/cli/create.rb index 14860942f..84537cdc1 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/create.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/create.rb @@ -26,7 +26,6 @@ module Hbc url 'https://' name '' homepage '' - license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder app '' end -- cgit v1.2.3 From 81082303dc9e1d05561470d9355169b9953640d4 Mon Sep 17 00:00:00 2001 From: David Yun Date: Fri, 7 Oct 2016 01:16:06 +0800 Subject: Use odeprecated rather than remove it entirely * Fix IntegrationCommandTestCask --- Library/Homebrew/cask/lib/hbc/dsl.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Library/Homebrew/cask/lib') diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index f074830cb..f8ed2bef5 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -204,6 +204,10 @@ module Hbc @sha256 ||= arg end + def license(arg = nil) + odeprecated "Hbc::DSL#license" + end + # depends_on uses a load method so that multiple stanzas can be merged def depends_on(*args) return @depends_on if args.empty? -- cgit v1.2.3 From ca68085e5977ecd36f566325764b4f86e75447f4 Mon Sep 17 00:00:00 2001 From: David Yun Date: Fri, 7 Oct 2016 22:49:01 +0800 Subject: Fix unused argument --- Library/Homebrew/cask/lib/hbc/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library/Homebrew/cask/lib') diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index f8ed2bef5..db6739f4b 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -204,7 +204,7 @@ module Hbc @sha256 ||= arg end - def license(arg = nil) + def license(*) odeprecated "Hbc::DSL#license" end -- cgit v1.2.3