forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forgotten in Homebrew#4688, but should be considered part of Cask DSL 1.0. A `depends_on` stanza is much less useful without the corresponding `conflicts_with`. References: Homebrew#4896
- Loading branch information
1 parent
eb2c22d
commit 44f1a37
Showing
7 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class Cask::ConflictsWith | ||
|
||
VALID_KEYS = Set.new [ | ||
:formula, | ||
:cask, | ||
:macos, | ||
:arch, | ||
:x11, | ||
:java, | ||
] | ||
|
||
attr_accessor *VALID_KEYS | ||
attr_accessor :pairs | ||
|
||
def initialize(pairs={}) | ||
@pairs = pairs | ||
pairs.each do |key, value| | ||
raise "invalid conflicts_with key: '#{key.inspect}'" unless VALID_KEYS.include?(key) | ||
writer_method = "#{key}=".to_sym | ||
send(writer_method, value) | ||
end | ||
end | ||
|
||
def to_yaml | ||
@pairs.to_yaml | ||
end | ||
|
||
def to_s | ||
@pairs.inspect | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class InvalidConflictsWithKey < TestCask | ||
url TestHelper.local_binary('caffeine.zip') | ||
homepage 'http://example.com/invalid-conflicts-with-key' | ||
conflicts_with :no_such_key => 'unar' | ||
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' | ||
version '1.2.3' | ||
link 'Caffeine.app' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class WithConflictsWith < TestCask | ||
url TestHelper.local_binary('caffeine.zip') | ||
homepage 'http://example.com/with-conflicts-with' | ||
conflicts_with :formula => 'unar' | ||
sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' | ||
version '1.2.3' | ||
link 'Caffeine.app' | ||
end |