u3d 1.2.3 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +33 -10
  3. data/.github/workflows/ci.yml +35 -0
  4. data/.github_changelog_generator +3 -1
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +15 -3
  7. data/CHANGELOG.md +86 -11
  8. data/Gemfile.lock +149 -87
  9. data/Rakefile +13 -8
  10. data/examples/Example1/Gemfile +4 -2
  11. data/examples/Example1/Gemfile.lock +8 -6
  12. data/examples/Example1/Rakefile +2 -0
  13. data/examples/Example1/fastlane/Fastfile +2 -0
  14. data/examples/Example2/Gemfile +4 -2
  15. data/examples/Example2/Gemfile.lock +12 -7
  16. data/examples/Example2/fastlane/Fastfile +2 -0
  17. data/exe/u3d +3 -1
  18. data/lib/u3d/asset.rb +6 -2
  19. data/lib/u3d/cache.rb +14 -10
  20. data/lib/u3d/commands.rb +14 -9
  21. data/lib/u3d/commands_generator.rb +6 -4
  22. data/lib/u3d/compatibility.rb +2 -0
  23. data/lib/u3d/download_validator.rb +6 -3
  24. data/lib/u3d/downloader.rb +12 -8
  25. data/lib/u3d/failure_reporter.rb +4 -3
  26. data/lib/u3d/hub_modules_parser.rb +24 -7
  27. data/lib/u3d/ini_modules_parser.rb +10 -8
  28. data/lib/u3d/installation.rb +31 -49
  29. data/lib/u3d/installer.rb +44 -33
  30. data/lib/u3d/log_analyzer.rb +31 -27
  31. data/lib/u3d/unity_license.rb +2 -0
  32. data/lib/u3d/unity_module.rb +2 -0
  33. data/lib/u3d/unity_project.rb +4 -1
  34. data/lib/u3d/unity_runner.rb +12 -10
  35. data/lib/u3d/unity_version_definition.rb +3 -0
  36. data/lib/u3d/unity_version_number.rb +8 -2
  37. data/lib/u3d/unity_versions.rb +28 -23
  38. data/lib/u3d/utils.rb +86 -15
  39. data/lib/u3d/version.rb +8 -6
  40. data/lib/u3d.rb +2 -0
  41. data/lib/u3d_core/admin_tools.rb +2 -0
  42. data/lib/u3d_core/command_executor.rb +11 -7
  43. data/lib/u3d_core/command_runner.rb +17 -19
  44. data/lib/u3d_core/core_ext/hash.rb +2 -0
  45. data/lib/u3d_core/core_ext/operating_system_symbol.rb +3 -0
  46. data/lib/u3d_core/core_ext/string.rb +2 -0
  47. data/lib/u3d_core/credentials.rb +9 -7
  48. data/lib/u3d_core/env.rb +3 -0
  49. data/lib/u3d_core/globals.rb +7 -7
  50. data/lib/u3d_core/helper.rb +6 -4
  51. data/lib/u3d_core/ui/disable_colors.rb +2 -0
  52. data/lib/u3d_core/ui/implementations/shell.rb +8 -5
  53. data/lib/u3d_core/ui/interface.rb +3 -0
  54. data/lib/u3d_core/ui/ui.rb +5 -4
  55. data/lib/u3d_core/update_checker/changelog.rb +4 -0
  56. data/lib/u3d_core/update_checker/update_checker.rb +8 -9
  57. data/lib/u3d_core/version.rb +2 -0
  58. data/lib/u3d_core.rb +2 -0
  59. data/u3d.gemspec +20 -9
  60. metadata +112 -28
  61. data/appveyor.yml +0 -21
data/Gemfile.lock CHANGED
@@ -1,139 +1,201 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- u3d (1.2.3)
4
+ u3d (1.3.2)
5
5
  colored (>= 1.2, < 2.0.0)
6
6
  commander (>= 4.4.0, < 5.0.0)
7
+ fiddle
7
8
  file-tail (>= 1.2.0)
