u3d 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/Gemfile.lock +1 -1
- data/lib/u3d/commands.rb +33 -15
- data/lib/u3d/downloader.rb +5 -0
- data/lib/u3d/installer.rb +31 -10
- data/lib/u3d/unity_runner.rb +3 -2
- data/lib/u3d/unity_versions.rb +1 -1
- data/lib/u3d/version.rb +1 -1
- data/lib/u3d_core/command_executor.rb +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43c7834c3f3b774506971cb0cb9d30fa947a9084
|
4
|
+
data.tar.gz: 15a1b29791c19f11fd8d301dc94d43f2129bceb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a394c25724713e499cddf74a03fd3054ef20ed65384242afc490790b6aa63ac8928d92a87f75399317a94cb67284d17a5b1974885ed26d1420dcb913b7ff1b71
|
7
|
+
data.tar.gz: 60acfb2ade3034640bb195466a5b6315844f10ff13818a31fabd71e1782a9253bc673482c93a2edc4f7f128891d58fd15df71ab6d4888598f1d45eec23e37a63
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.9.2](https://github.com/DragonBox/u3d/tree/v0.9.2) (2017-08-04)
|
4
|
+
[Full Changelog](https://github.com/DragonBox/u3d/compare/v0.9.1...v0.9.2)
|
5
|
+
|
6
|
+
**Fixed bugs:**
|
7
|
+
|
8
|
+
- Fix missing key failure [\#13](https://github.com/DragonBox/u3d/pull/13) ([niezbop](https://github.com/niezbop))
|
9
|
+
|
10
|
+
**Closed issues:**
|
11
|
+
|
12
|
+
- -logFile /dev/stdout not supported [\#11](https://github.com/DragonBox/u3d/issues/11)
|
13
|
+
- Do you have any relevant documents? [\#7](https://github.com/DragonBox/u3d/issues/7)
|
14
|
+
- rspec broken on linux [\#5](https://github.com/DragonBox/u3d/issues/5)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Better support for /dev/stdout \(\#11\) [\#17](https://github.com/DragonBox/u3d/pull/17) ([lacostej](https://github.com/lacostej))
|
19
|
+
- u3d/list: sort versions [\#16](https://github.com/DragonBox/u3d/pull/16) ([lacostej](https://github.com/lacostej))
|
20
|
+
- Fix tail logs synchronization [\#12](https://github.com/DragonBox/u3d/pull/12) ([niezbop](https://github.com/niezbop))
|
21
|
+
- Various test fixes, including linux rspec support, and a regression [\#9](https://github.com/DragonBox/u3d/pull/9) ([lacostej](https://github.com/lacostej))
|
22
|
+
- specs: ensure test pass on Linux [\#8](https://github.com/DragonBox/u3d/pull/8) ([lacostej](https://github.com/lacostej))
|
23
|
+
- Linux versions fix [\#6](https://github.com/DragonBox/u3d/pull/6) ([niezbop](https://github.com/niezbop))
|
24
|
+
- Document further the prettifier [\#1](https://github.com/DragonBox/u3d/pull/1) ([lacostej](https://github.com/lacostej))
|
25
|
+
|
26
|
+
## [v0.9.1](https://github.com/DragonBox/u3d/tree/v0.9.1) (2017-07-24)
|
27
|
+
[Full Changelog](https://github.com/DragonBox/u3d/compare/v0.9...v0.9.1)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile.lock
CHANGED
data/lib/u3d/commands.rb
CHANGED
@@ -42,14 +42,14 @@ module U3d
|
|
42
42
|
return
|
43
43
|
end
|
44
44
|
# version -> installations
|
45
|
-
arraym = list.map{|a| [a.version, a]}
|
45
|
+
arraym = list.map { |a| [a.version, a] }
|
46
46
|
map = Hash[*arraym.flatten]
|
47
47
|
# sorted versions
|
48
48
|
vcomparators = map.keys.map { |k| UnityVersionComparator.new(k) }
|
49
49
|
sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
|
50
50
|
sorted_keys.each do |k|
|
51
51
|
u = map[k]
|
52
|
-
UI.message "Version #{u.version}
|
52
|
+
UI.message "%-*s%s" % [30, "Version #{u.version}", " (#{u.path})"]
|
53
53
|
packages = u.packages
|
54
54
|
next unless options[:packages] && packages && !packages.empty?
|
55
55
|
UI.message 'Packages:'
|
@@ -114,11 +114,8 @@ module U3d
|
|
114
114
|
versions = cache[os.id2name]['versions']
|
115
115
|
version = interpret_latest(version, versions)
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
return unless unity
|
120
|
-
options[:installation_path] ||= unity.path if Helper.windows?
|
121
|
-
end
|
117
|
+
unity = check_unity_presence(version: version)
|
118
|
+
return unless enforce_setup_coherence(packages, options, unity)
|
122
119
|
|
123
120
|
U3d::Globals.use_keychain = true if options[:keychain] && Helper.mac?
|
124
121
|
|
@@ -156,18 +153,16 @@ module U3d
|
|
156
153
|
|
157
154
|
packages = packages_with_unity_first(options)
|
158
155
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
end
|
156
|
+
os = U3dCore::Helper.operating_system
|
157
|
+
|
158
|
+
unity = check_unity_presence(version: version)
|
159
|
+
return unless enforce_setup_coherence(packages, options, unity)
|
164
160
|
|
165
161
|
U3d::Globals.use_keychain = true if options[:keychain] && Helper.mac?
|
166
162
|
|
167
163
|
UI.important 'Root privileges are required'
|
168
164
|
raise 'Could not get administrative privileges' unless U3dCore::CommandExecutor.has_admin_privileges?
|
169
165
|
|
170
|
-
os = U3dCore::Helper.operating_system
|
171
166
|
files = []
|
172
167
|
if os == :linux
|
173
168
|
UI.important 'Option -a | --all not available for Linux' if options[:all]
|
@@ -218,7 +213,7 @@ module U3d
|
|
218
213
|
%w(add remove check)
|
219
214
|
end
|
220
215
|
|
221
|
-
def credentials(args: [],
|
216
|
+
def credentials(args: [], _options: {})
|
222
217
|
action = args[0]
|
223
218
|
raise "Please specify an action to perform, one of #{credentials_actions.join(',')}" unless action
|
224
219
|
raise "Unknown action '#{action}'. Use one of #{credentials_actions.join(',')}" unless credentials_actions.include? action
|
@@ -297,13 +292,36 @@ module U3d
|
|
297
292
|
installed = Installer.create.installed
|
298
293
|
unity = installed.find { |u| u.version == version }
|
299
294
|
if unity.nil?
|
300
|
-
UI.
|
295
|
+
UI.verbose "Version #{version} of Unity is not installed yet"
|
301
296
|
else
|
302
297
|
UI.verbose "Unity #{version} is installed at #{unity.path}"
|
303
298
|
return unity
|
304
299
|
end
|
305
300
|
nil
|
306
301
|
end
|
302
|
+
|
303
|
+
def enforce_setup_coherence(packages, options, unity)
|
304
|
+
if unity
|
305
|
+
UI.important "Unity #{unity.version} is already installed"
|
306
|
+
return false if Helper.linux?
|
307
|
+
if packages.include?('Unity')
|
308
|
+
UI.important 'Ignoring Unity module, it is already installed'
|
309
|
+
packages.delete('Unity')
|
310
|
+
options[:installation_path] ||= unity.path if Helper.windows?
|
311
|
+
end
|
312
|
+
if unity.packages
|
313
|
+
unity.packages.each do |pack|
|
314
|
+
UI.important "Ignoring #{pack} module, it is already installed" if packages.delete(pack)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
else
|
318
|
+
unless packages.include?('Unity')
|
319
|
+
UI.error "Please install Unity #{unity.version} before any of its packages"
|
320
|
+
return false
|
321
|
+
end
|
322
|
+
end
|
323
|
+
true
|
324
|
+
end
|
307
325
|
end
|
308
326
|
end
|
309
327
|
end
|
data/lib/u3d/downloader.rb
CHANGED
@@ -65,6 +65,7 @@ module U3d
|
|
65
65
|
File.open(path, 'wb') do |f|
|
66
66
|
uri = URI(url)
|
67
67
|
current = 0
|
68
|
+
last_print_update = 0
|
68
69
|
Net::HTTP.start(uri.host, uri.port) do |http|
|
69
70
|
request = Net::HTTP::Get.new uri
|
70
71
|
http.request request do |response|
|
@@ -77,7 +78,11 @@ module U3d
|
|
77
78
|
response.read_body do |segment|
|
78
79
|
f.write(segment)
|
79
80
|
current += segment.length
|
81
|
+
# wait for Net::HTTP buffer on slow networks
|
82
|
+
sleep 0.08 # adjust to reduce CPU
|
80
83
|
next unless UI.interactive?
|
84
|
+
next unless Time.now.to_f - last_print_update > 0.5
|
85
|
+
last_print_update = Time.now.to_f
|
81
86
|
if size
|
82
87
|
Utils.print_progress(current, size, started_at)
|
83
88
|
else
|
data/lib/u3d/installer.rb
CHANGED
@@ -30,7 +30,9 @@ module U3d
|
|
30
30
|
DEFAULT_MAC_INSTALL = '/'.freeze
|
31
31
|
DEFAULT_WINDOWS_INSTALL = 'C:/Program Files/'.freeze
|
32
32
|
UNITY_DIR = "Unity_%s".freeze
|
33
|
+
UNITY_DIR_LINUX = "unity-editor-%s".freeze
|
33
34
|
UNITY_DIR_CHECK = /Unity_\d+\.\d+\.\d+[a-z]\d+/
|
35
|
+
UNITY_DIR_CHECK_LINUX = /unity-editor-\d+\.\d+\.\d+[a-z]\d+\z/
|
34
36
|
|
35
37
|
class Installation
|
36
38
|
def self.create(path: nil)
|
@@ -75,6 +77,10 @@ module U3d
|
|
75
77
|
Dir.entries(fpath).select { |e| File.directory?(File.join(fpath, e)) && !(e == '.' || e == '..') }
|
76
78
|
end
|
77
79
|
|
80
|
+
def clean_install?
|
81
|
+
path =~ UNITY_DIR_CHECK
|
82
|
+
end
|
83
|
+
|
78
84
|
private
|
79
85
|
|
80
86
|
def plist
|
@@ -92,7 +98,7 @@ module U3d
|
|
92
98
|
def version
|
93
99
|
# I don't find an easy way to extract the version on Linux
|
94
100
|
require 'rexml/document'
|
95
|
-
fpath = "#{path}/Data/PlaybackEngines/LinuxStandaloneSupport/ivy.xml"
|
101
|
+
fpath = "#{path}/Editor/Data/PlaybackEngines/LinuxStandaloneSupport/ivy.xml"
|
96
102
|
raise "Couldn't find file #{fpath}" unless File.exist? fpath
|
97
103
|
doc = REXML::Document.new(File.read(fpath))
|
98
104
|
version = REXML::XPath.first(doc, 'ivy-module/info/@e:unityVersion').value
|
@@ -107,12 +113,16 @@ module U3d
|
|
107
113
|
end
|
108
114
|
|
109
115
|
def exe_path
|
110
|
-
"#{path}/Unity"
|
116
|
+
"#{path}/Editor/Unity"
|
111
117
|
end
|
112
118
|
|
113
119
|
def packages
|
114
120
|
false
|
115
121
|
end
|
122
|
+
|
123
|
+
def clean_install?
|
124
|
+
path =~ UNITY_DIR_CHECK_LINUX
|
125
|
+
end
|
116
126
|
end
|
117
127
|
|
118
128
|
class WindowsInstallation < Installation
|
@@ -157,6 +167,10 @@ module U3d
|
|
157
167
|
raise "Unity installation does not seem correct. Couldn't locate PlaybackEngines." unless Dir.exist? fpath
|
158
168
|
Dir.entries(fpath).select { |e| File.directory?(File.join(fpath, e)) && !(e == '.' || e == '..') }
|
159
169
|
end
|
170
|
+
|
171
|
+
def clean_install?
|
172
|
+
path =~ UNITY_DIR_CHECK
|
173
|
+
end
|
160
174
|
end
|
161
175
|
|
162
176
|
class Installer
|
@@ -170,7 +184,7 @@ module U3d
|
|
170
184
|
end
|
171
185
|
if UI.interactive?
|
172
186
|
unclean = []
|
173
|
-
installer.installed.each { |unity| unclean << unity unless unity.
|
187
|
+
installer.installed.each { |unity| unclean << unity unless unity.clean_install? }
|
174
188
|
if !unclean.empty? && UI.confirm("#{unclean.count} Unity installation should be moved. Proceed?")
|
175
189
|
unclean.each { |unity| installer.sanitize_install(unity) }
|
176
190
|
end
|
@@ -263,7 +277,7 @@ module U3d
|
|
263
277
|
def sanitize_install(unity)
|
264
278
|
source_path = File.expand_path(unity.path)
|
265
279
|
parent = File.expand_path('..', source_path)
|
266
|
-
new_path = File.join(parent,
|
280
|
+
new_path = File.join(parent, UNITY_DIR_LINUX % unity.version)
|
267
281
|
UI.important "Moving #{source_path} to #{new_path}..."
|
268
282
|
source_path = "\"#{source_path}\"" if source_path =~ / /
|
269
283
|
new_path = "\"#{new_path}\"" if new_path =~ / /
|
@@ -275,7 +289,7 @@ module U3d
|
|
275
289
|
end
|
276
290
|
|
277
291
|
def installed
|
278
|
-
find = File.join(DEFAULT_LINUX_INSTALL, '
|
292
|
+
find = File.join(DEFAULT_LINUX_INSTALL, 'unity-editor-*')
|
279
293
|
versions = Dir[find].map { |path| LinuxInstallation.new(path: path) }
|
280
294
|
|
281
295
|
# sorting should take into account stable/patch etc
|
@@ -285,23 +299,28 @@ module U3d
|
|
285
299
|
def install(file_path, version, installation_path: nil, info: {})
|
286
300
|
extension = File.extname(file_path)
|
287
301
|
raise "Installation of #{extension} files is not supported on Linux" if extension != '.sh'
|
288
|
-
path = installation_path ||
|
302
|
+
path = installation_path || DEFAULT_LINUX_INSTALL
|
289
303
|
install_sh(
|
290
304
|
file_path,
|
291
305
|
installation_path: path
|
292
306
|
)
|
307
|
+
# Forces sanitation for installation of 'weird' versions eg 5.6.1xf1Linux
|
308
|
+
sanitize_install(installed.select { |u| u.version == version }.first)
|
293
309
|
end
|
294
310
|
|
295
311
|
def install_sh(file, installation_path: nil)
|
296
312
|
cmd = file.shellescape
|
297
313
|
if installation_path
|
298
|
-
|
299
|
-
|
314
|
+
command = "cd \"#{installation_path}\"; #{cmd}"
|
315
|
+
unless File.directory? installation_path
|
316
|
+
command = "mkdir -p \"#{installation_path}\"; #{command}"
|
317
|
+
end
|
318
|
+
U3dCore::CommandExecutor.execute(command: command, admin: true)
|
300
319
|
else
|
301
320
|
U3dCore::CommandExecutor.execute(command: cmd, admin: true)
|
302
321
|
end
|
303
322
|
rescue => e
|
304
|
-
UI.error "Failed to install bash file at #{
|
323
|
+
UI.error "Failed to install bash file at #{file}: #{e}"
|
305
324
|
else
|
306
325
|
UI.success 'Installation successful'
|
307
326
|
end
|
@@ -381,7 +400,9 @@ module U3d
|
|
381
400
|
def editor_version
|
382
401
|
require 'yaml'
|
383
402
|
yaml = YAML.load(File.read("#{@path}/ProjectSettings/ProjectVersion.txt"))
|
384
|
-
yaml['m_EditorVersion']
|
403
|
+
version = yaml['m_EditorVersion']
|
404
|
+
version.gsub!(/(\d+\.\d+\.\d+)(?:x)?(\w\d+)(?:Linux)?/, '\1\2') if Helper.linux?
|
405
|
+
version
|
385
406
|
end
|
386
407
|
end
|
387
408
|
end
|
data/lib/u3d/unity_runner.rb
CHANGED
@@ -36,6 +36,7 @@ module U3d
|
|
36
36
|
log_file = installation.default_log_file
|
37
37
|
end
|
38
38
|
|
39
|
+
Utils.ensure_dir File.dirname(log_file)
|
39
40
|
FileUtils.touch(log_file) unless File.exist? log_file
|
40
41
|
|
41
42
|
tail_thread = Thread.new do
|
@@ -53,7 +54,7 @@ module U3d
|
|
53
54
|
end
|
54
55
|
|
55
56
|
# Wait for tail_thread setup to be complete
|
56
|
-
sleep 0.5 while tail_thread.status!='sleep'
|
57
|
+
sleep 0.5 while tail_thread.status != 'sleep'
|
57
58
|
tail_thread.run
|
58
59
|
|
59
60
|
begin
|
@@ -63,7 +64,7 @@ module U3d
|
|
63
64
|
else
|
64
65
|
args.map!(&:shellescape)
|
65
66
|
end
|
66
|
-
|
67
|
+
|
67
68
|
U3dCore::CommandExecutor.execute(command: args, print_all: true)
|
68
69
|
ensure
|
69
70
|
sleep 1
|
data/lib/u3d/unity_versions.rb
CHANGED
@@ -166,7 +166,7 @@ module U3d
|
|
166
166
|
if response.kind_of? Net::HTTPSuccess
|
167
167
|
capt = response.body.match(LINUX_DOWNLOAD_RECENT_FILE)
|
168
168
|
if capt && capt[1] && capt[2]
|
169
|
-
versions[capt[2].
|
169
|
+
versions[capt[2].delete('x')] = capt[1]
|
170
170
|
else
|
171
171
|
UI.error("Could not retrieve a fitting file from #{url}")
|
172
172
|
end
|
data/lib/u3d/version.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
## --- END LICENSE BLOCK ---
|
22
22
|
|
23
23
|
module U3d
|
24
|
-
VERSION = '0.9.
|
24
|
+
VERSION = '0.9.3'.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"\
|
@@ -73,7 +73,7 @@ module U3dCore
|
|
73
73
|
if Helper.windows?
|
74
74
|
raise CredentialsError, "The command \'#{command}\' must be run in administrative shell" unless has_admin_privileges?
|
75
75
|
else
|
76
|
-
command = "sudo -k && echo #{cred.password.shellescape} | sudo -S
|
76
|
+
command = "sudo -k && echo #{cred.password.shellescape} | sudo -S bash -c \"#{command}\""
|
77
77
|
end
|
78
78
|
UI.verbose 'Admin privileges granted for command execution'
|
79
79
|
end
|
@@ -120,7 +120,8 @@ module U3dCore
|
|
120
120
|
credentials = U3dCore::Credentials.new(user: ENV['USER'])
|
121
121
|
begin
|
122
122
|
result = system("sudo -k && echo #{credentials.password.shellescape} | sudo -S /usr/bin/whoami",
|
123
|
-
out: File::NULL,
|
123
|
+
out: File::NULL,
|
124
|
+
err: File::NULL)
|
124
125
|
rescue
|
125
126
|
result = false
|
126
127
|
end
|
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.
|
4
|
+
version: 0.9.3
|
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-08-
|
12
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- ".licenses.json"
|
244
244
|
- ".rspec"
|
245
245
|
- ".rubocop.yml"
|
246
|
+
- CHANGELOG.md
|
246
247
|
- Gemfile
|
247
248
|
- Gemfile.lock
|
248
249
|
- LICENSE
|