u3d 1.0.8 → 1.0.9
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/.github_changelog_generator +1 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/docs/assets/u3d_list.png +0 -0
- data/docs/assets/u3d_sanitize.png +0 -0
- data/docs/assets/u3d_uninstall.png +0 -0
- data/examples/Example1/run.sh +0 -0
- data/examples/Example2/Assets/Editor/PostprocessBuildPlayer_log.sh +0 -0
- data/exe/u3d +0 -0
- data/lib/u3d/commands.rb +26 -10
- data/lib/u3d/commands_generator.rb +10 -0
- data/lib/u3d/installation.rb +181 -170
- data/lib/u3d/installer.rb +51 -17
- data/lib/u3d/unity_versions.rb +8 -2
- data/lib/u3d/version.rb +1 -1
- data/local_gem_install.sh +0 -0
- data/scripts/be +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ef51a1704cb01f95cc2ff2f66f90eb851c0010d
|
4
|
+
data.tar.gz: 26d03be1911d01506a9aa0bab60caf1abd8cf07d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d24c1137ce676f44354019fe449180038fde137cfdb6b7c8a94a4ce3639cf93ae2fda3d114c06ac97ef2d4579e26cf619f2658cf679d3ff9b3464faae72bff
|
7
|
+
data.tar.gz: 8f2c047324246b81c7ac78325045d49bbb90d867c4c345b90687b36aa2e62c1a1f7c41ac16c18476806943ecc1c95ec9d2f36909ebb916771119a581e2c01d31
|
data/.github_changelog_generator
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.0.9](https://github.com/DragonBox/u3d/tree/v1.0.9) (2017-10-31)
|
4
|
+
[Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.8...v1.0.9)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- Implement uninstall [\#174](https://github.com/DragonBox/u3d/issues/174)
|
9
|
+
- u3d/install: find all patched versions [\#172](https://github.com/DragonBox/u3d/issues/172)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- u3d/available: discover all patched releases \(fixes \#172\) [\#173](https://github.com/DragonBox/u3d/pull/173) ([lacostej](https://github.com/lacostej))
|
14
|
+
- Implement uninstall. Also modify the output of list on Mac and deprecate Installation.path in favor of Installation.root\_path [\#171](https://github.com/DragonBox/u3d/pull/171) ([lacostej](https://github.com/lacostej))
|
15
|
+
- u3d/cleanups small refactorings and cleanups [\#170](https://github.com/DragonBox/u3d/pull/170) ([lacostej](https://github.com/lacostej))
|
16
|
+
|
3
17
|
## [v1.0.8](https://github.com/DragonBox/u3d/tree/v1.0.8) (2017-10-18)
|
4
18
|
[Full Changelog](https://github.com/DragonBox/u3d/compare/v1.0.7...v1.0.8)
|
5
19
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,10 @@ Available commands are:
|
|
25
25
|
|
26
26
|

|
27
27
|
|
28
|
+
* `u3d uninstall`: Uninstall Unity3D versions
|
29
|
+
|
30
|
+

|
31
|
+
|
28
32
|
* `u3d list`: List installed versions of Unity3d
|
29
33
|
|
30
34
|

|
data/docs/assets/u3d_list.png
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/examples/Example1/run.sh
CHANGED
File without changes
|
File without changes
|
data/exe/u3d
CHANGED
File without changes
|
data/lib/u3d/commands.rb
CHANGED
@@ -53,7 +53,7 @@ module U3d
|
|
53
53
|
sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
|
54
54
|
sorted_keys.each do |k|
|
55
55
|
u = map[k]
|
56
|
-
UI.message "Version #{u.version.ljust(30)}(#{u.
|
56
|
+
UI.message "Version #{u.version.ljust(30)}(#{u.root_path})"
|
57
57
|
packages = u.packages
|
58
58
|
next unless options[:packages] && packages && !packages.empty?
|
59
59
|
UI.message 'Packages:'
|
@@ -126,11 +126,7 @@ module U3d
|
|
126
126
|
|
127
127
|
verify_package_names(definition, packages)
|
128
128
|
|
129
|
-
if options[:install]
|
130
|
-
U3dCore::Globals.use_keychain = true if options[:keychain] && Helper.mac?
|
131
|
-
UI.important 'Root privileges are required'
|
132
|
-
raise 'Could not get administrative privileges' unless U3dCore::CommandExecutor.has_admin_privileges?
|
133
|
-
end
|
129
|
+
get_administrative_privileges(options) if options[:install]
|
134
130
|
|
135
131
|
files = Downloader.fetch_modules(definition, packages: packages, download: options[:download])
|
136
132
|
|
@@ -138,6 +134,20 @@ module U3d
|
|
138
134
|
Installer.install_modules(files, definition.version, installation_path: options[:installation_path])
|
139
135
|
end
|
140
136
|
|
137
|
+
def uninstall(args: [], options: [])
|
138
|
+
version = specified_or_current_project_version(args[0])
|
139
|
+
|
140
|
+
unity = check_unity_presence(version: version)
|
141
|
+
|
142
|
+
unless unity
|
143
|
+
UI.user_error!('Unity version #{version} is not present and cannot be uninstalled')
|
144
|
+
end
|
145
|
+
|
146
|
+
get_administrative_privileges(options)
|
147
|
+
|
148
|
+
Installer.uninstall(unity: unity)
|
149
|
+
end
|
150
|
+
|
141
151
|
def install_dependencies
|
142
152
|
unless Helper.linux?
|
143
153
|
UI.important 'u3d dependencies is Linux-only, and not needed on other OS'
|
@@ -168,8 +178,7 @@ module U3d
|
|
168
178
|
run_args = [extra_run_args, run_args].flatten
|
169
179
|
end
|
170
180
|
|
171
|
-
|
172
|
-
unity = Installer.create.installed.find { |u| u.version == version }
|
181
|
+
unity = check_unity_presence(version: version)
|
173
182
|
UI.user_error! "Unity version '#{version}' not found" unless unity
|
174
183
|
runner.run(unity, run_args, raw_logs: options[:raw_logs])
|
175
184
|
end
|
@@ -290,12 +299,13 @@ module U3d
|
|
290
299
|
end
|
291
300
|
|
292
301
|
def check_unity_presence(version: nil)
|
302
|
+
# idea: we could support matching 5.3.6p3 if passed 5.3.6
|
293
303
|
installed = Installer.create.installed
|
294
304
|
unity = installed.find { |u| u.version == version }
|
295
305
|
if unity.nil?
|
296
306
|
UI.verbose "Version #{version} of Unity is not installed yet"
|
297
307
|
else
|
298
|
-
UI.verbose "Unity #{version} is installed at #{unity.
|
308
|
+
UI.verbose "Unity #{version} is installed at #{unity.root_path}"
|
299
309
|
return unity
|
300
310
|
end
|
301
311
|
nil
|
@@ -312,7 +322,7 @@ module U3d
|
|
312
322
|
packages.delete('Unity')
|
313
323
|
|
314
324
|
# FIXME: Move me to the WindowsInstaller
|
315
|
-
options[:installation_path] ||= unity.
|
325
|
+
options[:installation_path] ||= unity.root_path if definition.os == :win
|
316
326
|
end
|
317
327
|
if unity.packages
|
318
328
|
unity.packages.each do |pack|
|
@@ -328,6 +338,12 @@ module U3d
|
|
328
338
|
end
|
329
339
|
true
|
330
340
|
end
|
341
|
+
|
342
|
+
def get_administrative_privileges(options)
|
343
|
+
U3dCore::Globals.use_keychain = true if options[:keychain] && Helper.mac?
|
344
|
+
UI.important 'Root privileges are required'
|
345
|
+
raise 'Could not get administrative privileges' unless U3dCore::CommandExecutor.has_admin_privileges?
|
346
|
+
end
|
331
347
|
end
|
332
348
|
end
|
333
349
|
# rubocop:enable ClassLength
|
@@ -148,6 +148,16 @@ This command allows you to either:
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
+
command :uninstall do |c|
|
152
|
+
c.syntax = 'u3d uninstall [<version>]'
|
153
|
+
c.description = "Uninstall the specified Unity3d version."
|
154
|
+
c.option '-k', '--keychain', 'Gain privileges right through the keychain. [OSX only]'
|
155
|
+
c.example 'Uninstall Unity version 5.2.1f1', 'u3d uninstall 5.1.2f1'
|
156
|
+
c.action do |args, options|
|
157
|
+
Commands.uninstall(args: args, options: convert_options(options))
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
151
161
|
command :dependencies do |c|
|
152
162
|
c.syntax = 'u3d dependencies'
|
153
163
|
c.summary = 'Installs Unity dependencies. [Linux only]'
|
data/lib/u3d/installation.rb
CHANGED
@@ -1,170 +1,181 @@
|
|
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
|
-
|
25
|
-
module U3d
|
26
|
-
UNITY_DIR_CHECK = /Unity_\d+\.\d+\.\d+[a-z]\d+/
|
27
|
-
UNITY_DIR_CHECK_LINUX = /unity-editor-\d+\.\d+\.\d+[a-z]\d+\z/
|
28
|
-
|
29
|
-
class Installation
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
def
|
87
|
-
@
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
def
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
def
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
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
|
+
|
25
|
+
module U3d
|
26
|
+
UNITY_DIR_CHECK = /Unity_\d+\.\d+\.\d+[a-z]\d+/
|
27
|
+
UNITY_DIR_CHECK_LINUX = /unity-editor-\d+\.\d+\.\d+[a-z]\d+\z/
|
28
|
+
|
29
|
+
class Installation
|
30
|
+
attr_reader :root_path
|
31
|
+
|
32
|
+
def initialize(root_path: nil, path: nil)
|
33
|
+
@root_path = root_path
|
34
|
+
@path = path
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.create(root_path: nil, path: nil)
|
38
|
+
UI.deprecated("path is deprecated. Use root_path instead") unless path.nil?
|
39
|
+
if Helper.mac?
|
40
|
+
MacInstallation.new(root_path: root_path, path: path)
|
41
|
+
elsif Helper.linux?
|
42
|
+
LinuxInstallation.new(root_path: root_path, path: path)
|
43
|
+
else
|
44
|
+
WindowsInstallation.new(root_path: root_path, path: path)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class MacInstallation < Installation
|
50
|
+
require 'plist'
|
51
|
+
|
52
|
+
def version
|
53
|
+
plist['CFBundleVersion']
|
54
|
+
end
|
55
|
+
|
56
|
+
def default_log_file
|
57
|
+
"#{ENV['HOME']}/Library/Logs/Unity/Editor.log"
|
58
|
+
end
|
59
|
+
|
60
|
+
def exe_path
|
61
|
+
"#{root_path}/Unity.app/Contents/MacOS/Unity"
|
62
|
+
end
|
63
|
+
|
64
|
+
def path
|
65
|
+
UI.deprecated("path is deprecated. Use root_path instead")
|
66
|
+
return @path if @path
|
67
|
+
"#{@root_path}/Unity.app"
|
68
|
+
end
|
69
|
+
|
70
|
+
def packages
|
71
|
+
if Utils.parse_unity_version(version)[0].to_i <= 4
|
72
|
+
# Unity < 5 doesn't have packages
|
73
|
+
return []
|
74
|
+
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
|
+
end
|
79
|
+
|
80
|
+
def clean_install?
|
81
|
+
!(root_path =~ UNITY_DIR_CHECK).nil?
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def plist
|
87
|
+
@plist ||=
|
88
|
+
begin
|
89
|
+
fpath = "#{root_path}/Unity.app/Contents/Info.plist"
|
90
|
+
raise "#{fpath} doesn't exist" unless File.exist? fpath
|
91
|
+
Plist.parse_xml(fpath)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class LinuxInstallation < Installation
|
97
|
+
def version
|
98
|
+
# 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
|
104
|
+
if (m = version.match(/^(.*)x(.*)Linux$/))
|
105
|
+
version = "#{m[1]}#{m[2]}"
|
106
|
+
end
|
107
|
+
version
|
108
|
+
end
|
109
|
+
|
110
|
+
def default_log_file
|
111
|
+
"#{ENV['HOME']}/.config/unity3d/Editor.log"
|
112
|
+
end
|
113
|
+
|
114
|
+
def exe_path
|
115
|
+
"#{root_path}/Editor/Unity"
|
116
|
+
end
|
117
|
+
|
118
|
+
def path
|
119
|
+
UI.deprecated("path is deprecated. Use root_path instead")
|
120
|
+
@root_path || @path
|
121
|
+
end
|
122
|
+
|
123
|
+
def packages
|
124
|
+
false
|
125
|
+
end
|
126
|
+
|
127
|
+
def clean_install?
|
128
|
+
!(root_path =~ UNITY_DIR_CHECK_LINUX).nil?
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
class WindowsInstallation < Installation
|
133
|
+
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
|
144
|
+
end
|
145
|
+
|
146
|
+
def default_log_file
|
147
|
+
if @logfile.nil?
|
148
|
+
begin
|
149
|
+
loc_appdata = Utils.windows_local_appdata
|
150
|
+
log_dir = File.expand_path('Unity/Editor/', loc_appdata)
|
151
|
+
UI.important "Log directory (#{log_dir}) does not exist" unless Dir.exist? log_dir
|
152
|
+
@logfile = File.expand_path('Editor.log', log_dir)
|
153
|
+
rescue RuntimeError => ex
|
154
|
+
UI.error "Unable to retrieve the editor logfile: #{ex}"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
@logfile
|
158
|
+
end
|
159
|
+
|
160
|
+
def exe_path
|
161
|
+
File.join(@root_path, 'Editor', 'Unity.exe')
|
162
|
+
end
|
163
|
+
|
164
|
+
def path
|
165
|
+
UI.deprecated("path is deprecated. Use root_path instead")
|
166
|
+
@root_path || @path
|
167
|
+
end
|
168
|
+
|
169
|
+
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 == '..') }
|
175
|
+
end
|
176
|
+
|
177
|
+
def clean_install?
|
178
|
+
!(root_path =~ UNITY_DIR_CHECK).nil?
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
data/lib/u3d/installer.rb
CHANGED
@@ -25,6 +25,7 @@ require 'u3d_core/core_ext/string'
|
|
25
25
|
require 'u3d/installation'
|
26
26
|
require 'fileutils'
|
27
27
|
require 'file-tail'
|
28
|
+
require 'pathname'
|
28
29
|
|
29
30
|
module U3d
|
30
31
|
DEFAULT_LINUX_INSTALL = '/opt/'.freeze
|
@@ -66,6 +67,11 @@ module U3d
|
|
66
67
|
installer.install(file, version, installation_path: installation_path, info: info)
|
67
68
|
end
|
68
69
|
end
|
70
|
+
|
71
|
+
def self.uninstall(unity: nil)
|
72
|
+
installer = Installer.create
|
73
|
+
installer.uninstall(unity: unity)
|
74
|
+
end
|
69
75
|
end
|
70
76
|
|
71
77
|
class CommonInstaller
|
@@ -89,20 +95,18 @@ module U3d
|
|
89
95
|
|
90
96
|
class MacInstaller
|
91
97
|
def sanitize_install(unity, dry_run: false)
|
92
|
-
source_path =
|
98
|
+
source_path = unity.root_path
|
93
99
|
parent = File.expand_path('..', source_path)
|
94
100
|
new_path = File.join(parent, UNITY_DIR % unity.version)
|
95
|
-
source_path = source_path.shellescape
|
96
|
-
new_path = new_path.shellescape
|
97
101
|
|
98
|
-
command = "mv #{source_path} #{new_path}"
|
102
|
+
command = "mv #{source_path.shellescape} #{new_path.shellescape}"
|
99
103
|
|
100
104
|
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
|
101
105
|
end
|
102
106
|
|
103
107
|
def installed
|
104
108
|
paths = (list_installed_paths + spotlight_installed_paths).uniq
|
105
|
-
versions = paths.map { |path| MacInstallation.new(
|
109
|
+
versions = paths.map { |path| MacInstallation.new(root_path: path) }
|
106
110
|
|
107
111
|
# sorting should take into account stable/patch etc
|
108
112
|
versions.sort! { |x, y| x.version <=> y.version }
|
@@ -132,9 +136,9 @@ module U3d
|
|
132
136
|
destination_path = File.join(target_path, 'Applications', UNITY_DIR % version)
|
133
137
|
FileUtils.mv temp_path, destination_path
|
134
138
|
else
|
135
|
-
UI.verbose "Unity install for version #{version} found under #{unity.
|
139
|
+
UI.verbose "Unity install for version #{version} found under #{unity.root_path}"
|
136
140
|
begin
|
137
|
-
path =
|
141
|
+
path = unity.root_path
|
138
142
|
move_to_temp = (temp_path != path)
|
139
143
|
if move_to_temp
|
140
144
|
UI.verbose "Temporary switching location of #{path} to #{temp_path} for installation purpose"
|
@@ -151,11 +155,22 @@ module U3d
|
|
151
155
|
UI.success "Successfully installed package from #{file_path}"
|
152
156
|
end
|
153
157
|
|
158
|
+
def uninstall(unity: nil)
|
159
|
+
UI.verbose("Uninstalling Unity at '#{unity.root_path}'...")
|
160
|
+
command = "rm -r #{unity.root_path.argescape}"
|
161
|
+
U3dCore::CommandExecutor.execute(command: command, admin: true)
|
162
|
+
rescue => e
|
163
|
+
UI.error "Failed to uninstall unity at #{unity.path}: #{e}"
|
164
|
+
else
|
165
|
+
UI.success "Successfully uninstalled '#{unity.root_path}'"
|
166
|
+
end
|
167
|
+
|
154
168
|
private
|
155
169
|
|
156
170
|
def list_installed_paths
|
157
171
|
find = File.join(DEFAULT_MAC_INSTALL, 'Applications', 'Unity*', 'Unity.app')
|
158
172
|
paths = Dir[find]
|
173
|
+
paths = paths.map { |u| Pathname.new(u).parent.to_s }
|
159
174
|
UI.verbose "Found list_installed_paths: #{paths}"
|
160
175
|
paths
|
161
176
|
end
|
@@ -173,6 +188,7 @@ module U3d
|
|
173
188
|
cmd = "mdfind \"#{mdfind_args}\" 2>/dev/null"
|
174
189
|
UI.verbose cmd
|
175
190
|
paths = `#{cmd}`.split("\n")
|
191
|
+
paths = paths.map { |u| Pathname.new(u).parent.to_s }
|
176
192
|
UI.verbose "Found spotlight_installed_paths: #{paths}"
|
177
193
|
paths
|
178
194
|
end
|
@@ -180,20 +196,18 @@ module U3d
|
|
180
196
|
|
181
197
|
class LinuxInstaller
|
182
198
|
def sanitize_install(unity, dry_run: false)
|
183
|
-
source_path = File.expand_path(unity.
|
199
|
+
source_path = File.expand_path(unity.root_path)
|
184
200
|
parent = File.expand_path('..', source_path)
|
185
201
|
new_path = File.join(parent, UNITY_DIR_LINUX % unity.version)
|
186
|
-
source_path = source_path.shellescape
|
187
|
-
new_path = new_path.shellescape
|
188
202
|
|
189
|
-
command = "mv #{source_path} #{new_path}"
|
203
|
+
command = "mv #{source_path.shellescape} #{new_path.shellescape}"
|
190
204
|
|
191
205
|
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
|
192
206
|
end
|
193
207
|
|
194
208
|
def installed
|
195
209
|
find = File.join(DEFAULT_LINUX_INSTALL, 'unity-editor-*')
|
196
|
-
versions = Dir[find].map { |path| LinuxInstallation.new(
|
210
|
+
versions = Dir[find].map { |path| LinuxInstallation.new(root_path: path) }
|
197
211
|
|
198
212
|
# sorting should take into account stable/patch etc
|
199
213
|
versions.sort! { |x, y| x.version <=> y.version }
|
@@ -237,27 +251,35 @@ module U3d
|
|
237
251
|
else
|
238
252
|
UI.success 'Installation successful'
|
239
253
|
end
|
254
|
+
|
255
|
+
def uninstall(unity: nil)
|
256
|
+
UI.verbose("Uninstalling Unity at '#{unity.root_path}'...")
|
257
|
+
command = "rm -r #{unity.root_path}"
|
258
|
+
U3dCore::CommandExecutor.execute(command: command, admin: true)
|
259
|
+
rescue => e
|
260
|
+
UI.error "Failed to uninstall unity at #{unity.path}: #{e}"
|
261
|
+
else
|
262
|
+
UI.success "Successfully uninstalled '#{unity.root_path}'"
|
263
|
+
end
|
240
264
|
end
|
241
265
|
|
242
266
|
class WindowsInstaller
|
243
267
|
def sanitize_install(unity, dry_run: false)
|
244
|
-
source_path = File.expand_path(unity.
|
268
|
+
source_path = File.expand_path(unity.root_path)
|
245
269
|
parent = File.expand_path('..', source_path)
|
246
270
|
new_path = File.join(parent, UNITY_DIR % unity.version)
|
247
271
|
|
248
272
|
source_path.tr!('/', '\\')
|
249
273
|
new_path.tr!('/', '\\')
|
250
|
-
source_path = source_path.argescape
|
251
|
-
new_path = new_path.argescape
|
252
274
|
|
253
|
-
command = "move #{source_path} #{new_path}"
|
275
|
+
command = "move #{source_path.argescape} #{new_path.argescape}"
|
254
276
|
|
255
277
|
CommonInstaller.sanitize_install(source_path, new_path, command, dry_run: dry_run)
|
256
278
|
end
|
257
279
|
|
258
280
|
def installed
|
259
281
|
find = File.join(DEFAULT_WINDOWS_INSTALL, 'Unity*', 'Editor', 'Uninstall.exe')
|
260
|
-
versions = Dir[find].map { |path| WindowsInstallation.new(
|
282
|
+
versions = Dir[find].map { |path| WindowsInstallation.new(root_path: File.expand_path('../..', path)) }
|
261
283
|
|
262
284
|
# sorting should take into account stable/patch etc
|
263
285
|
versions.sort! { |x, y| x.version <=> y.version }
|
@@ -296,6 +318,18 @@ module U3d
|
|
296
318
|
UI.success "Successfully installed #{info['title']}"
|
297
319
|
end
|
298
320
|
end
|
321
|
+
|
322
|
+
def uninstall(unity: nil)
|
323
|
+
UI.verbose("Uninstalling Unity at '#{unity.root_path}'...")
|
324
|
+
uninstall_exe = File.join(unity.root_path, 'Editor', 'Uninstall.exe')
|
325
|
+
command = "#{uninstall_exe.argescape} /S"
|
326
|
+
UI.message("Although the uninstall process completed, it takes a few seconds before the files are actually removed")
|
327
|
+
U3dCore::CommandExecutor.execute(command: command, admin: true)
|
328
|
+
rescue => e
|
329
|
+
UI.error "Failed to uninstall unity at #{unity.path}: #{e}"
|
330
|
+
else
|
331
|
+
UI.success "Successfully uninstalled '#{unity.root_path}'"
|
332
|
+
end
|
299
333
|
end
|
300
334
|
|
301
335
|
class LinuxDependencies
|
data/lib/u3d/unity_versions.rb
CHANGED
@@ -78,6 +78,12 @@ module U3d
|
|
78
78
|
return hash
|
79
79
|
end
|
80
80
|
|
81
|
+
def fetch_version_paged(url, pattern)
|
82
|
+
U3d::Utils.get_ssl(url).scan(/\?page=\d+/).map do |page|
|
83
|
+
fetch_version("#{url}#{page}", pattern)
|
84
|
+
end.reduce({}, :merge)
|
85
|
+
end
|
86
|
+
|
81
87
|
def fetch_betas(url, pattern)
|
82
88
|
hash = {}
|
83
89
|
data = Utils.get_ssl(url)
|
@@ -221,7 +227,7 @@ module U3d
|
|
221
227
|
UI.success "Found #{current.count} releases." if current.count.nonzero?
|
222
228
|
versions = versions.merge(current)
|
223
229
|
UI.message 'Loading Unity patch releases'
|
224
|
-
current = UnityVersions.
|
230
|
+
current = UnityVersions.fetch_version_paged(UNITY_PATCHES, MAC_DOWNLOAD)
|
225
231
|
UI.success "Found #{current.count} patch releases." if current.count.nonzero?
|
226
232
|
versions = versions.merge(current)
|
227
233
|
UI.message 'Loading Unity beta releases'
|
@@ -242,7 +248,7 @@ module U3d
|
|
242
248
|
UI.success "Found #{current.count} releases." if current.count.nonzero?
|
243
249
|
versions = versions.merge(current)
|
244
250
|
UI.message 'Loading Unity patch releases'
|
245
|
-
current = UnityVersions.
|
251
|
+
current = UnityVersions.fetch_version_paged(UNITY_PATCHES, WIN_DOWNLOAD)
|
246
252
|
UI.success "Found #{current.count} patch releases." if current.count.nonzero?
|
247
253
|
versions = versions.merge(current)
|
248
254
|
UI.message 'Loading Unity beta releases'
|
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.
|
24
|
+
VERSION = '1.0.9'.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"\
|
data/local_gem_install.sh
CHANGED
File without changes
|
data/scripts/be
CHANGED
File without changes
|
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.
|
4
|
+
version: 1.0.9
|
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-
|
12
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- docs/assets/u3d_run.png
|
279
279
|
- docs/assets/u3d_run_current.png
|
280
280
|
- docs/assets/u3d_sanitize.png
|
281
|
+
- docs/assets/u3d_uninstall.png
|
281
282
|
- examples/Example1/.gitignore
|
282
283
|
- examples/Example1/Assets/Editor.meta
|
283
284
|
- examples/Example1/Assets/Editor/EditorRun.cs
|
@@ -414,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
414
415
|
version: '0'
|
415
416
|
requirements: []
|
416
417
|
rubyforge_project:
|
417
|
-
rubygems_version: 2.
|
418
|
+
rubygems_version: 2.6.12
|
418
419
|
signing_key:
|
419
420
|
specification_version: 4
|
420
421
|
summary: U3d
|