8
9
  filesize (>= 0.1.1)
9
10
  inifile (>= 3.0.0, < 4.0.0)
10
11
  plist (>= 3.1.0, < 4.0.0)
12
+ rexml
11
13
  rubyzip (>= 1.0.0)
12
14
  security (= 0.1.3)
13
15
 
14
16
  GEM
15
17
  remote: https://rubygems.org/
16
18
  specs:
17
- activesupport (5.1.3)
19
+ activesupport (6.1.6)
18
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
- i18n (~> 0.7)
20
- minitest (~> 5.1)
21
- tzinfo (~> 1.1)
22
- addressable (2.5.1)
23
- public_suffix (~> 2.0, >= 2.0.2)
24
- ast (2.3.0)
25
- builder (3.2.3)
26
- byebug (10.0.2)
27
- coderay (1.1.2)
21
+ i18n (>= 1.6, < 2)
22
+ minitest (>= 5.1)
23
+ tzinfo (~> 2.0)
24
+ zeitwerk (~> 2.3)
25
+ addressable (2.8.0)
26
+ public_suffix (>= 2.0.2, < 5.0)
27
+ ast (2.4.2)
28
+ async (1.30.2)
29
+ console (~> 1.10)
30
+ nio4r (~> 2.3)
31
+ timers (~> 4.1)
32
+ async-http (0.56.6)
33
+ async (>= 1.25)
34
+ async-io (>= 1.28)
35
+ async-pool (>= 0.2)
36
+ protocol-http (~> 0.22.0)
37
+ protocol-http1 (~> 0.14.0)
38
+ protocol-http2 (~> 0.14.0)
39
+ traces (~> 0.4.0)
40
+ async-http-faraday (0.11.0)
41
+ async-http (~> 0.42)
42
+ faraday
43
+ async-io (1.33.0)
44
+ async
45
+ async-pool (0.3.10)
46
+ async (>= 1.25)
28
47
  colored (1.2)
29
- commander (4.4.7)
48
+ commander (4.6.0)
30
49
  highline (~> 2.0.0)
31
- concurrent-ruby (1.0.5)
32
- coveralls (0.8.21)
50
+ concurrent-ruby (1.1.10)
51
+ console (1.15.3)
52
+ fiber-local
53
+ coveralls (0.8.23)
33
54
  json (>= 1.8, < 3)
34
- simplecov (~> 0.14.1)
55
+ simplecov (~> 0.16.1)
35
56
  term-ansicolor (~> 1.3)
36
- thor (~> 0.19.4)
57
+ thor (>= 0.19.4, < 2.0)
37
58
  tins (~> 1.6)
38
- diff-lcs (1.3)
39
- docile (1.1.5)
40
- faraday (0.12.2)
59
+ diff-lcs (1.5.0)
60
+ docile (1.4.0)
61
+ excon (0.92.3)
62
+ faraday (1.10.0)
63
+ faraday-em_http (~> 1.0)
64
+ faraday-em_synchrony (~> 1.0)
65
+ faraday-excon (~> 1.1)
66
+ faraday-httpclient (~> 1.0)
67
+ faraday-multipart (~> 1.0)
68
+ faraday-net_http (~> 1.0)
69
+ faraday-net_http_persistent (~> 1.0)
70
+ faraday-patron (~> 1.0)
71
+ faraday-rack (~> 1.0)
72
+ faraday-retry (~> 1.0)
73
+ ruby2_keywords (>= 0.0.4)
74
+ faraday-em_http (1.0.0)
75
+ faraday-em_synchrony (1.0.0)
76
+ faraday-excon (1.1.0)
77
+ faraday-http-cache (2.2.0)
78
+ faraday (>= 0.8)
79
+ faraday-httpclient (1.0.1)
80
+ faraday-multipart (1.0.3)
41
81
  multipart-post (>= 1.2, < 3)
