u3d 1.0.19 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f69304001a1ba0ebd4324ddfdac8013dbd36dfe
4
- data.tar.gz: bc9b22bb8dbce826877de47fcf5a96138415d9c1
3
+ metadata.gz: ab0e4249d0406f5fb52fdbec3de6d5da617e749d
4
+ data.tar.gz: bb2dca8350752bf2eea3ca212b838661fd8b4762
5
5
  SHA512:
6
- metadata.gz: 5592d48d01dde17b76155b4d75243e5e3f5c5cfc06bda7240b205437c2aaa1fb5a7764182369f4cbd297934d962b35cafc8bb0175d47f9c1b9627d90f02ab2ce
7
- data.tar.gz: 8dfbcc646715e7891f420005e8acd8bb7f7486fd97b8a7f559c653173e103a27165ff33a5070385a2e6a9e7e8462db99479093970eb740e17ff68e5afeb00748
6
+ metadata.gz: d2250d5b8c92617ac32e8108abff60d6dc93fbab21d5ce8007a0639e832444635f8c68c596c5cc7cefdfbfab2420aa269da4bd91ff3b1518630d8cf319533807
7
+ data.tar.gz: 04d154f9e8c7bdb6f7cac0f3a47711c5e2fe1b8cd4efa5a086fb6984e67fa7d9776498983cb3167e6c98ad302cd19fea4081a8afc0dec6b146f078fb733a10e3
@@ -1,4 +1,4 @@
1
- future-release=v1.0.19
1
+ future-release=v1.0.20
2
2
  since-tag=v0.9
3
3
  exclude_tags_regex=v0\.[0-8]\..*
