Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to new appcast check #6155

Merged
merged 3 commits into from May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions Library/Homebrew/cask/audit.rb
Expand Up @@ -301,11 +301,16 @@ def check_download
def check_appcast_contains_version
return unless check_appcast?
return if cask.appcast.to_s.empty?
return if cask.appcast.configuration == :no_check

appcast_stanza = cask.appcast.to_s
appcast_contents, = curl_output("--max-time", "5", appcast_stanza)
appcast_contents, = curl_output("--location", "--max-time", "5", appcast_stanza)
version_stanza = cask.version.to_s
adjusted_version_stanza = version_stanza.split(",")[0].split("-")[0].split("_")[0]
if cask.appcast.configuration.blank?
adjusted_version_stanza = version_stanza.split(",")[0].split("-")[0].split("_")[0]
else
adjusted_version_stanza = cask.appcast.configuration
end
return if appcast_contents.include? adjusted_version_stanza

add_warning "appcast at URL '#{appcast_stanza}' does not contain"\
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/cask/dsl/appcast.rb
Expand Up @@ -3,11 +3,12 @@
module Cask
class DSL
class Appcast
attr_reader :uri, :parameters
attr_reader :uri, :parameters, :configuration

def initialize(uri, **parameters)
@uri = URI(uri)
@parameters = parameters
@configuration = parameters[:configuration] if parameters.key?(:configuration)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the if here, it will be nil if the key doesn't exist anyways.

end

def to_yaml
Expand Down