42
- faraday-http-cache (2.0.0)
43
- faraday (~> 0.8)
82
+ faraday-net_http (1.0.1)
83
+ faraday-net_http_persistent (1.2.0)
84
+ faraday-patron (1.0.0)
85
+ faraday-rack (1.0.0)
86
+ faraday-retry (1.0.3)
87
+ fiber-local (1.0.0)
88
+ fiddle (1.1.0)
44
89
  file-tail (1.2.0)
45
90
  tins (~> 1.0)
46
91
  filesize (0.2.0)
47
- github_changelog_generator (1.14.3)
92
+ github_changelog_generator (1.16.4)
48
93
  activesupport
94
+ async (>= 1.25.0)
95
+ async-http-faraday
49
96
  faraday-http-cache
50
97
  multi_json
51
98
  octokit (~> 4.6)
52
- rainbow (>= 2.1)
99
+ rainbow (>= 2.2.1)
53
100
  rake (>= 10.0)
54
- retriable (~> 2.1)
55
101
  highline (2.0.3)
56
- i18n (0.8.6)
102
+ i18n (1.10.0)
103
+ concurrent-ruby (~> 1.0)
57
104
  inifile (3.0.0)
58
- json (2.1.0)
59
- method_source (0.9.0)
60
- minitest (5.10.3)
61
- multi_json (1.12.1)
62
- multipart-post (2.0.0)
63
- octokit (4.7.0)
105
+ json (2.6.2)
106
+ minitest (5.15.0)
107
+ multi_json (1.15.0)
108
+ multipart-post (2.1.1)
109
+ nio4r (2.5.8)
110
+ octokit (4.22.0)
111
+ faraday (>= 0.9)
64
112
  sawyer (~> 0.8.0, >= 0.5.3)
65
- parallel (1.12.1)
66
- parser (2.4.0.2)
67
- ast (~> 2.3)
68
- plist (3.5.0)
69
- powerpack (0.1.1)
70
- pry (0.11.3)
71
- coderay (~> 1.1.0)
72
- method_source (~> 0.9.0)
73
- pry-byebug (3.6.0)
74
- byebug (~> 10.0)
75
- pry (~> 0.10)
76
- public_suffix (2.0.5)
77
- rainbow (3.0.0)
78
- rake (10.5.0)
79
- retriable (2.1.0)
80
- rspec (3.1.0)
81
- rspec-core (~> 3.1.0)
82
- rspec-expectations (~> 3.1.0)
83
- rspec-mocks (~> 3.1.0)
84
- rspec-core (3.1.7)
85
- rspec-support (~> 3.1.0)
86
- rspec-expectations (3.1.2)
113
+ parallel (1.22.1)
114
+ parser (3.1.2.0)
115
+ ast (~> 2.4.1)
116
+ plist (3.6.0)
117
+ protocol-hpack (1.4.2)
118
+ protocol-http (0.22.6)
119
+ protocol-http1 (0.14.4)
120
+ protocol-http (~> 0.22)
121
+ protocol-http2 (0.14.2)
122
+ protocol-hpack (~> 1.4)
123
+ protocol-http (~> 0.18)
124
+ public_suffix (4.0.7)
125
+ rainbow (3.1.1)
126
+ rake (13.0.6)
127
+ regexp_parser (2.4.0)
128
+ rexml (3.2.5)
129
+ rspec (3.11.0)
130
+ rspec-core (~> 3.11.0)
131
+ rspec-expectations (~> 3.11.0)
132
+ rspec-mocks (~> 3.11.0)
133
+ rspec-core (3.11.0)
134
+ rspec-support (~> 3.11.0)
135
+ rspec-expectations (3.11.0)
87
136
  diff-lcs (>= 1.2.0, < 2.0)
