u3d 0.9.1 → 0.9.2

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: 0d95e2013ede0bbc2672fbdac7ec3e4438dbb905
4
- data.tar.gz: e3e5cf65083bb3c2ac16755603c2efa23203b766
3
+ metadata.gz: 5fa90ce7799123f17d7760705c0e678a9c24a057
4
+ data.tar.gz: 973b34ba000a634b8bcf544de1a4b6ede5bc7553
5
5
  SHA512:
6
- metadata.gz: 3fa4705df6c50c805cef1e3dc01b92f18a071f4077118678df9880af59b51db767685545734f7948b21fe052918b6ae4fb82b1fad68fbd3e21d3b7bcc91806db
7
- data.tar.gz: fdde9cf62e21bce06e5af03a72c5145f803cf006e1215d11b244401a9509d517d5dd9186ac9e5453c14a8b3f1f442008a207691aa72fa6cafe68872a99226235
6
+ metadata.gz: 5bd4042294072a4a90f70dfe7287e0eb5c0ef6a9151fcc42bf477873c8bc21e0118d3b1123013584f8f32dc3daaa2d415c3a2ede586665b469202adc75092ff4
7
+ data.tar.gz: 1ee8b5bdf89fa4ef179794516d9943fb64d5bd3b29cedaf11de91a81ace1b1dc133ca146cdf7bdd06fad13988aae8f4420220a298d0c21048cc1c553e9f144ca
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (0.9.1)
4
+ u3d (0.9.2)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
7
  file-tail (>= 1.2.0)
@@ -27,7 +27,7 @@ Therefore, our log prettifier behaves in a phased fashion. It has an inner memor
27
27
 
28
28
  A phase is started when a given pattern is encountered in the logs, and ends in two different ways: either a terminating pattern is met, or another phase starts.
29
29
 
30
- Because there are rules that you may want to apply throughout the whole analysis, there is a peculiar phase: the 'GENERAL' one. It contains a generic set of rules which will be applied in parallel to the active phase's ruleset, and allows for not having to repeat rules in different phases. The main use which this phase was designed for is to catch exceptions, warnings and errors no matter the active phase, but it is obviously not limited to that.
30
+ Because there are rules that you may want to apply throughout the whole analysis, there is a peculiar phase: the 'GENERAL' one. It contains a generic set of rules which will be applied in parallel to the active phase's ruleset, and allows for not having to repeat rules in different phases. The main use which this phase was designed for is exceptions catching, warnings and errors no matter the active phase, but it is obviously not limited to that.
31
31
 
32
32
  ### B - Phase syntax
33
33
 
@@ -53,15 +53,15 @@ The syntax of phases is as follows:
53
53
  * __[OPTIONAL]__ `phase_end_pattern`: this patterns specifies when the phase should end. It is optional because a phase will also end when another one begins, as stated in II A. This is used when you know exactly when the phase has finished.
54
54
  * `rules`: contains a set of rules. See III for further information on rule declaration.
55
55
 
56
- ## Rules
56
+ ## III - Rules
57
57
 
58
58
  ### A - Rule declaration
59
59
 
60
60
  The information contained in Unity's log can be formatted differently: it can be contained in a single line, spread on several, the lines can contain exactly what you want or be way too verbose for your liking.
61
61
 
62
- In consequence, the rule syntax is pretty loose to cover as many cases as possible, and below is describe syntax for some of archetypal rules.
62
+ In consequence, the rule syntax is pretty loose to cover as many cases as possible, and below is describe syntax for some archetypal rules.
63
63
 
64
- They contain nonetheless two mandatory sections and a recurring one:
64
+ They contain nonetheless two mandatory sections:
65
65
 
66
66
  ```json
67
67
  "rule_name": {
@@ -86,6 +86,7 @@ This example rule extracts the line stating whether the asset database has succe
86
86
  ### C - One line parsing with data extraction
87
87
 
88
88
  When the line formatting does not suit your needs, you may want to process it rather than simply logging it. Here is an example which occurs at the beginning of the compile phase:
89
+
89
90
  ```json
