mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
Fix undefined method 'sub!' in tools/version.rb. (#12092)
Fix Lint/AmbiguousRange: Wrap complex range boundaries with parentheses to avoid ambiguity. Fix Style/RedundantParentheses: Don't use parentheses around a logical expression.
This commit is contained in:
@@ -23,7 +23,7 @@ require_relative '../lib/package_utils'
|
||||
|
||||
def get_version(name, homepage, source)
|
||||
# Determine if the source is a GitHub repository.
|
||||
unless source.nil?
|
||||
unless source.nil? || source.is_a?(Hash)
|
||||
source.sub!('www.', '')
|
||||
url = URI.parse(source)
|
||||
if url.host == 'github.com'
|
||||
@@ -57,7 +57,7 @@ def get_anitya_id(name, homepage)
|
||||
json2 = JSON.parse(Net::HTTP.get(URI("https://release-monitoring.org/api/v2/packages/?name=#{name.tr('-', '_')}")))
|
||||
return if json2['total_items'].zero?
|
||||
|
||||
(0..json2['total_items'] - 1).each do |i|
|
||||
(0..(json2['total_items'] - 1)).each do |i|
|
||||
next unless json2['items'][i]['distribution'] == 'Chromebrew'
|
||||
return get_anitya_id(json2['items'][i]['project'], homepage) if json2['items'][i]['name'] == name.tr('-', '_')
|
||||
end
|
||||
@@ -65,7 +65,7 @@ def get_anitya_id(name, homepage)
|
||||
candidates = []
|
||||
# First, we remove any candidates which are provided by language package managers, such as pip.
|
||||
# This is because Chromebrew does not repackage them (#7713), so they won't be what we're looking for.
|
||||
(0..number_of_packages - 1).each do |i|
|
||||
(0..(number_of_packages - 1)).each do |i|
|
||||
# If a package is not provided by a language package manager, the ecosystem will be set to the homepage.
|
||||
# https://release-monitoring.org/static/docs/api.html#get--api-v2-projects-
|
||||
candidates.append(i) if json['items'][i]['ecosystem'] == json['items'][i]['homepage']
|
||||
|
||||
Reference in New Issue
Block a user