88
- rspec-support (~> 3.1.0)
89
- rspec-mocks (3.1.3)
90
- rspec-support (~> 3.1.0)
91
- rspec-support (3.1.2)
92
- rspec_junit_formatter (0.2.3)
93
- builder (< 4)
137
+ rspec-support (~> 3.11.0)
138
+ rspec-mocks (3.11.1)
139
+ diff-lcs (>= 1.2.0, < 2.0)
140
+ rspec-support (~> 3.11.0)
141
+ rspec-support (3.11.0)
142
+ rspec_junit_formatter (0.5.1)
94
143
  rspec-core (>= 2, < 4, != 2.12.0)
95
- rubocop (0.52.1)
144
+ rubocop (1.28.2)
96
145
  parallel (~> 1.10)
97
- parser (>= 2.4.0.2, < 3.0)
98
- powerpack (~> 0.1)
146
+ parser (>= 3.1.0.0)
99
147
  rainbow (>= 2.2.2, < 4.0)
148
+ regexp_parser (>= 1.8, < 3.0)
149
+ rexml
150
+ rubocop-ast (>= 1.17.0, < 2.0)
100
151
  ruby-progressbar (~> 1.7)
101
- unicode-display_width (~> 1.0, >= 1.0.1)
102
- ruby-progressbar (1.9.0)
103
- rubyzip (2.0.0)
104
- sawyer (0.8.1)
105
- addressable (>= 2.3.5, < 2.6)
106
- faraday (~> 0.8, < 1.0)
152
+ unicode-display_width (>= 1.4.0, < 3.0)
153
+ rubocop-ast (1.17.0)
154
+ parser (>= 3.1.1.0)
155
+ rubocop-rake (0.6.0)
156
+ rubocop (~> 1.0)
157
+ ruby-progressbar (1.11.0)
158
+ ruby2_keywords (0.0.5)
159
+ rubyzip (2.3.2)
160
+ sawyer (0.8.2)
161
+ addressable (>= 2.3.5)
162
+ faraday (> 0.8, < 2.0)
107
163
  security (0.1.3)
108
- simplecov (0.14.1)
109
- docile (~> 1.1.0)
164
+ simplecov (0.16.1)
165
+ docile (~> 1.1)
110
166
  json (>= 1.8, < 3)
111
167
  simplecov-html (~> 0.10.0)
112
- simplecov-html (0.10.1)
113
- term-ansicolor (1.6.0)
168
+ simplecov-html (0.10.2)
169
+ sync (0.5.0)
170
+ term-ansicolor (1.7.1)
114
171
  tins (~> 1.0)
115
- thor (0.19.4)
116
- thread_safe (0.3.6)
117
- tins (1.15.0)
118
- tzinfo (1.2.3)
119
- thread_safe (~> 0.1)
120
- unicode-display_width (1.3.0)
172
+ thor (1.2.1)
173
+ timers (4.3.3)
174
+ tins (1.31.1)
175
+ sync
176
+ traces (0.4.1)
177
+ tzinfo (2.0.4)
178
+ concurrent-ruby (~> 1.0)
179
+ unicode-display_width (2.1.0)
180
+ zeitwerk (2.5.4)
121
181
 
122
182
  PLATFORMS
123
183
  ruby
124
- x64-mingw32
125
- x86-mingw32
126
184
 
127
185
  DEPENDENCIES
186
+ activesupport (>= 5.2.4.3)
187
+ addressable (>= 2.8.0)
128
188
  bundler (~> 2.0)
129
189
  coveralls
130
- github_changelog_generator
131
- pry-byebug
132
- rake (~> 10.0)
133
- rspec (~> 3.1.0)
134
- rspec_junit_formatter (~> 0.2.3)
135
- rubocop (~> 0.52.1)
190
+ excon (>= 0.71.0)
191
+ github_changelog_generator (>= 1.16.4)
192
+ json (>= 2.3.0)
193
+ rake (>= 12.3.3)
194
+ rspec (~> 3.11.0)
195
+ rspec_junit_formatter (~> 0.5.1)
196
+ rubocop (~> 1.27)
197
+ rubocop-rake (~> 0.6.0)
136
198
  u3d!
137
199
 
138
200
  BUNDLED WITH
