Skip to content

Commit

Permalink
Resource: set version to nil if version is null
Browse files Browse the repository at this point in the history
Is this the right fix? This fixes version cascading from the parent.
  • Loading branch information
mistydemeo committed Nov 10, 2016
1 parent d32a1c4 commit 4e3d23a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Library/Homebrew/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ def url(val = nil, specs = {})
end

def version(val = nil)
@version ||= detect_version(val)
@version ||= begin
version = detect_version(val)
version.null? ? nil : version
end
end

def mirror(val)
Expand All @@ -155,7 +158,7 @@ def mirror(val)
private

def detect_version(val)
return if val.nil? && url.nil?
return Version::NULL if val.nil? && url.nil?

case val
when nil then Version.detect(url, specs)
Expand Down

0 comments on commit 4e3d23a

Please sign in to comment.