module U3d::UnityVersions
Takes care of fectching versions and version list
Constants
- LINUX_DOWNLOAD
@!group REGEX: expressions to interpret data
Captures a version and its base url
- LINUX_DOWNLOAD_DATED
- LINUX_DOWNLOAD_RECENT_FILE
- LINUX_DOWNLOAD_RECENT_PAGE
- LINUX_INSTALLER
- MAC_WIN_SHADERS
- UNITY_BETAS
URL for the beta releases list, they need to be accessed after
- UNITY_BETAVERSION_REGEX
Captures a beta version in html page
- UNITY_BETA_URL
URL for a specific beta, takes into parameter a version string (%s)
- UNITY_DOWNLOADS
URL for the main releases for Windows and Macintosh
- UNITY_EXTRA_DOWNLOAD_REGEX
- UNITY_LATEST_JSON
For the latest releases fetched from json
- UNITY_LATEST_JSON_URL
URL for latest releases listing (since Unity 2017.1.5f1), takes into parameter os (windows => win32, mac => darwin)
- UNITY_LINUX_DOWNLOADS
@!group URLS: Locations to fetch information from
URL for the forum thread listing all the Linux releases
- UNITY_LTSES
URL for the LTS releases for Windows and Macintosh
- UNITY_PATCHES
URL for the patch releases for Windows and Macintosh
Public Class Methods
fetch_betas(url, pattern)
click to toggle source
# File lib/u3d/unity_versions.rb, line 184 def fetch_betas(url, pattern) hash = {} data = Utils.get_ssl(url) results = data.scan(UNITY_BETAVERSION_REGEX).uniq results.each { |beta| hash.merge!(fetch_version(format(UNITY_BETA_URL, version: beta[0]), pattern)) } hash end
fetch_from_json(url, pattern)
click to toggle source
# File lib/u3d/unity_versions.rb, line 178 def fetch_from_json(url, pattern) fetch_json(url, pattern).map do |build| [build['version'], pattern.match(build['downloadUrl'])[1]] end.to_h end
fetch_json(url, pattern)
click to toggle source
# File lib/u3d/unity_versions.rb, line 172 def fetch_json(url, pattern) require 'json' data = Utils.get_ssl(url) JSON.parse(data).values.flatten.select { |b| pattern =~ b['downloadUrl'] } end
fetch_version(url, pattern)
click to toggle source
# File lib/u3d/unity_versions.rb, line 154 def fetch_version(url, pattern) hash = {} data = Utils.get_ssl(url) results = data.scan(pattern) results.each { |capt| hash[capt[1]] = capt[0] } return hash end
fetch_version_paged(url, pattern)
click to toggle source
# File lib/u3d/unity_versions.rb, line 162 def fetch_version_paged(url, pattern) U3d::Utils.get_ssl(url).scan(/\?page=\d+/).map do |page| fetch_version("#{url}#{page}", pattern) end.reduce({}, :merge) end
json_url_for(os)
click to toggle source
# File lib/u3d/unity_versions.rb, line 168 def json_url_for(os) format(UNITY_LATEST_JSON_URL, os: os) end
list_available(os: nil)
click to toggle source
# File lib/u3d/unity_versions.rb, line 139 def list_available(os: nil) os ||= U3dCore::Helper.operating_system case os when :linux return U3d::UnityVersions::LinuxVersions.list_available when :mac return U3d::UnityVersions::MacVersions.list_available when :win return U3d::UnityVersions::WindowsVersions.list_available else raise ArgumentError, "Operating system #{os} not supported" end end