u3d 1.0.9 → 1.0.10

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: 7ef51a1704cb01f95cc2ff2f66f90eb851c0010d
4
- data.tar.gz: 26d03be1911d01506a9aa0bab60caf1abd8cf07d
3
+ metadata.gz: 199952a8dafdb71e6f683bee1f99524fdf9fb4b1
4
+ data.tar.gz: fec612515c47bff5cac69eaeb6b02690f15d91ec
5
5
  SHA512:
6
- metadata.gz: 18d24c1137ce676f44354019fe449180038fde137cfdb6b7c8a94a4ce3639cf93ae2fda3d114c06ac97ef2d4579e26cf619f2658cf679d3ff9b3464faae72bff
7
- data.tar.gz: 8f2c047324246b81c7ac78325045d49bbb90d867c4c345b90687b36aa2e62c1a1f7c41ac16c18476806943ecc1c95ec9d2f36909ebb916771119a581e2c01d31
6
+ metadata.gz: 659ef44c9f876b8f20f7b7cf9deeb53fbde68b404e150483b547ecbeb0ecfc9783405e249531f123a4f4b1a02cee4a272b92b644e358dae7bfe6217ed57878c9
7
+ data.tar.gz: 4c3e390741a69b465b0d2298e158485203c319539989687989de6fba9e03039eb53ad5715949e76398d43514507d1d57c2159968a839ebea2b1e30a1a8393368
@@ -1,4 +1,4 @@
1
- future-release=v1.0.9
1
+ future-release=v1.0.10
2
2
  since-tag=v0.9
3
3
  exclude_tags_regex=v0\.[0-8]\..*