90
91
  "target": {
91
92
  "active": true,
@@ -97,7 +98,8 @@ Simple rewording of the base log, by extracting the meaningful information and p
97
98
 
98
99
  ### D - Multi-line parsing and displaying
99
100
 
100
- The following rule illustrates when you want to log a chunk of lines as they appear in Unity at the same time. This structure is useful when you know exactly where the block begins and end. If not, please check section F.
101
+ The following rule illustrates when you want to log a chunk of lines as they appear in Unity at the same time. This structure is useful when you know exactly where the block begins and ends. If not, please check section F.
102
+
101
103
  ```json
102
104
  "percentage": {
103
105
  "active": true,
@@ -106,11 +108,12 @@ The following rule illustrates when you want to log a chunk of lines as they app
106
108
  "store_lines": true
107
109
  }
108
110
  ```
109
- `start_pattern` and `end_pattern` are the limits in between which the lines will be parsed. `store_lines` indicates that we want these lines stored, and displayed later.
111
+ `start_pattern` and `end_pattern` are the limits in between which the lines will be parsed. `store_lines` indicates that we want these lines stored, and displayed later on.
110
112
 
111
113
  ### E - Multi-line parsing and displaying with line filtering and data extraction
112
114
 
113
115
  This example illustrates several additional functionalities in comparison to the previous sections.
116
+
114
117
  ```json
115
118
  "fail": {
116
119
  "active": true,
@@ -134,7 +137,8 @@ _Note_: this is a modified version of the actual rule, for example purposes.
134
137
 
135
138
  ### F - Multi-line with no clear entry point (memory fetching)
136
139
 
137
- This section illustrates how a rule will fetch lines from the previously logged lines. It is used when you want to log several lines, but the fixed point is not at the beginning of the block.
140
+ This section illustrates how a rule will fetch lines from the previously logged lines. It is used when you want to log several lines, but the fixed 'entry point' is not at the beginning of the block.
141
+
138
142
  ```json
139
143
  "log": {
140
144
  "active": true,
@@ -157,6 +161,7 @@ This previous rule is used to keep tracks of the Debug.Log messages. Because the
157
161
  ### G - Logging color code
158
162
 
159
163
  You can specify the color of the message created by your rules by specifying a type:
164
+
160
165
  ```json
161
166
  "target": {
162
167
  "active": true,
@@ -164,7 +169,7 @@ You can specify the color of the message created by your rules by specifying a t
164
169
  }
165
170
  ```
166
171
  It will output it differently based on this type. Correct types are:
167
- * __[DEFAULT]__ `message`: normal logging
172
+ * `message`: normal logging __[DEFAULT]__
168
173
  * `warning`: yellow
169
- * `error`: red
174
+ * `error` : red
170
175
  * `success`: green
data/README.md CHANGED
@@ -24,9 +24,11 @@ U3d provides help for running and installing unity from CLI. Available commands
24
24
 
25
25
  ![u3d run](https://github.com/DragonBox/u3d/raw/master/docs/assets/u3d_run.png)
26
26
 
27
- * `u3d prettify`: Prettify a saved logfile
27
+ The prettifyer is on by default but can be turned off to get Unity3d's raw output.
28
28
 
29
- (see above :))
29
+ * `u3d prettify`: Prettify a saved editor logfile
30
+
31
+ [Information on how `prettify` works](https://github.com/DragonBox/u3d/blob/master/LOG_RULES.md)
30
32
 
31
33
  ## Installation
32
34
 
data/TODO.md CHANGED
@@ -5,10 +5,6 @@
5
5
  = post
6
6
  * patch commander to support argument descriptions
7
7
 
8
- * bug: installer shouldn't ask to rename directory of current Unity install if more packages are coming
9
-
10
- * feature to clear credentials
11
-
12
8
  * u3d specific keychain (u3d_credentials_store)
13
9
 
14
10
  * if failure to download a package, display available ones
@@ -2,3 +2,7 @@ desc "Run the EditorRun.Build task"
2
2
  lane :u3d_build do |options|
3
3
  u3d(raw_logs: options[:raw_logs], run_args: "-logFile './editor.log' -executeMethod U3d.EditorRun.Build -quit -batchmode")
4
4
  end
5
+
6
+ lane :u3d_build2 do |options|
7
+ u3d(raw_logs: options[:raw_logs], run_args: "-logFile '/dev/stdout' -executeMethod U3d.EditorRun.Build -quit -batchmode")
8
+ end
@@ -26,6 +26,7 @@ require 'u3d/installer'
26
26
  require 'u3d/cache'
27
27
  require 'u3d/utils'
28
28
  require 'u3d/log_analyzer'
29
+ require 'u3d/unity_runner'
29
30
  require 'u3d_core/command_executor'
30
31
  require 'u3d_core/credentials'
31
32
  require 'fileutils'
@@ -40,7 +41,14 @@ module U3d
40
41
  UI.important 'No Unity version installed'
41
42
  return
42
43
  end
43
- list.each do |u|
44
+ # version -> installations
45
+ arraym = list.map{|a| [a.version, a]}
46
+ map = Hash[*arraym.flatten]
47
+ # sorted versions
48
+ vcomparators = map.keys.map { |k| UnityVersionComparator.new(k) }
49
+ sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
50
+ sorted_keys.each do |k|
51
+ u = map[k]
44
52
  UI.message "Version #{u.version}\t(#{u.path})"
45
53
  packages = u.packages
46
54
  next unless options[:packages] && packages && !packages.empty?
@@ -139,10 +147,7 @@ module U3d
139
147
  end
140
148
 
141
149
  return if options[:no_install]
142
- files.each do |name, file, info|
143
- UI.verbose "Installing #{name}#{info['mandatory'] ? ' (mandatory package)' : ''}, with file #{file}"
144
- Installer.install_module(file, version, installation_path: options[:installation_path], info: info)
145
- end
150
+ Installer.install_modules(files, version, installation_path: options[:installation_path])
146
151
  end
147
152
 
148
153
  def local_install(args: [], options: {})
@@ -182,10 +187,7 @@ module U3d
182
187
  end
183
188
  end
184
189
 
185
- files.each do |name, file, info|
186
- UI.verbose "Installing #{name}#{info['mandatory'] ? ' (mandatory package)' : ''}, with file #{file}"
187
- Installer.install_module(file, version, installation_path: options[:installation_path], info: info)
188
- end
190
+ Installer.install_modules(files, version, installation_path: options[:installation_path])
189
191
  end
190
192
 
191
193
  def run(options: {}, run_args: [])
@@ -159,77 +159,6 @@ module U3d
159
159
  end
160
160
  end
161
161
 
162
- class Runner
163
- def run(installation, args, raw_logs: false)
164
- require 'fileutils'
165
-
166
- log_file = find_logFile_in_args(args)
167
-
168
- if log_file # we wouldn't want to do that for the default log file.
169
- File.delete(log_file) if File.exist?(log_file)
170
- else
171
- log_file = installation.default_log_file
172
- end
173
-
174
- FileUtils.touch(log_file)
175
-
176
- tail_thread = Thread.new do
177
- begin
178
- if raw_logs
179
- pipe(log_file) { |l| UI.message l.rstrip }
180
- else
181
- analyzer = LogAnalyzer.new
182
- pipe(log_file) { |l| analyzer.parse_line l }
183
- end
184
- rescue => e
185
- UI.error "Failure while trying to pipe #{log_file}: #{e.message}"
186
- e.backtrace.each { |l| UI.error " #{l}" }
187
- end
188
- end
189
-
190
- begin
191
- args.unshift(installation.exe_path)
192
- if Helper.windows?
193
- args.map! { |a| a =~ / / ? "\"#{a}\"" : a }
194
- else
195
- args.map!(&:shellescape)
196
- end
197
- U3dCore::CommandExecutor.execute(command: args)
198
- ensure
199
- sleep 0.5
200
- Thread.kill(tail_thread)
201
- end
202
- end
203
-
204
- def find_logFile_in_args(args)
205
- find_arg_in_args('-logFile', args)
206
- end
207
-
208
- def find_projectpath_in_args(args)
209
- find_arg_in_args('-projectpath', args)
210
- end
211
-
212
- def find_arg_in_args(arg_to_find, args)
213
- raise 'Only arguments of type array supported right now' unless args.is_a?(Array)
214
- args.each_with_index do |arg, index|
215
- return args[index + 1] if arg == arg_to_find && index < args.count - 1
216
- end
217
- nil
218
- end
219
-
220
- private
221
-
222
- def pipe(file)
223
- File.open(file, 'r') do |f|
224
- f.extend File::Tail
225
- f.interval = 0.1
226
- f.max_interval = 0.4
227
- f.backward 100
228
- f.tail { |l| yield l }
229
- end
230
- end
231
- end
232
-
233
162
  class Installer
234
163
  def self.create
235
164
  installer = if Helper.mac?
@@ -249,30 +178,11 @@ module U3d
249
178
  installer
250
179
  end
251
180
 
252
- def self.install_module(file_path, version, installation_path: nil, info: {})
253
- extension = File.extname(file_path)
254
- if extension == '.pkg'
255
- path = installation_path || DEFAULT_MAC_INSTALL
256
- MacInstaller.install_pkg(
257
- file_path,
258
- version: version,
259
- target_path: path
260
- )
261
- elsif extension == '.exe'
262
- path = installation_path || File.join(DEFAULT_WINDOWS_INSTALL, UNITY_DIR % version)
263
- WindowsInstaller.install_exe(
264
- file_path,
265
- installation_path: path,
266
- info: info
267
- )
268
- elsif extension == '.sh'
269
- path = installation_path || File.join(DEFAULT_LINUX_INSTALL, UNITY_DIR % version)
270
- LinuxInstaller.install_sh(
271
- file_path,
272
- installation_path: path
273
- )
274
- else
275
- raise "File type #{extension} not yet supported"
181
+ def self.install_modules(files, version, installation_path: nil)
182
+ installer = Installer.create
183
+ files.each do |name, file, info|
184
+ UI.verbose "Installing #{name}#{info['mandatory'] ? ' (mandatory package)' : ''}, with file #{file}"
185
+ installer.install(file, version, installation_path: installation_path, info: info)
276
186
  end
277
187
  end
278
188
  end
@@ -310,10 +220,21 @@ module U3d
310
220
  versions.sort! { |x, y| x.version <=> y.version }
311
221
  end
312
222
 
313
- def self.install_pkg(file_path, version: nil, target_path: nil)
223
+ def install(file_path, version, installation_path: nil, info: {})
224
+ extension = File.extname(file_path)
225
+ raise "Installation of #{extension} files is not supported on Mac" if extension != '.pkg'
226
+ path = installation_path || DEFAULT_MAC_INSTALL
227
+ install_pkg(
228
+ file_path,
229
+ version: version,
230
+ target_path: path
231
+ )
232
+ end
233
+
234
+ def install_pkg(file_path, version: nil, target_path: nil)
314
235
  target_path ||= DEFAULT_MAC_INSTALL
315
236
  command = "installer -pkg #{file_path.shellescape} -target #{target_path.shellescape}"
316
- unity = Installer.create.installed.find { |u| u.version == version }
237
+ unity = installed.find { |u| u.version == version }
317
238
  if unity.nil?
318
239
  UI.verbose "No Unity install for version #{version} was found"
319
240
  U3dCore::CommandExecutor.execute(command: command, admin: true)
@@ -361,7 +282,17 @@ module U3d
361
282
  versions.sort! { |x, y| x.version <=> y.version }
362
283
  end
363
284
 
364
- def self.install_sh(file, installation_path: nil)
285
+ def install(file_path, version, installation_path: nil, info: {})
286
+ extension = File.extname(file_path)
287
+ raise "Installation of #{extension} files is not supported on Linux" if extension != '.sh'
288
+ path = installation_path || File.join(DEFAULT_LINUX_INSTALL, UNITY_DIR % version)
289
+ install_sh(
290
+ file_path,
291
+ installation_path: path
292
+ )
293
+ end
294
+
295
+ def install_sh(file, installation_path: nil)
365
296
  cmd = file.shellescape
366
297
  if installation_path
367
298
  Utils.ensure_dir(installation_path)
@@ -401,7 +332,18 @@ module U3d
401
332
  versions.sort! { |x, y| x.version <=> y.version }
402
333
  end
403
334
 
404
- def self.install_exe(file_path, installation_path: nil, info: {})
335
+ def install(file_path, version, installation_path: nil, info: {})
336
+ extension = File.extname(file_path)
337
+ raise "Installation of #{extension} files is not supported on Windows" if extension != '.exe'
338
+ path = installation_path || File.join(DEFAULT_WINDOWS_INSTALL, UNITY_DIR % version)
339
+ install_exe(
340
+ file_path,
341
+ installation_path: path,
342
+ info: info
343
+ )
344
+ end
345
+
346
+ def install_exe(file_path, installation_path: nil, info: {})
405
347
  installation_path ||= DEFAULT_WINDOWS_INSTALL
406
348
  final_path = installation_path.tr('/', '\\')
407
349
  Utils.ensure_dir(final_path)
@@ -107,7 +107,7 @@ module U3d
107
107
  if rule['end_message']
108
108
  match = line.match(pattern)
109
109
  params = match.names.map(&:to_sym).zip(match.captures).to_h
110
- message = rule['end_message'] % params.merge(@context)
110
+ message = inject(rule['end_message'], params: params)
111
111
  else
112
112
  message = line.chomp
113
113
  end
@@ -165,7 +165,7 @@ module U3d
165
165
  end
166
166
  if r['fetched_line_message'] != false
167
167
  message = if r['fetched_line_message']
168
- r['fetched_line_message'] % @context
168
+ inject(r['fetched_line_message'])
169
169
  else
170
170
  fetched_line.chomp
171
171
  end
@@ -176,7 +176,7 @@ module U3d
176
176
  end
177
177
  if r['start_message'] != false
178
178
  message = if r['start_message']
179
- r['start_message'] % @context
179
+ inject(r['start_message'])
180
180
  else
181
181
  line.chomp
182
182
  end
@@ -194,6 +194,16 @@ module U3d
194
194
 
195
195
  private
196
196
 
197
+ def inject(string, params: {})
198
+ message = "This is a default message."
199
+ begin
200
+ message = string % params.merge(@context)
201
+ rescue KeyError => e
202
+ UI.error("[U3D] Rule #{@active_rule} captures were incomplete: #{e.message}")
203
+ end
204
+ message
205
+ end
206
+
197
207
  def parse_rule(r)
198
208
  return false unless r['active']
199
209
  return false if r['start_pattern'].nil?
@@ -0,0 +1,103 @@
1
+ ## --- BEGIN LICENSE BLOCK ---
2
+ # Copyright (c) 2016-present WeWantToKnow AS
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ # SOFTWARE.
21
+ ## --- END LICENSE BLOCK ---
22
+
23
+ require 'u3d/utils'
24
+ require 'fileutils'
25
+ require 'file-tail'
26
+
27
+ module U3d
28
+ # Launches Unity with given arguments
29
+ class Runner
30
+ def run(installation, args, raw_logs: false)
31
+ log_file = find_logFile_in_args(args)
32
+
33
+ if log_file # we wouldn't want to do that for the default log file.
34
+ File.delete(log_file) if File.file?(log_file) # We only delete real files
35
+ else
36
+ log_file = installation.default_log_file
37
+ end
38
+
39
+ FileUtils.touch(log_file) unless File.exist? log_file
40
+
41
+ tail_thread = Thread.new do
42
+ begin
43
+ if raw_logs
44
+ pipe(log_file) { |l| UI.message l.rstrip }
45
+ else
46
+ analyzer = LogAnalyzer.new
47
+ pipe(log_file) { |l| analyzer.parse_line l }
48
+ end
49
+ rescue => e
50
+ UI.error "Failure while trying to pipe #{log_file}: #{e.message}"
51
+ e.backtrace.each { |l| UI.error " #{l}" }
52
+ end
53
+ end
54
+
55
+ # Wait for tail_thread setup to be complete
56
+ sleep 0.5 while tail_thread.status!='sleep'
57
+ tail_thread.run
58
+
59
+ begin
60
+ args.unshift(installation.exe_path)
61
+ if Helper.windows?
62
+ args.map! { |a| a =~ / / ? "\"#{a}\"" : a }
63
+ else
64
+ args.map!(&:shellescape)
65
+ end
66
+ # FIXME return value not handled
67
+ U3dCore::CommandExecutor.execute(command: args, print_all: true)
68
+ ensure
69
+ sleep 1
70
+ Thread.kill(tail_thread)
71
+ end
72
+ end
73
+
74
+ def find_logFile_in_args(args)
75
+ find_arg_in_args('-logFile', args)
76
+ end
77
+
78
+ def find_projectpath_in_args(args)
79
+ find_arg_in_args('-projectpath', args)
80
+ end
81
+
82
+ def find_arg_in_args(arg_to_find, args)
83
+ raise 'Only arguments of type array supported right now' unless args.is_a?(Array)
84
+ args.each_with_index do |arg, index|
85
+ return args[index + 1] if arg == arg_to_find && index < args.count - 1
86
+ end
87
+ nil
88
+ end
89
+
90
+ private
91
+
92
+ def pipe(file)
93
+ File.open(file, 'r') do |f|
94
+ f.extend File::Tail
95
+ f.interval = 0.1
96
+ f.max_interval = 0.4
97
+ f.backward 0
98
+ Thread.stop
99
+ f.tail { |l| yield l }
100
+ end
101
+ end
102
+ end
103
+ end
@@ -47,7 +47,9 @@ module U3d
47
47
  # Captures a version and its base url
48
48
  MAC_DOWNLOAD = %r{"(https?://[\w/\.-]+/[0-9a-f]{12}/)MacEditorInstaller/[a-zA-Z0-9/\.]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"}
49
49
  WIN_DOWNLOAD = %r{"(https?://[\w/\.-]+/[0-9a-f]{12}/)Windows..EditorInstaller/[a-zA-Z0-9/\.]+-(\d+\.\d+\.\d+\w\d+)\.?\w+"}
50
- LINUX_DOWNLOAD = %r{"(https?://[\w/\._-]+/unity\-editor\-installer\-(\d+\.\d+\.\d+\w\d+).*\.sh)"}
50
+ LINUX_DOWNLOAD_DATED = %r{"(https?://[\w/\._-]+/unity\-editor\-installer\-(\d+\.\d+\.\d+\w\d+).*\.sh)"}
51
+ LINUX_DOWNLOAD_RECENT_PAGE = %r{"(http://beta\.unity3d\.com/download/[a-zA-Z0-9/\.]+/public_download\.html)"}
52
+ LINUX_DOWNLOAD_RECENT_FILE = %r{'(https?://beta\.unity3d\.com/download/[a-zA-Z0-9/\.]+/unity\-editor\-installer\-(\d+\.\d+\.\d+(?:x)?\w\d+).*\.sh)'}
51
53
  # Captures a beta version in html page
52
54
  UNITY_BETAVERSION_REGEX = %r{\/unity\/beta\/unity(\d+\.\d+\.\d+\w\d+)"}
53
55
  UNITY_EXTRA_DOWNLOAD_REGEX = %r{"(https?:\/\/[\w\/.-]+\.unity3d\.com\/(\w+))\/[a-zA-Z\/.-]+\/download.html"}
@@ -148,10 +150,30 @@ module U3d
148
150
  end
149
151
  data.gsub(/[ \t]+/, '').each_line { |l| puts l if /<a href=/ =~ l }
150
152
  versions = {}
151
- results = data.scan(LINUX_DOWNLOAD)
153
+ results = data.scan(LINUX_DOWNLOAD_DATED)
152
154
  results.each do |capt|
153
155
  versions[capt[1]] = capt[0]
154
156
  end
157
+
158
+ results = data.scan(LINUX_DOWNLOAD_RECENT_PAGE)
159
+ results.each do |page|
160
+ url = page[0]
161
+ uri = URI(url)
162
+ Net::HTTP.start(uri.host, uri.port) do |http|
163
+ request = Net::HTTP::Get.new uri
164
+ response = http.request request
165
+ end
166
+ if response.kind_of? Net::HTTPSuccess
167
+ capt = response.body.match(LINUX_DOWNLOAD_RECENT_FILE)
168
+ if capt && capt[1] && capt[2]
169
+ versions[capt[2].gsub(/x/, '')] = capt[1]
170
+ else
171
+ UI.error("Could not retrieve a fitting file from #{url}")
172
+ end
173
+ else
174
+ UI.error("Could not access #{url}")
175
+ end
176
+ end
155
177
  if versions.count.zero?
156
178
  UI.important 'Found no releases'
157
179
  else
@@ -21,7 +21,7 @@
21
21
  ## --- END LICENSE BLOCK ---
22
22
 
23
23
  module U3d
24
- VERSION = '0.9.1'.freeze
24
+ VERSION = '0.9.2'.freeze
25
25
  DESCRIPTION = 'Provides numerous tools for installing, managing and running the Unity3D game engine from command line.'.freeze
26
26
  UNITY_VERSIONS_NOTE = "Unity3d 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 Unity3d\n"\
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: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerome Lacoste
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-07-24 00:00:00.000000000 Z
12
+ date: 2017-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
@@ -348,6 +348,7 @@ files:
348
348
  - lib/u3d/iniparser.rb
349
349
  - lib/u3d/installer.rb
350
350
  - lib/u3d/log_analyzer.rb
351
+ - lib/u3d/unity_runner.rb
351
352
  - lib/u3d/unity_version_number.rb
352
353
  - lib/u3d/unity_versions.rb
353
354
  - lib/u3d/utils.rb