class U3d::UnityVersions::VersionsFetcher
Attributes
versions[RW]
Public Class Methods
new(pattern:)
click to toggle source
# File lib/u3d/unity_versions.rb, line 260 def initialize(pattern:) @versions = {} @patterns = pattern.is_a?(Array) ? pattern : [pattern] end
Public Instance Methods
fetch_all_channels()
click to toggle source
# File lib/u3d/unity_versions.rb, line 292 def fetch_all_channels fetch_some('lts', UNITY_LTSES) fetch_some('stable', UNITY_DOWNLOADS) fetch_some('patch', UNITY_PATCHES) # This does not work any longer # fetch_some('beta', UNITY_BETAS) @versions end
fetch_json(os)
click to toggle source
# File lib/u3d/unity_versions.rb, line 277 def fetch_json(os) UI.message 'Loading Unity latest releases' url = UnityVersions.json_url_for(os) latest = UnityVersions.fetch_from_json(url, UNITY_LATEST_JSON) UI.success "Found #{latest.count} latest releases." @versions.merge!(latest) do |key, oldval, newval| UI.important "Unity version #{key} already fetched, replacing #{oldval} with #{newval}" if newval != oldval newval end @versions end
fetch_some(type, url)
click to toggle source
# File lib/u3d/unity_versions.rb, line 265 def fetch_some(type, url) UI.message "Loading Unity #{type} releases" total = {} @patterns.each do |pattern| current = UnityVersions.fetch_version_paged(url, pattern) current = UnityVersions.fetch_version(url, pattern) if current.empty? total.merge!(current) end UI.success "Found #{total.count} #{type} releases." @versions.merge!(total) end