4
4
  exclude-labels=nochangelog
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.0.10](https://github.com/DragonBox/u3d/tree/v1.0.10) (2017-11-03)
4
+ [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.9...v1.0.10)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - u3d/download progress bar on Windows not going to 100% [\#164](https://github.com/DragonBox/u3d/issues/164)
9
+
10
+ **Closed issues:**
11
+
12
+ - u3d/install: confusing "-p not available on linux" message [\#181](https://github.com/DragonBox/u3d/issues/181)
13
+ - Linux CLI Activation in Unity \>= 5.4 [\#176](https://github.com/DragonBox/u3d/issues/176)
14
+ - u3d/install: already installed packages are reinstalled [\#161](https://github.com/DragonBox/u3d/issues/161)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - u3d/download/install: --all option was broken. Added tests [\#184](https://github.com/DragonBox/u3d/pull/184) ([lacostej](https://github.com/lacostej))
19
+ - u3d install: Improve Linux warnings for package options \(fixes \#181\) [\#183](https://github.com/DragonBox/u3d/pull/183) ([lacostej](https://github.com/lacostej))
20
+ - Fix log termination [\#180](https://github.com/DragonBox/u3d/pull/180) ([niezbop](https://github.com/niezbop))
21
+ - u3d/list find package names under PlaybackEngines ivy.xml [\#178](https://github.com/DragonBox/u3d/pull/178) ([lacostej](https://github.com/lacostej))
22
+ - u3d/downloader: print progress improvements \(fix \#164\) [\#177](https://github.com/DragonBox/u3d/pull/177) ([lacostej](https://github.com/lacostej))
23
+
3
24
  ## [v1.0.9](https://github.com/DragonBox/u3d/tree/v1.0.9) (2017-10-31)
4
25
  [Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.8...v1.0.9)
5
26
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (1.0.9)
4
+ u3d (1.0.10)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
7
  file-tail (>= 1.2.0)
@@ -118,6 +118,7 @@ GEM
118
118
 
119
119
  PLATFORMS
120
120
  ruby
121
+ x64-mingw32
121
122
  x86-mingw32
122
123
 
123
124
  DEPENDENCIES
@@ -61,7 +61,7 @@
61
61
  "fetched_line_pattern": "(?<message>.*)\\n",
62
62
  "fetched_line_message": false,
63
63
  "start_message": false,
64
- "end_pattern": "Filename: (?:[\\w/:]+/(?<file>\\w+\\.\\w+))? Line: (?<line>-?\\d+)",
64
+ "end_pattern": "Filename: (?:.+/(?<file>\\w+\\.\\w+))? Line: (?<line>-?\\d+)",
65
65
  "end_message": "[LOG] %{file}(line %{line}): %{message}"
66
66
  },
67
67
  "log_assertion": {
data/lib/u3d/commands.rb CHANGED
@@ -290,8 +290,8 @@ module U3d
290
290
 
291
291
  def packages_with_unity_first(os, options)
292
292
  if os == :linux
293
- UI.important 'Option -a | --all not available for Linux' if options[:all]
294
- UI.important 'Option -p | --packages not available for Linux' if options[:packages]
293
+ UI.important 'Option -a | --all currently meaningless for Linux (only one package available)' if options[:all]
294
+ UI.important 'Option -p | --packages currently meaningless for Linux (only one package available)' if options[:packages]
295
295
  end
296
296
  temp = options[:packages] || ['Unity']
297
297
  temp.insert(0, 'Unity') if temp.delete('Unity')
@@ -312,7 +312,10 @@ module U3d
312
312
  end
313
313
 
314
314
  def enforce_setup_coherence(packages, options, unity, definition)
315
- packages = definition.available_packages if options[:all]
315
+ if options[:all]
316
+ packages.clear
317
+ packages.concat(definition.available_packages)
318
+ end
316
319
  if unity
317
320
  UI.important "Unity #{unity.version} is already installed"
318
321
  # Not needed since Linux custom u3d files contain only one entry wich is Unity
@@ -46,6 +46,28 @@ module U3d
46
46
  end
47
47
  end
48
48
 
49
+ class PlaybackEngineUtils
50
+ def self.list_module_configs(playbackengine_parent_path)
51
+ Dir.glob("#{playbackengine_parent_path}/PlaybackEngines/*/ivy.xml")
52
+ end
53
+
54
+ def self.node_value(config_path, node_name)
55
+ require 'rexml/document'
56
+ UI.verbose("reading #{config_path}")
57
+ raise "File not found at #{config_path}" unless File.exist? config_path
58
+ doc = REXML::Document.new(File.read(config_path))
59
+ REXML::XPath.first(doc, node_name).value
60
+ end
61
+
62
+ def self.module_name(config_path)
63
+ node_value(config_path, 'ivy-module/info/@module')
64
+ end
65
+
66
+ def self.unity_version(config_path)
67
+ node_value(config_path, 'ivy-module/info/@e:unityVersion')
68
+ end
69
+ end
70
+
49
71
  class MacInstallation < Installation
50
72
  require 'plist'
51
73
 
@@ -68,13 +90,9 @@ module U3d
68
90
  end
69
91
 
70
92
  def packages
71
- if Utils.parse_unity_version(version)[0].to_i <= 4
72
- # Unity < 5 doesn't have packages
73
- return []
93
+ PlaybackEngineUtils.list_module_configs(root_path).map do |mpath|
94
+ PlaybackEngineUtils.module_name(mpath)
74
95
  end
75
- fpath = File.expand_path('PlaybackEngines', root_path)
76
- return [] unless Dir.exist? fpath # install without package
77
- Dir.entries(fpath).select { |e| File.directory?(File.join(fpath, e)) && !(e == '.' || e == '..') }
78
96
  end
79
97
 
80
98
  def clean_install?
@@ -96,11 +114,10 @@ module U3d
96
114
  class LinuxInstallation < Installation
97
115
  def version
98
116
  # I don't find an easy way to extract the version on Linux
99
- require 'rexml/document'
100
- fpath = "#{root_path}/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/ivy.xml"
101
- raise "Couldn't find file #{fpath}" unless File.exist? fpath
102
- doc = REXML::Document.new(File.read(fpath))
103
- version = REXML::XPath.first(doc, 'ivy-module/info/@e:unityVersion').value
117
+ path = "#{root_path}/Editor/Data/"
118
+ package = PlaybackEngineUtils.list_module_configs(path).first
119
+ raise "Couldn't find a module under #{path}" unless package
120
+ version = PlaybackEngineUtils.unity_version(package)
104
121
  if (m = version.match(/^(.*)x(.*)Linux$/))
105
122
  version = "#{m[1]}#{m[2]}"
106
123
  end
@@ -131,16 +148,10 @@ module U3d
131
148
 
132
149
  class WindowsInstallation < Installation
133
150
  def version
134
- require 'rexml/document'
135
- # For versions >= 5
136
- fpath = "#{root_path}/Editor/Data/PlaybackEngines/windowsstandalonesupport/ivy.xml"
137
- # For versions < 5
138
- fpath = "#{root_path}/Editor/Data/PlaybackEngines/wp8support/ivy.xml" unless File.exist? fpath
139
- raise "Couldn't find file #{fpath}" unless File.exist? fpath
140
- doc = REXML::Document.new(File.read(fpath))
141
- version = REXML::XPath.first(doc, 'ivy-module/info/@e:unityVersion').value
142
-
143
- version
151
+ path = "#{root_path}/Editor/Data/"
152
+ package = PlaybackEngineUtils.list_module_configs(path).first
153
+ raise "Couldn't find a module under #{path}" unless package
154
+ PlaybackEngineUtils.unity_version(package)
144
155
  end
145
156
 
146
157
  def default_log_file
@@ -167,11 +178,10 @@ module U3d
167
178
  end
168
179
 
169
180
  def packages
170
- # Unity prior to Unity5 did not have package
171
- return [] if Utils.parse_unity_version(version)[0].to_i <= 4
172
- fpath = "#{root_path}/Editor/Data/PlaybackEngines/"
173
- return [] unless Dir.exist? fpath # install without package
174
- Dir.entries(fpath).select { |e| File.directory?(File.join(fpath, e)) && !(e == '.' || e == '..') }
181
+ path = "#{root_path}/Editor/Data/"
182
+ PlaybackEngineUtils.list_module_configs(path).map do |mpath|
183
+ PlaybackEngineUtils.module_name(mpath)
184
+ end
175
185
  end
176
186
 
177
187
  def clean_install?
@@ -78,7 +78,7 @@ module U3d
78
78
  @phases.each do |name, phase|
79
79
  next if name == @active_phase
80
80
  next unless line =~ phase['phase_start_pattern']
81
- finish_phase
81
+ finish_phase if @active_phase
82
82
  @active_phase = name
83
83
  UI.verbose("--- Beginning #{name} phase ---")
84
84
  break
data/lib/u3d/utils.rb CHANGED
@@ -59,6 +59,7 @@ module U3d
59
59
  end
60
60
  end
61
61
 
62
+ # size a hint of the expected size
62
63
  def download_file(path, url, size: nil)
63
64
  File.open(path, 'wb') do |f|
64
65
  uri = URI(url)
@@ -69,7 +70,9 @@ module U3d
69
70
  request = Net::HTTP::Get.new uri
70
71
  http.request request do |response|
71
72
  begin
72
- size ||= Integer(response['Content-Length'])
73
+ # override with actual results, this should help with
74
+ # innacurrate declared sizes, especially on Windows platform
75
+ size = Integer(response['Content-Length'])
73
76
  rescue ArgumentError
74
77
  UI.verbose 'Unable to get length of file in download'
75
78
  end
@@ -81,13 +84,12 @@ module U3d
81
84
  # FIXME revisits, this slows down download on fast network
82
85
  # sleep 0.08 # adjust to reduce CPU
83
86
  next unless print_progress
84
- next unless Time.now.to_f - last_print_update > 0.5
87
+ print_progress_now = Time.now.to_f - last_print_update > 0.5
88
+ # force printing when done downloading
89
+ print_progress_now = true if !print_progress_now && size && current >= size
90
+ next unless print_progress_now
85
91
  last_print_update = Time.now.to_f
86
- if size
87
- Utils.print_progress(current, size, started_at)
88
- else
89
- Utils.print_progress_nosize(current, started_at)
90
- end
92
+ Utils.print_progress(current, size, started_at)
91
93
  print "\n" unless UI.interactive?
92
94
  end
93
95
  end
@@ -122,7 +124,12 @@ module U3d
122
124
  FileUtils.mkpath(dir) unless File.directory?(dir)
123
125
  end
124
126
 
127
+ # if total is nil (unknown, falls back to print_progress_nosize)
125
128
  def print_progress(current, total, started_at)
129
+ if total.nil?
130
+ print_progress_nosize(current, started_at)
131
+ return
132
+ end
126
133
  ratio = [current.to_f / total, 1.0].min
127
134
  percent = (ratio * 100.0).round(1)
128
135
  arrow = (ratio * 20.0).floor
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.9'.freeze
24
+ VERSION = '1.0.10'.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: 1.0.9
4
+ version: 1.0.10
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-10-31 00:00:00.000000000 Z
12
+ date: 2017-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander