aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2016-10-07 17:59:37 +0200
committerGitHub2016-10-07 17:59:37 +0200
commit415e5f1f78db90b7d1b1870e55f4bfd505f878aa (patch)
tree5867d2ed172a52a22d90e0477d37481ced748254 /Library/Homebrew/cask/lib
parente1ec23eea099575c3fef19cca8c3767b1c046b08 (diff)
parentca68085e5977ecd36f566325764b4f86e75447f4 (diff)
downloadbrew-415e5f1f78db90b7d1b1870e55f4bfd505f878aa.tar.bz2
Merge pull request #1235 from abookyun/deprecate-license
Deprecate license
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/audit.rb1
-rw-r--r--Library/Homebrew/cask/lib/hbc/cask.rb1
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/create.rb1
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl.rb12
-rw-r--r--Library/Homebrew/cask/lib/hbc/dsl/license.rb70
5 files changed, 2 insertions, 83 deletions
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/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
diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb
index 8e0a7715a..db6739f4b 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,14 +204,8 @@ 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
+ def license(*)
+ odeprecated "Hbc::DSL#license"
end
# depends_on uses a load method so that multiple stanzas can be merged
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