diff options
| author | Markus Reiter | 2017-02-05 22:40:14 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-07 00:07:59 +0100 |
| commit | e18a17460771c4a77af904b216aa2f9434763ca3 (patch) | |
| tree | 6c25f6f5af38b5e2241042a2869b254c58376120 /Library/Homebrew | |
| parent | 4e7062a9ce7331dcf9f6f03d03da764b743477b6 (diff) | |
| download | brew-e18a17460771c4a77af904b216aa2f9434763ca3.tar.bz2 | |
Simplify check for `:stage_only`.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/dsl.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/dsl.rb b/Library/Homebrew/cask/lib/hbc/dsl.rb index c62873665..4707ae76a 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl.rb @@ -270,14 +270,17 @@ module Hbc ORDINARY_ARTIFACT_TYPES.each do |type| define_method(type) do |*args| - if type == :stage_only && args != [true] - raise CaskInvalidError.new(token, "'stage_only' takes a single argument: true") - end - artifacts[type] << args - if artifacts.key?(:stage_only) && artifacts.keys.count > 1 && - !(artifacts.keys & ACTIVATABLE_ARTIFACT_TYPES).empty? - raise CaskInvalidError.new(token, "'stage_only' must be the only activatable artifact") + if type == :stage_only + if args != [true] + raise CaskInvalidError.new(token, "'stage_only' takes a single argument: true") + end + + unless (artifacts.keys & ACTIVATABLE_ARTIFACT_TYPES).empty? + raise CaskInvalidError.new(token, "'stage_only' must be the only activatable artifact") + end end + + artifacts[type].add(args) end end |