139
- 2.1.4
201
+ 2.3.13
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Copyright (c) 2016-present WeWantToKnow AS
3
5
  #
@@ -35,7 +37,7 @@ RSpec::Core::RakeTask.new(:spec)
35
37
  RuboCop::RakeTask.new
36
38
 
37
39
  class GithubChangelogGenerator
38
- PATH = '.github_changelog_generator'.freeze
40
+ PATH = '.github_changelog_generator'
39
41
  class << self
40
42
  def future_release
41
43
  s = File.read(PATH)
@@ -56,25 +58,25 @@ class GithubChangelogGenerator
56
58
  line
57
59
  end
58
60
  end
59
- File.write(PATH, lines.join("\n") + "\n")
61
+ File.write(PATH, "#{lines.join("\n")}\n")
60
62
  end
61
63
  end
62
64
  end
63
65
 
64
66
  class U3dCode
65
- PATH = 'lib/u3d/version.rb'.freeze
67
+ PATH = 'lib/u3d/version.rb'
66
68
  class << self
67
69
  def version=(version)
68
70
  s = File.read(PATH)
69
71
  lines = s.split("\n").map do |line|
70
- m = line.match(/(.*VERSION = ').*('.freeze.*)/)
72
+ m = line.match(/(.*VERSION = ').*(')/)
71
73
  if m
72
74
  "#{m[1]}#{version}#{m[2]}"
73
75
  else
74
76
  line
75
77
  end
76
78
  end
77
- File.write(PATH, lines.join("\n") + "\n")
79
+ File.write(PATH, "#{lines.join("\n")}\n")
78
80
  end
79
81
  end
80
82
  end
@@ -126,6 +128,7 @@ def github_reviewers
126
128
  end
127
129
  ###
128
130
 
131
+ desc 'Ensure the git repository is clean. Fails otherwise'
129
132
  task :ensure_git_clean do
130
133
  branch = run_command('git rev-parse --abbrev-ref HEAD', "Couldn't get current git branch").strip
131
134
  UI.user_error!("You are not on 'master' but on '#{branch}'") unless branch == "master"
@@ -133,10 +136,11 @@ task :ensure_git_clean do
133
136
  UI.user_error!("git status not clean:\n#{output}") unless output == ""
134
137
  end
135
138
 
136
- # ensure ready to prepare a PR
139
+ desc 'Ensure we are ready to prepare a PR'
137
140
  task :prepare_git_pr, [:pr_branch] do |_t, args|
138
141
  pr_branch = args['pr_branch']
139
142
  raise "Missing pr_branch argument" unless pr_branch
143
+
140
144
  UI.user_error! "Prepare git PR stopped by user" unless UI.confirm("Creating PR branch #{pr_branch}")
141
145
  run_command("git checkout -b #{pr_branch}")
142
146
  end
@@ -180,7 +184,7 @@ task bump: 'ensure_git_clean' do
180
184
  UI.user_error! "Bump version stopped by user" unless UI.confirm("Next version will be #{nextversion}. Confirm?")
181
185
  U3dCode.version = nextversion
182
186
  GithubChangelogGenerator.future_release = nextversion
183
- sh 'rspec'
187
+ sh 'bundle exec rspec'
184
188
  sh 'git add .github_changelog_generator lib/u3d/version.rb Gemfile.lock'
185
189
  sh "git commit -m 'Bump version to #{nextversion}'"
186
190
  sh 'git push'