4
4
  exclude-labels=nochangelog,question
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.0.20](https://github.com/DragonBox/u3d/tree/v1.0.20) (2018-04-19)
4
+ [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.19...v1.0.20)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - u3d/list: display full revision number \(prepares for \#274\) [\#280](https://github.com/DragonBox/u3d/pull/280) ([lacostej](https://github.com/lacostej))
9
+ - u3d/prettify: catch build pipeline messages [\#279](https://github.com/DragonBox/u3d/pull/279) ([niezbop](https://github.com/niezbop))
10
+ - u3d/prettify: fix exception rule start pattern [\#273](https://github.com/DragonBox/u3d/pull/273) ([niezbop](https://github.com/niezbop))
11
+ - u3d/\*: failure reporter [\#267](https://github.com/DragonBox/u3d/pull/267) ([niezbop](https://github.com/niezbop))
12
+ - Move duplicated data\_path out of U3d::Cache/U3d::INIparser to U3dCore::Helper [\#266](https://github.com/DragonBox/u3d/pull/266) ([niezbop](https://github.com/niezbop))
13
+
14
+ **Fixed bugs:**
15
+
16
+ - UnityEngine.Debug.Log\[Error|Warning|\]Format do not appear in u3d run output [\#269](https://github.com/DragonBox/u3d/issues/269)
17
+ - u3d/prettify: Catch Enlighten jobs failure [\#272](https://github.com/DragonBox/u3d/pull/272) ([niezbop](https://github.com/niezbop))
18
+
19
+ **Closed issues:**
20
+
21
+ - u3d/log catch all BuildPipeline:BuildPlayerInternalNoCheck messages [\#278](https://github.com/DragonBox/u3d/issues/278)
22
+ - New LTS releases not recognised [\#276](https://github.com/DragonBox/u3d/issues/276)
23
+ - cache stopped building [\#275](https://github.com/DragonBox/u3d/issues/275)
24
+ - incompatible character encodings: CP850 and UTF-8 [\#268](https://github.com/DragonBox/u3d/issues/268)
25
+
26
+ **Merged pull requests:**
27
+
28
+ - u3d/available support LTS \(\#276\) [\#277](https://github.com/DragonBox/u3d/pull/277) ([lacostej](https://github.com/lacostej))
29
+ - Document locale unicode requirements \(fixes \#268\) [\#271](https://github.com/DragonBox/u3d/pull/271) ([lacostej](https://github.com/lacostej))
30
+ - u3d/prettify: Fix UnityEngine.Debug.LogXXXFormat not being caught [\#270](https://github.com/DragonBox/u3d/pull/270) ([niezbop](https://github.com/niezbop))
31
+
3
32
  ## [v1.0.19](https://github.com/DragonBox/u3d/tree/v1.0.19) (2018-03-09)
4
33
  [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.18...v1.0.19)
5
34
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (1.0.19)
4
+ u3d (1.0.20)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
7
  file-tail (>= 1.2.0)
data/README.md CHANGED
@@ -61,6 +61,17 @@ The prettifyer is on by default but can be turned off to get Unity's raw output.
61
61
  gem install u3d
62
62
  ```
63
63
 
64
+ ### Setup
65
+
66
+ u3d requires some environment variables set up to run correctly. In particular processing log files requires your locales to be set to a UTF-8 locale. In your shell profile add the following lines:
67
+
68
+ ```
69
+ export LC_ALL=en_US.UTF-8
70
+ export LANG=en_US.UTF-8
71
+ ```
72
+
73
+ You can find your shell profile at ~/.bashrc, ~/.bash_profile or ~/.zshrc depending on your system.
74
+
64
75
  ## Unity versions numbering
65
76
 
66
77
  Unity uses the following version formatting: 0.0.0x0. The \'x\' can takes different values:
@@ -73,6 +84,16 @@ Some versions are known to have a different numbering, e.g. Linux 2017.1.0f3 is
73
84
 
74
85
  When referencing to a version on the CLI, u3d sanitizes these weird versions. For example, if you ask u3d to launch unity 2017.1.0f3 on Linux, you can use `u3d -u 2017.1.0f3` and it will find "2017.1.0xf3Linux".
75
86
 
87
+ ### Unity build numbers
88
+
89
+ Every Unity version has a build number in the form of a 12 characters hexadecimal (e.g. `bf5cca3e2788`). You might have noticed them: those build numbers are currently part of the download URLs that `u3d available` displays.
90
+
91
+ Most of the time Unity users won't have to pay attention to build numbers. In a few scenarios, they become important.
92
+
93
+ For example, sometimes Unity releases multiple builds with the same version but different build numbers, e.g. when releasing hot fixes. If you need a hotfix release, you might need to ensure that you are using it.
94
+
95
+ Right now u3d has light support for build numbers. The build number can be found inside the Unity installation files and u3d will extract them and `u3d list` will display both the version and the build number. In the future u3d will have more features to help you managing installations of those special builds. Follow this [request for enhancement](https://github.com/DragonBox/u3d/issues/274) for more information.
96
+
76
97
  ## Default Installation paths
77
98
 
78
99
  The standard Unity installer has some quirks:
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "exception": {
26
26
  "active": true,
27
- "start_pattern": "[eE]xception\\w*: (?<message>.*)\\n",
27
+ "start_pattern": "^(?:(?!\\().)*[eE]xception\\w*: (?<message>.*)\\n",
28
28
  "end_pattern": "(?:Filename: (?:[\\w/:]+/(?<file>\\w+\\.\\w+))? Line: (?<line>-?\\d+)|(?<fileunknown>filename unknown)>:(?<lineunknown>-?\\d+))",
29
29
  "start_message": false,
30
30
  "end_message": "%{file}%{fileunknown}(line %{line}%{lineunknown}): %{message}",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "log": {
55
55
  "active": true,
56
- "start_pattern": "UnityEngine\\.Debug:Log\\(Object\\)",
56
+ "start_pattern": "UnityEngine\\.Debug:Log(?:Format)?\\((?:String, )?Object(?:\\[\\])?\\)",
57
57
  "fetch_first_line_not_matching": [
58
58
  "UnityEngine\\.",
59
59
  "^\\n"
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "log_assertion": {
68
68
  "active": true,
69
- "start_pattern": "UnityEngine\\.Debug:LogAssertion\\(Object\\)",
69
+ "start_pattern": "UnityEngine\\.Debug:LogAssertion(?:Format)?\\((?:String, )?Object(?:\\[\\])?\\)",
70
70
  "fetch_first_line_not_matching": [
71
71
  "UnityEngine\\.",
72
72
  "^\\n"
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "log_warning": {
82
82
  "active": true,
83
- "start_pattern": "UnityEngine\\.Debug:LogWarning\\(Object\\)",
83
+ "start_pattern": "UnityEngine\\.Debug:LogWarning(?:Format)?\\((?:String, )?Object(?:\\[\\])?\\)",
84
84
  "fetch_first_line_not_matching": [
85
85
  "UnityEngine\\.",
86
86
  "^\\n",
@@ -95,7 +95,7 @@
95
95
  },
96
96
  "log_error": {
97
97
  "active": true,
98
- "start_pattern": "UnityEngine\\.Debug:LogError\\(Object\\)",
98
+ "start_pattern": "UnityEngine\\.Debug:LogError(?:Format)?\\((?:String, )?Object(?:\\[\\])?\\)",
99
99
  "fetch_first_line_not_matching": [
100
100
  "UnityEngine\\.",
101
101
  "^\\n",
@@ -125,6 +125,22 @@
125
125
  "end_message": "[LOG] %{file}(line %{line}): %{message}",
126
126
  "type": "error"
127
127
  },
128
+ "build_pipeline_message": {
129
+ "active": true,
130
+ "start_pattern": "UnityEditor\\.BuildPipeline:BuildPlayerInternalNoCheck",
131
+ "fetch_first_line_not_matching": [
132
+ "UnityEditor\\.",
133
+ "^\\n",
134
+ "^\\t",
135
+ "^ "
136
+ ],
137
+ "fetched_line_pattern": "(?<message>.*)\\n",
138
+ "fetched_line_message": false,
139
+ "start_message": false,
140
+ "end_pattern": "Filename: (?:.+/(?<file>\\w+\\.\\w+\\.\\w+))? Line: (?<line>-?\\d+)",
141
+ "end_message": "[LOG] %{file}(line %{line}): %{message}",
142
+ "type": "warning"
143
+ },
128
144
  "batchmode_exit": {
129
145
  "active": true,
130
146
  "start_pattern": "Exiting batchmode successfully now!",
@@ -297,6 +313,14 @@
297
313
  "comment": "Asset managing and packaging",
298
314
  "phase_start_pattern": "Packing sprites",
299
315
  "rules": {
316
+ "enlighten_failure": {
317
+ "active": true,
318
+ "start_pattern": "'(?<jobname>.+)' job failed with error code: (?<code>-?\\d+) \\('(?<message>.+)'\\)",
319
+ "start_message": false,
320
+ "end_pattern": "Filename: (?:.+/(?<file>\\w+\\.\\w+\\.\\w+))? Line: (?<line>-?\\d+)",
321
+ "end_message": "Enlighten job \"%{jobname}\" failed with status code %{code} %{file}(line %{line}): %{message}",
322
+ "type": "error"
323
+ },
300
324
  "pack_warning": {
301
325
  "active": true,
302
326
  "start_pattern": "WARNING: (?<message>.+)",
data/lib/u3d/cache.rb CHANGED
@@ -31,11 +31,7 @@ module U3d
31
31
  class Cache
32
32
  using ::CoreExtensions::OperatingSystem
33
33
 
34
- # Path to the directory containing the cache for the different OS
35
- DEFAULT_LINUX_PATH = File.join(ENV['HOME'], '.u3d').freeze
36
- DEFAULT_MAC_PATH = File.join(ENV['HOME'], 'Library', 'Application Support', 'u3d').freeze
37
- DEFAULT_WINDOWS_PATH = File.join(ENV['HOME'], 'AppData', 'Local', 'u3d').freeze
38
- # Name of the file itself
34
+ # Name of the cache file
39
35
  DEFAULT_NAME = 'cache.json'.freeze
40
36
  # Maximum duration after which the cache is considered outdated
41
37
  # Currently set to 24h
@@ -73,14 +69,7 @@ module U3d
73
69
  end
74
70
 
75
71
  def self.default_os_path
76
- case U3dCore::Helper.operating_system
77
- when :linux
78
- DEFAULT_LINUX_PATH
79
- when :mac
80
- DEFAULT_MAC_PATH
81
- when :win
82
- DEFAULT_WINDOWS_PATH
83
- end
72
+ U3dCore::Helper.data_path
84
73
  end
85
74
 
86
75
  private #-------------------------------------------------------------------
data/lib/u3d/commands.rb CHANGED
@@ -56,7 +56,8 @@ module U3d
56
56
  sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
57
57
  sorted_keys.each do |k|
58
58
  u = map[k]
59
- UI.message "Version #{u.version.ljust(30)}(#{u.root_path})"
59
+ version = "#{u.version.ljust(13)} [#{u.build_number}]".ljust(30)
60
+ UI.message "Version #{version}(#{u.root_path})"
60
61
  packages = u.packages
61
62
  next unless options[:packages] && packages && !packages.empty?
62
63
  UI.message 'Packages:'
@@ -0,0 +1,38 @@
1
+ require 'date'
2
+ require 'fileutils'
3
+ require 'json'
4
+
5
+ module U3d
6
+ # Internal class to use when trying to improve the prettifier
7
+ # Opt-in with env variable U3D_REPORT_FAILURES
8
+ class FailureReporter
9
+ class << self
10
+ def report(failure_type: "DEFAULT", failure_message: "", data: {})
11
+ return unless ENV['U3D_REPORT_FAILURES']
12
+ report = {
13
+ type: failure_type,
14
+ message: failure_message,
15
+ data: data
16
+ }
17
+
18
+ FileUtils.mkdir_p default_report_path
19
+ report_file = File.join(
20
+ default_report_path,
21
+ "#{failure_type}.#{Date.now.strftime('%Y%m%dT%H%M')}.failure.json"
22
+ )
23
+
24
+ File.open(report_file, 'w') do |file|
25
+ file.write JSON.pretty_generate(report)
26
+ end
27
+ rescue StandardError => e
28
+ UI.important "Unable to report a #{failure_type} failure. Please use --verbose to get more information about the failure"
29
+ UI.verbose "Unable to report failure: #{e}"
30
+ UI.verbose "Failure was: [#{failure_type}]: #{failure_message}"
31
+ end
32
+
33
+ def default_report_path
34
+ File.join(U3dCore::Helper.data_path, 'failures')
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/u3d/iniparser.rb CHANGED
@@ -31,9 +31,6 @@ module U3d
31
31
  # @!group INI parameters to load and save ini files
32
32
  #####################################################
33
33
  INI_NAME = 'unity-%<version>s-%<os>s.ini'.freeze
34
- INI_LINUX_PATH = File.join(ENV['HOME'], '.u3d', 'ini_files').freeze
35
- INI_MAC_PATH = File.join(ENV['HOME'], 'Library', 'Application Support', 'u3d', 'ini_files').freeze
36
- INI_WIN_PATH = File.join(ENV['HOME'], 'AppData', 'Local', 'u3d', 'ini_files').freeze
37
34
 
38
35
  class << self
39
36
  def load_ini(version, cached_versions, os: U3dCore::Helper.operating_system, offline: false)
@@ -106,14 +103,7 @@ url=#{url}
106
103
  end
107
104
 
108
105
  def default_ini_path
109
- case U3dCore::Helper.operating_system
110
- when :linux
111
- INI_LINUX_PATH
112
- when :mac
113
- INI_MAC_PATH
114
- when :win
115
- INI_WIN_PATH
116
- end
106
+ File.join(U3dCore::Helper.data_path, 'ini_files')
117
107
  end
118
108
  end
119
109
  end
@@ -109,6 +109,10 @@ module U3d
109
109
  plist['CFBundleVersion']
110
110
  end
111
111
 
112
+ def build_number
113
+ plist['UnityBuildNumber']
114
+ end
115
+
112
116
  def default_log_file
113
117
  "#{ENV['HOME']}/Library/Logs/Unity/Editor.log"
114
118
  end
@@ -163,6 +167,39 @@ module U3d
163
167
  end
164
168
  end
165
169
 
170
+ class LinuxInstallationHelper
171
+ STRINGS_FULL_VERSION_MATCHER = /^[0-9\.abfp]+_[0-9a-f]{12}/
172
+
173
+ def find_build_number(root)
174
+ known_rev_locations.each do |p|
175
+ rev = find_build_number_in("#{root}#{p}")
176
+ return rev if rev
177
+ end
178
+ end
179
+
180
+ private
181
+
182
+ def strings(path)
183
+ command = "strings #{path.shellescape}"
184
+ `#{command}`.split("\n")
185
+ end
186
+
187
+ # sorted by order of speed to fetch the strings data
188
+ def known_rev_locations
189
+ ['/Editor/BugReporter/unity.bugreporter',
190
+ '/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/lib/UnityNativeJs/UnityNative.js.mem',
191
+ '/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/Variations/linux32_headless_nondevelopment_mono/LinuxPlayer',
192
+ '/Editor/Unity']
193
+ end
194
+
195
+ def find_build_number_in(path = nil)
196
+ return nil unless File.exist? path
197
+ str = strings(path)
198
+ lines = str.select { |l| l =~ STRINGS_FULL_VERSION_MATCHER }
199
+ lines.empty? ? nil : lines[0].split('_')[1]
200
+ end
201
+ end
202
+
166
203
  class LinuxInstallation < Installation
167
204
  def version
168
205
  # I don't find an easy way to extract the version on Linux
@@ -176,6 +213,10 @@ module U3d
176
213
  version
177
214
  end
178
215
 
216
+ def build_number
217
+ @build_number ||= LinuxInstallationHelper.new.find_build_number(root_path)
218
+ end
219
+
179
220
  def default_log_file
180
221
  "#{ENV['HOME']}/.config/unity3d/Editor.log"
181
222
  end
@@ -220,6 +261,56 @@ module U3d
220
261
  end
221
262
  end
222
263
 
264
+ class WindowsInstallationHelper
265
+ def build_number(exe_path)
266
+ s = string_file_info("Unity Version", exe_path)
267
+ if s
268
+ a = s.split("_")
269
+ return a[1] if a.count > 1
270
+ end
271
+ nil
272
+ end
273
+
274
+ private
275
+
276
+ def string_file_info(info, path)
277
+ require "Win32API"
278
+ get_file_version_info_size = Win32API.new('version.dll', 'GetFileVersionInfoSize', 'PP', 'L')
279
+ get_file_version_info = Win32API.new('version.dll', 'GetFileVersionInfo', 'PIIP', 'I')
280
+ ver_query_value = Win32API.new('version.dll', 'VerQueryValue', 'PPPP', 'I')
281
+ rtl_move_memory = Win32API.new('kernel32.dll', 'RtlMoveMemory', 'PLL', 'I')
282
+
283
+ file = path.tr("/", "\\")
284
+
285
+ buf = [0].pack('L')
286
+ version_size = get_file_version_info_size.call(file + "\0", buf)
287
+ raise Exception if version_size.zero? # TODO: use GetLastError
288
+
289
+ version_info = 0.chr * version_size
290
+ version_ok = get_file_version_info.call(file, 0, version_size, version_info)
291
+ raise Exception if version_ok.zero? # TODO: use GetLastError
292
+
293
+ # hardcoding lang codepage
294
+ struct_path = "\\StringFileInfo\\040904b0\\#{info}"
295
+
296
+ addr = [0].pack('L')
297
+ size = [0].pack('L')
298
+ query_ok = ver_query_value.call(version_info, struct_path + "\0", addr, size)
299
+ raise Exception if query_ok.zero?
300
+
301
+ raddr = addr.unpack('L')[0]
302
+ rsize = size.unpack('L')[0]
303
+
304
+ info = Array.new(rsize, 0).pack('L*')
305
+ rtl_move_memory.call(info, raddr, info.length)
306
+ info.strip
307
+ rescue StandardError => e
308
+ UI.verbose("Failure to find '#{info}' under '#{path}': #{e}")
309
+ UI.verbose(e.backtrace)
310
+ nil
311
+ end
312
+ end
313
+
223
314
  class WindowsInstallation < Installation
224
315
  def version
225
316
  path = "#{root_path}/Editor/Data/"
@@ -228,6 +319,10 @@ module U3d
228
319
  PlaybackEngineUtils.unity_version(package)
229
320
  end
230
321
 
322
+ def build_number
323
+ @build_number ||= WindowsInstallationHelper.new.build_number(exe_path)
324
+ end
325
+
231
326
  def default_log_file
232
327
  if @logfile.nil?
233
328
  begin
@@ -21,6 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  require 'json'
24
+ require 'u3d/failure_reporter'
24
25
 
25
26
  module U3d
26
27
  # Analyzes log by filtering output along a set of rules
@@ -197,6 +198,17 @@ module U3d
197
198
  # If it is still active during phase change, it means that something went wrong
198
199
  context = @lines_memory.map { |l| "> #{l}" }.join('')
199
200
  UI.error("[#{@active_phase}] Could not finish active rule '#{@active_rule}'. Aborting it. Context:\n#{context}")
201
+
202
+ U3d::FailureReporter.report(
203
+ failure_type: "PRETTIFIER",
204
+ failure_message: "Could not finish rule",
205
+ data: {
206
+ phase: @active_phase,
207
+ rule: @active_rule,
208
+ context: context.split("\n")
209
+ }
210
+ )
211
+
200
212
  @active_rule = nil
201
213
  end
202
214
  UI.verbose("--- Ending #{@active_phase} phase ---")
@@ -106,6 +106,8 @@ module U3d
106
106
  UNITY_LINUX_DOWNLOADS = 'https://forum.unity.com/threads/unity-on-linux-release-notes-and-known-issues.350256/'.freeze
107
107
  # URL for the main releases for Windows and Macintosh
108
108
  UNITY_DOWNLOADS = 'https://unity3d.com/get-unity/download/archive'.freeze
109
+ # URL for the LTS releases for Windows and Macintosh
110
+ UNITY_LTSES = 'https://unity3d.com/unity/qa/lts-releases'.freeze
109
111
  # URL for the patch releases for Windows and Macintosh
110
112
  UNITY_PATCHES = 'https://unity3d.com/unity/qa/patch-releases'.freeze
111
113
  # URL for the beta releases list, they need to be accessed after
@@ -220,23 +222,34 @@ module U3d
220
222
  end
221
223
  end
222
224
 
225
+ class VersionsFetcher
226
+ attr_accessor :versions
227
+
228
+ def initialize(pattern:)
229
+ @versions = {}
230
+ @pattern = pattern
231
+ end
232
+
233
+ def fetch_some(type, url)
234
+ UI.message "Loading Unity #{type} releases"
235
+ current = UnityVersions.fetch_version(url, @pattern)
236
+ UI.success "Found #{current.count} #{type} releases."
237
+ @versions.merge!(current)
238
+ end
239
+
240
+ def fetch_all_channels
241
+ fetch_some('lts', UNITY_LTSES)
242
+ fetch_some('stable', UNITY_DOWNLOADS)
243
+ fetch_some('patch', UNITY_PATCHES)
244
+ fetch_some('beta', UNITY_BETAS)
245
+ @versions
246
+ end
247
+ end
248
+
223
249
  class MacVersions
224
250
  class << self
225
251
  def list_available
226
- versions = {}
227
- UI.message 'Loading Unity releases'
228
- current = UnityVersions.fetch_version(UNITY_DOWNLOADS, MAC_DOWNLOAD)
229
- UI.success "Found #{current.count} releases." if current.count.nonzero?
230
- versions = versions.merge(current)
231
- UI.message 'Loading Unity patch releases'
232
- current = UnityVersions.fetch_version_paged(UNITY_PATCHES, MAC_DOWNLOAD)
233
- UI.success "Found #{current.count} patch releases." if current.count.nonzero?
234
- versions = versions.merge(current)
235
- UI.message 'Loading Unity beta releases'
236
- current = UnityVersions.fetch_betas(UNITY_BETAS, MAC_DOWNLOAD)
237
- UI.success "Found #{current.count} beta releases." if current.count.nonzero?
238
- versions = versions.merge(current)
239
- versions
252
+ VersionsFetcher.new(pattern: MAC_DOWNLOAD).fetch_all_channels
240
253
  end
241
254
  end
242
255
  end
@@ -244,20 +257,7 @@ module U3d
244
257
  class WindowsVersions
245
258
  class << self
246
259
  def list_available
247
- versions = {}
248
- UI.message 'Loading Unity releases'
249
- current = UnityVersions.fetch_version(UNITY_DOWNLOADS, WIN_DOWNLOAD)
250
- UI.success "Found #{current.count} releases." if current.count.nonzero?
251
- versions = versions.merge(current)
252
- UI.message 'Loading Unity patch releases'
253
- current = UnityVersions.fetch_version_paged(UNITY_PATCHES, WIN_DOWNLOAD)
254
- UI.success "Found #{current.count} patch releases." if current.count.nonzero?
255
- versions = versions.merge(current)
256
- UI.message 'Loading Unity beta releases'
257
- current = UnityVersions.fetch_betas(UNITY_BETAS, WIN_DOWNLOAD)
258
- UI.success "Found #{current.count} beta releases." if current.count.nonzero?
259
- versions = versions.merge(current)
260
- versions
260
+ VersionsFetcher.new(pattern: WIN_DOWNLOAD).fetch_all_channels
261
261
  end
262
262
  end
263
263
  end
data/lib/u3d/version.rb CHANGED
@@ -21,7 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  module U3d
24
- VERSION = '1.0.19'.freeze
24
+ VERSION = '1.0.20'.freeze
25
25
  DESCRIPTION = 'Provides numerous tools for installing, managing and running the Unity game engine from command line.'.freeze
26
26
  UNITY_VERSIONS_NOTE = "Unity uses the following version formatting: 0.0.0x0. The \'x\' can takes different values:\n"\
27
27
  "\t. 'f' are the main release candidates for Unity\n"\
data/lib/u3d.rb CHANGED
@@ -30,6 +30,7 @@ require 'u3d/commands'
30
30
  require 'u3d/commands_generator'
31
31
  require 'u3d/download_validator'
32
32
  require 'u3d/downloader'
33
+ require 'u3d/failure_reporter'
33
34
  require 'u3d/iniparser'
34
35
  require 'u3d/installation'
35
36
  require 'u3d/installer'
@@ -26,6 +26,21 @@ require 'colored'
26
26
 
27
27
  module U3dCore
28
28
  module Helper
29
+ DEFAULT_LINUX_PATH = File.join(ENV['HOME'], '.u3d').freeze
30
+ DEFAULT_MAC_PATH = File.join(ENV['HOME'], 'Library', 'Application Support', 'u3d').freeze
31
+ DEFAULT_WINDOWS_PATH = File.join(ENV['HOME'], 'AppData', 'Local', 'u3d').freeze
32
+
33
+ def self.data_path
34
+ case operating_system
35
+ when :linux
36
+ DEFAULT_LINUX_PATH
37
+ when :mac
38
+ DEFAULT_MAC_PATH
39
+ when :win
40
+ DEFAULT_WINDOWS_PATH
41
+ end
42
+ end
43
+
29
44
  # Runs a given command using backticks (`)
30
45
  # and prints them out using the UI.command method
31
46
  def self.backticks(command, print: true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: u3d
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.19
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerome Lacoste
@@ -379,6 +379,7 @@ files:
379
379
  - lib/u3d/compatibility.rb
380
380
  - lib/u3d/download_validator.rb
381
381
  - lib/u3d/downloader.rb
382
+ - lib/u3d/failure_reporter.rb
382
383
  - lib/u3d/iniparser.rb
383
384
  - lib/u3d/installation.rb
384
385
  - lib/u3d/installer.rb