From e6a389dcaf33fe5477a10132e97fc33c95db129d Mon Sep 17 00:00:00 2001 From: Paul Niezborala Date: Fri, 30 Nov 2018 19:10:51 +0100 Subject: [PATCH 1/5] Support new beta download format for windows --- lib/u3d/unity_versions.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/u3d/unity_versions.rb b/lib/u3d/unity_versions.rb index 9b169426..fc9c3cb3 100644 --- a/lib/u3d/unity_versions.rb +++ b/lib/u3d/unity_versions.rb @@ -125,6 +125,12 @@ module UnityVersions MAC_WIN_SHADERS = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)builtin_shaders-(\d+\.\d+\.\d+\w\d+)\.?\w+"} + MAC_DOWNLOAD = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)MacEditorInstaller/[a-zA-Z0-9/\.\+]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"} + MAC_DOWNLOAD_2018_2 = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)UnityDownloadAssistant-(\d+\.\d+\.\d+\w\d+)\.?\w+"} + + WIN_DOWNLOAD = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)Windows..EditorInstaller/[a-zA-Z0-9/\.\+]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"} + WIN_BETA_DOWNLOAD_2018_3 = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)Windows..EditorInstaller/UnitySetup64.exe"} + LINUX_DOWNLOAD_DATED = %r{"(https?://[\w/\._-]+/unity\-editor\-installer\-(\d+\.\d+\.\d+\w\d+).*\.sh)"} LINUX_DOWNLOAD_RECENT_PAGE = %r{"(https?://beta\.unity3d\.com/download/[a-zA-Z0-9/\.\+]+/public_download\.html)"} LINUX_DOWNLOAD_RECENT_FILE = %r{'(https?://beta\.unity3d\.com/download/[a-zA-Z0-9/\.\+]+/unity\-editor\-installer\-(\d+\.\d+\.\d+(?:x)?\w\d+).*\.sh)'} From 3f549f586a836410e741b2fa3dc4d551e0358eef Mon Sep 17 00:00:00 2001 From: Paul Niezborala Date: Fri, 30 Nov 2018 19:11:25 +0100 Subject: [PATCH 2/5] Support listing versions from custom pages --- lib/u3d/unity_versions.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/u3d/unity_versions.rb b/lib/u3d/unity_versions.rb index fc9c3cb3..3a48cdfb 100644 --- a/lib/u3d/unity_versions.rb +++ b/lib/u3d/unity_versions.rb @@ -144,13 +144,15 @@ class << self def list_available(os: nil) os ||= U3dCore::Helper.operating_system + additional_pages = ENV['U3D_ADDITIONAL_PAGES'].split(',') || [] + case os when :linux return U3d::UnityVersions::LinuxVersions.list_available when :mac - return U3d::UnityVersions::MacVersions.list_available + return U3d::UnityVersions::MacVersions.list_available(additional_pages: additional_pages) when :win - return U3d::UnityVersions::WindowsVersions.list_available + return U3d::UnityVersions::WindowsVersions.list_available(additional_pages: additional_pages) else raise ArgumentError, "Operating system #{os} not supported" end @@ -280,21 +282,24 @@ def fetch_json(os) @versions end - def fetch_all_channels + def fetch_all_channels(additional_pages: []) 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) + additional_pages.each do |page| + fetch_some('custom', page) + end @versions end end class MacVersions class << self - def list_available + def list_available(additional_pages: []) versions_fetcher = VersionsFetcher.new(pattern: [MAC_WIN_SHADERS]) - versions_fetcher.fetch_all_channels + versions_fetcher.fetch_all_channels(additional_pages: additional_pages) versions_fetcher.fetch_json('darwin') end end @@ -302,9 +307,9 @@ def list_available class WindowsVersions class << self - def list_available + def list_available(additional_pages: []) versions_fetcher = VersionsFetcher.new(pattern: MAC_WIN_SHADERS) - versions_fetcher.fetch_all_channels + versions_fetcher.fetch_all_channels(additional_pages: additional_pages) versions_fetcher.fetch_json('win32') end end From 3aec06aec8176b36e8eb2ef666ec4ce3260ce228 Mon Sep 17 00:00:00 2001 From: Paul Niezborala Date: Mon, 3 Dec 2018 15:01:35 +0100 Subject: [PATCH 3/5] Add message for lack of support on Linux --- lib/u3d/unity_versions.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/u3d/unity_versions.rb b/lib/u3d/unity_versions.rb index 3a48cdfb..cb37352e 100644 --- a/lib/u3d/unity_versions.rb +++ b/lib/u3d/unity_versions.rb @@ -148,6 +148,7 @@ def list_available(os: nil) case os when :linux + UI.important 'Additional download pages are not yet support on Linux' unless additional_pages.empty? return U3d::UnityVersions::LinuxVersions.list_available when :mac return U3d::UnityVersions::MacVersions.list_available(additional_pages: additional_pages) From c40aabeb31624c87cc838d73b4ce93c561132a55 Mon Sep 17 00:00:00 2001 From: Paul Niezborala Date: Mon, 3 Dec 2018 15:39:05 +0100 Subject: [PATCH 4/5] Workaround to get version from url --- lib/u3d/unity_versions.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/u3d/unity_versions.rb b/lib/u3d/unity_versions.rb index cb37352e..5a88f33c 100644 --- a/lib/u3d/unity_versions.rb +++ b/lib/u3d/unity_versions.rb @@ -129,8 +129,9 @@ module UnityVersions MAC_DOWNLOAD_2018_2 = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)UnityDownloadAssistant-(\d+\.\d+\.\d+\w\d+)\.?\w+"} WIN_DOWNLOAD = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)Windows..EditorInstaller/[a-zA-Z0-9/\.\+]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"} - WIN_BETA_DOWNLOAD_2018_3 = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)Windows..EditorInstaller/UnitySetup64.exe"} - + # NOTE: the version info is no longer contained in the url for the newest Unity beta versions + # As a workaround, we work with the Android package + WIN_BETA_DOWNLOAD_2018_3 = %r{"(https?://[\w/\.-]+/[0-9a-f\+]{12,13}/)TargetSupportInstaller/UnitySetup-Android-Support-for-Editor-(\d+\.\d+\.\d+\w\d+)\.?\w+"} LINUX_DOWNLOAD_DATED = %r{"(https?://[\w/\._-]+/unity\-editor\-installer\-(\d+\.\d+\.\d+\w\d+).*\.sh)"} LINUX_DOWNLOAD_RECENT_PAGE = %r{"(https?://beta\.unity3d\.com/download/[a-zA-Z0-9/\.\+]+/public_download\.html)"} LINUX_DOWNLOAD_RECENT_FILE = %r{'(https?://beta\.unity3d\.com/download/[a-zA-Z0-9/\.\+]+/unity\-editor\-installer\-(\d+\.\d+\.\d+(?:x)?\w\d+).*\.sh)'} From ca5deab4f85f4b1db51f635bdf6e40dd972c845d Mon Sep 17 00:00:00 2001 From: Paul Niezborala Date: Mon, 3 Dec 2018 15:41:33 +0100 Subject: [PATCH 5/5] Fix environment getting --- lib/u3d/unity_versions.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/u3d/unity_versions.rb b/lib/u3d/unity_versions.rb index 5a88f33c..c734b776 100644 --- a/lib/u3d/unity_versions.rb +++ b/lib/u3d/unity_versions.rb @@ -145,7 +145,8 @@ class << self def list_available(os: nil) os ||= U3dCore::Helper.operating_system - additional_pages = ENV['U3D_ADDITIONAL_PAGES'].split(',') || [] + additional_pages_env = ENV['U3D_ADDITIONAL_PAGES'] + additional_pages = additional_pages_env ? additional_pages_env.split(',') : [] case os when :linux