@@ -216,9 +220,10 @@ def parse_changelog
216
220
  if (m = line.match(/^## \[(.*)\]/))
217
221
  releases[version] = buffer if buffer
218
222
  version = m[1]
219
- buffer = version + "\n\n"
223
+ buffer = "#{version}\n\n"
220
224
  else
221
225
  next unless version # skip first lines
226
+
222
227
  buffer += line
223
228
  end
224
229
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gem 'fastlane'
@@ -5,6 +7,6 @@ REPO_ROOT = File.expand_path(File.join('..', '..'))
5
7
  gem 'u3d', path: REPO_ROOT
6
8
 
7
9
  plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
8
- # rubocop:disable Eval
10
+ # rubocop:disable Security/Eval
9
11
  eval(File.read(plugins_path), binding) if File.exist?(plugins_path)
10
- # rubocop:enable Eval
12
+ # rubocop:enable Security/Eval
@@ -1,19 +1,20 @@
1
1
  PATH
2
- remote: /Users/lacostej/Code/OSS/u3d/fastlane-plugin-u3d
2
+ remote: /Users/lacostej/Code/OSS/u3d_releases/fastlane-plugin-u3d
3
3
  specs:
4
4
  fastlane-plugin-u3d (0.1.2)
5
5
  u3d (>= 0.9, < 2.0)
6
6
 
7
7
  PATH
8
- remote: /Users/lacostej/Code/OSS/u3d
8
+ remote: /Users/lacostej/Code/OSS/u3d_releases
9
9
  specs:
10
- u3d (1.2.1)
10
+ u3d (1.2.3)
11
11
  colored (>= 1.2, < 2.0.0)
12
12
  commander (>= 4.4.0, < 5.0.0)
13
13
  file-tail (>= 1.2.0)
14
14
  filesize (>= 0.1.1)
15
15
  inifile (>= 3.0.0, < 4.0.0)
16
16
  plist (>= 3.1.0, < 4.0.0)
17
+ rexml
17
18
  rubyzip (>= 1.0.0)
18
19
  security (= 0.1.3)
19
20
 
@@ -21,7 +22,7 @@ GEM
21
22
  remote: https://rubygems.org/
22
23
  specs:
23
24
  CFPropertyList (3.0.1)
24
- addressable (2.7.0)
25
+ addressable (2.8.0)
25
26
  public_suffix (>= 2.0.2, < 5.0)
26
27
  atomos (0.1.3)
27
28
  babosa (1.0.3)
@@ -118,7 +119,7 @@ GEM
118
119
  domain_name (~> 0.5)
119
120
  httpclient (2.8.3)
120
121
  inifile (3.0.0)
121
- json (2.2.0)
122
+ json (2.6.2)
122
123
  jwt (2.1.0)
123
124
  memoist (0.16.0)
124
125
  mime-types (3.3)
@@ -138,6 +139,7 @@ GEM
138
139
  declarative-option (< 0.2.0)
139
140
  uber (< 0.2.0)
140
141
  retriable (3.1.2)
142
+ rexml (3.2.5)
141
143
  rouge (2.0.7)
142
144
  rubyzip (1.3.0)
143
145
  security (0.1.3)
@@ -154,7 +156,7 @@ GEM
154
156
  terminal-notifier (2.0.0)
155
157
  terminal-table (1.8.0)
156
158
  unicode-display_width (~> 1.1, >= 1.1.1)
157
- tins (1.24.1)
159
+ tins (1.31.1)
158
160
  sync
159
161
  tty-cursor (0.7.0)
160
162
  tty-screen (0.7.0)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Example integration of u3d
2
4
 
3
5
  task :u3d_load_save_scenes do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Run the EditorRun.LoadSaveScenes task"
2
4
  lane :u3d_build do
3
5
  u3d(run_args: "-logFile './editor.log' -executeMethod U3d.EditorRun.LoadSaveScenes -quit -batchmode")
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gem 'fastlane'
@@ -5,6 +7,6 @@ REPO_ROOT = File.expand_path(File.join('..', '..'))
5
7
  gem 'u3d', path: REPO_ROOT
6
8
 
7
9
  plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
8
- # rubocop:disable Eval
10
+ # rubocop:disable Security/Eval
9
11
  eval(File.read(plugins_path), binding) if File.exist?(plugins_path)
10
- # rubocop:enable Eval
12
+ # rubocop:enable Security/Eval
@@ -1,26 +1,28 @@
1
1
  PATH
2
- remote: /Users/lacostej/Code/OSS/u3d/fastlane-plugin-u3d
2
+ remote: /Users/lacostej/Code/OSS/u3d_releases/fastlane-plugin-u3d
3
3
  specs:
4
4
  fastlane-plugin-u3d (0.1.2)
5
5
  u3d (>= 0.9, < 2.0)
6
6
 
7
7
  PATH
8
- remote: /Users/lacostej/Code/OSS/u3d
8
+ remote: /Users/lacostej/Code/OSS/u3d_releases
9
9
  specs:
10
- u3d (1.1.6)
10
+ u3d (1.2.3)
11
11
  colored (>= 1.2, < 2.0.0)
12
12
  commander (>= 4.4.0, < 5.0.0)
13
13
  file-tail (>= 1.2.0)
14
14
  filesize (>= 0.1.1)
15
15
  inifile (>= 3.0.0, < 4.0.0)
16
16
  plist (>= 3.1.0, < 4.0.0)
17
+ rexml
18
+ rubyzip (>= 1.0.0)
17
19
  security (= 0.1.3)
18
20
 
19
21
  GEM
20
22
  remote: https://rubygems.org/
21
23
  specs:
22
24
  CFPropertyList (3.0.1)
23
- addressable (2.7.0)
25
+ addressable (2.8.0)
24
26
  public_suffix (>= 2.0.2, < 5.0)
25
27
  atomos (0.1.3)
26
28
  babosa (1.0.3)
@@ -38,7 +40,7 @@ GEM
38
40
  unf (>= 0.0.5, < 1.0.0)
39
41
  dotenv (2.7.5)
40
42
  emoji_regex (1.0.1)
41
- excon (0.68.0)
43
+ excon (0.92.3)
42
44
  faraday (0.17.0)
43
45
  multipart-post (>= 1.2, < 3)
44
46
  faraday-cookie_jar (0.0.6)
@@ -117,7 +119,7 @@ GEM
117
119
  domain_name (~> 0.5)
118
120
  httpclient (2.8.3)
119
121
  inifile (3.0.0)
120
- json (2.2.0)
122
+ json (2.6.2)
121
123
  jwt (2.1.0)
122
124
  memoist (0.16.0)
123
125
  mime-types (3.3)
@@ -137,6 +139,7 @@ GEM
137
139
  declarative-option (< 0.2.0)
138
140
  uber (< 0.2.0)
139
141
  retriable (3.1.2)
142
+ rexml (3.2.5)
140
143
  rouge (2.0.7)
141
144
  rubyzip (1.3.0)
142
145
  security (0.1.3)
@@ -149,10 +152,12 @@ GEM
149
152
  CFPropertyList
150
153
  naturally
151
154
  slack-notifier (2.3.2)
155
+ sync (0.5.0)
152
156
  terminal-notifier (2.0.0)
153
157
  terminal-table (1.8.0)
154
158
  unicode-display_width (~> 1.1, >= 1.1.1)
155
- tins (1.22.0)
159
+ tins (1.31.1)
160
+ sync
156
161
  tty-cursor (0.7.0)
157
162
  tty-screen (0.7.0)
158
163
  tty-spinner (0.9.1)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  desc "Run the EditorRun.Build task"
2
4
  lane :u3d_build do |options|
3
5
  u3d(raw_logs: options[:raw_logs], run_args: "-logFile './editor.log' -executeMethod U3d.EditorRun.Build -quit -batchmode")
data/exe/u3d CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.push File.expand_path('../lib', __dir__)
3
5
 
4
6
  require 'u3d'
5
7
  require 'u3d/commands_generator'
data/lib/u3d/asset.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Copyright (c) 2016-present WeWantToKnow AS
3
5
  #
@@ -36,8 +38,9 @@ module U3d
36
38
 
37
39
  def initialize(path, unity_project = nil)
38
40
  raise ArgumentError, "No file at #{path}" unless File.exist?(path)
41
+
39
42
  @path = path
40
- @meta_path = path + ".meta"
43
+ @meta_path = "#{path}.meta"
41
44
  @meta = YAML.safe_load(File.read(@meta_path))
42
45
  @guid = @meta['guid']
43
46
  @unity_project = unity_project
@@ -63,6 +66,7 @@ module U3d
63
66
 
64
67
  def eql?(other)
65
68
  return false unless other.is_a? Asset
69
+
66
70
  other.guid == @guid
67
71
  end
68
72
 
@@ -81,7 +85,7 @@ module U3d
81
85
  private
82
86
 
83
87
  def grep_reference_root
84
- @unity_project && @unity_project.exist? ? 'Assets/' : '.'
88
+ @unity_project&.exist? ? 'Assets/' : '.'
85
89
  end
86
90
  end
87
91
  end
data/lib/u3d/cache.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## --- BEGIN LICENSE BLOCK ---
2
4
  # Copyright (c) 2016-present WeWantToKnow AS
3
5
  #
@@ -32,12 +34,12 @@ module U3d
32
34
  using ::CoreExtensions::OperatingSystem
33
35
 
34
36
  # Name of the cache file
35
- DEFAULT_NAME = 'cache.json'.freeze
37
+ DEFAULT_NAME = 'cache.json'
36
38
  # Maximum duration after which the cache is considered outdated
37
39
  # Currently set to 24h
38
40
  CACHE_LIFE = 60 * 60 * 24
39
41
 
40
- GLOBAL_CACHE_URL = 'https://dragonbox.github.io/unities/v1/versions.json'.freeze
42
+ GLOBAL_CACHE_URL = 'https://dragonbox.github.io/unities/v1/versions.json'
41
43
 
42
44
  private
43
45
 
@@ -49,11 +51,13 @@ module U3d
49
51
 
50
52
  def [](key)
51
53
  return nil if @cache[key].nil?
54
+
52
55
  @cache[key]
53
56
  end
54
57
 
55
58
  def initialize(path: nil, force_os: nil, force_refresh: false, offline: false, central_cache: false)
56
59
  raise "Cache: cannot specify both offline and force_refresh" if offline && force_refresh
60
+
57
61
  @path = path || Cache.default_os_path
58
62
  @cache = {}
59
63
  os = force_os || U3dCore::Helper.operating_system
@@ -78,23 +82,23 @@ module U3d
78
82
  def check_for_update(file_path, os)
79
83
  need_update = false
80
84
  data = {}
81
- if !File.file?(file_path)
82
- need_update = true
83
- else
85
+ if File.file?(file_path)
84
86
  begin
85
87
  File.open(file_path, 'r') do |f|
86
88
  data = JSON.parse(f.read)
87
89
  end
88
- rescue JSON::ParserError => json_error
89
- UI.error 'Failed to parse cache.json: ' + json_error.to_s
90
+ rescue JSON::ParserError => e
91
+ UI.error "Failed to parse cache.json: #{e}"
90
92
  need_update = true
91
- rescue SystemCallError => file_error
92
- UI.error 'Failed to open cache.json: ' + file_error.to_s
93
+ rescue SystemCallError => e
94
+ UI.error "Failed to open cache.json: #{e}"
93
95
  need_update = true
94
96
  else
95
97
  need_update = os_data_need_update?(data, os)
96
98
  data[os.id2name] = nil if need_update
97
99
  end
100
+ else
101
+ need_update = true
98
102
  end
99
103
  return need_update, data
100
104
  end
@@ -111,7 +115,7 @@ module U3d
111
115
  update_cache(os) unless central_cache && fetch_central_cache(os)
112
116
 
113
117
  File.delete(file_path) if File.file?(file_path)
114
- File.open(file_path, 'w') { |f| f.write(@cache.to_json) }
118
+ File.write(file_path, @cache.to_json)
115
119
  end
116
120
 
117
121
  # Fetches central versions.json. Ignore it if it is too old