Module: U3d::UnityVersions
- Defined in:
- lib/u3d/unity_versions.rb
Overview
Takes care of fectching versions and version list
Defined Under Namespace
Classes: LinuxVersions, MacVersions, WindowsVersions
URLS: Locations to fetch information from collapse
- UNITY_LINUX_DOWNLOADS =
URL for the forum thread listing all the Linux releases
'https://forum.unity3d.com/threads/unity-on-linux-release-notes-and-known-issues.350256/'.freeze
- UNITY_DOWNLOADS =
URL for the main releases for Windows and Macintosh
'https://unity3d.com/get-unity/download/archive'.freeze
- UNITY_PATCHES =
URL for the patch releases for Windows and Macintosh
'https://unity3d.com/unity/qa/patch-releases'.freeze
- UNITY_BETAS =
URL for the beta releases list, they need to be accessed after
'https://unity3d.com/unity/beta/archive'.freeze
- UNITY_BETA_URL =
URL for a specific beta, takes into parameter a version string (%s)
'https://unity3d.com/unity/beta/unity%s'.freeze
REGEX: expressions to interpret data collapse
- MAC_DOWNLOAD =
Captures a version and its base url
%r{"(https?://[\w/\.-]+/[0-9a-f]{12}/)MacEditorInstaller/[a-zA-Z0-9/\.]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"}
- WIN_DOWNLOAD =
%r{"(https?://[\w/\.-]+/[0-9a-f]{12}/)Windows..EditorInstaller/[a-zA-Z0-9/\.]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"}
- LINUX_DOWNLOAD =
%r{"(https?://[\w/\._-]+/unity\-editor\-installer\-(\d+\.\d+\.\d+\w\d+).*\.sh)"}
- UNITY_BETAVERSION_REGEX =
Captures a beta version in html page
%r{\/unity\/beta\/unity(\d+\.\d+\.\d+\w\d+)"}
- UNITY_EXTRA_DOWNLOAD_REGEX =
%r{"(https?:\/\/[\w\/.-]+\.unity3d\.com\/(\w+))\/[a-zA-Z\/.-]+\/download.html"}
REGEX: expressions to interpret data collapse
- .fetch_betas(url, pattern) ⇒ Object
- .fetch_version(url, pattern) ⇒ Object
- .list_available(os: nil) ⇒ Object
Class Method Details
.fetch_betas(url, pattern) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/u3d/unity_versions.rb', line 79 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(UNITY_BETA_URL % beta[0], pattern)) } hash end |
.fetch_version(url, pattern) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/u3d/unity_versions.rb', line 71 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 |
.list_available(os: nil) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/u3d/unity_versions.rb', line 56 def list_available(os: nil) os ||= U3dCore::Helper. 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 |