roku_builder 4.17.1 → 4.18.0

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/CHANGELOG +4 -0
  4. data/lib/roku_builder/os.rb +23 -0
  5. data/lib/roku_builder/plugins/analyzer.rb +42 -26
  6. data/lib/roku_builder/plugins/line_inspector.rb +1 -4
  7. data/lib/roku_builder/plugins/sca-cmd/bin/sca-cmd +188 -0
  8. data/lib/roku_builder/plugins/sca-cmd/bin/sca-cmd.bat +100 -0
  9. data/lib/roku_builder/plugins/sca-cmd/lib/sca-cmd.jar +0 -0
  10. data/lib/roku_builder/version.rb +1 -1
  11. data/test/roku_builder/plugins/test_analyzer.rb +1 -269
  12. data/test/roku_builder/test_files/analyzer_test/manifest_depricated_attribute +1 -0
  13. data/test/roku_builder/test_files/analyzer_test/manifest_duplicate_attribute +1 -0
  14. data/test/roku_builder/test_files/analyzer_test/manifest_empty_value +1 -0
  15. data/test/roku_builder/test_files/analyzer_test/manifest_has_value +1 -0
  16. data/test/roku_builder/test_files/analyzer_test/manifest_incorrect_image_resolution +1 -0
  17. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_boolean +1 -0
  18. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_equals +1 -0
  19. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_float +1 -0
  20. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_hex +1 -0
  21. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_integer +1 -0
  22. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_negative +1 -0
  23. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_not_equal +1 -0
  24. data/test/roku_builder/test_files/analyzer_test/manifest_invalid_value_starts_with +1 -0
  25. data/test/roku_builder/test_files/analyzer_test/manifest_missing_attribute +1 -0
  26. data/test/roku_builder/test_files/analyzer_test/manifest_missing_file +1 -0
  27. data/test/roku_builder/test_files/analyzer_test/manifest_raf +1 -0
  28. data/test/roku_builder/test_files/analyzer_test/manifest_sd_image_resolution +1 -0
  29. data/test/roku_builder/test_files/analyzer_test/manifest_template +1 -0
  30. data/test/roku_builder/test_files/analyzer_test/source/main.brs +40 -0
  31. metadata +8 -5
  32. data/lib/roku_builder/plugins/manifest_attributes.json +0 -224
  33. data/lib/roku_builder/plugins/manifest_inspector.rb +0 -150
  34. data/lib/roku_builder/plugins/raf_inspector.rb +0 -74
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.17.1"
5
+ VERSION = "4.18.0"
6
6
  end
@@ -41,275 +41,6 @@ module RokuBuilder
41
41
  assert_equal Array, warnings.class
42
42
  assert_equal 0, warnings.count
43
43
  end
44
- def test_manifest_duplicate_attribute
45
- warnings = test_manifest("manifest_duplicate_attribute")
46
- assert_equal 1, warnings.count
47
- assert_match(/title/, warnings[0][:message])
48
- assert_equal 2, warnings[0][:line]
49
- assert_equal "manifest", warnings[0][:path]
50
- end
51
- def test_manifest_depricated_attribute
52
- warnings = test_manifest("manifest_depricated_attribute")
53
- assert_equal 1, warnings.count
54
- assert_match(/subtitle/, warnings[0][:message])
55
- assert_equal 2, warnings[0][:line]
56
- assert_equal "manifest", warnings[0][:path]
57
- end
58
- def test_manifest_empty_value
59
- warnings = test_manifest("manifest_empty_value")
60
- assert_equal 1, warnings.count
61
- assert_match(/empty/, warnings[0][:message])
62
- assert_equal 9, warnings[0][:line]
63
- assert_equal "manifest", warnings[0][:path]
64
- end
65
- def test_manifest_invalid_value_integer
66
- warnings = test_manifest("manifest_invalid_value_integer")
67
- assert_equal 1, warnings.count
68
- assert_match(/major_version/, warnings[0][:message])
69
- assert_match(/bad/, warnings[0][:message])
70
- assert_equal 2, warnings[0][:line]
71
- assert_equal "manifest", warnings[0][:path]
72
- end
73
- def test_manifest_invalid_value_hex
74
- warnings = test_manifest("manifest_invalid_value_hex")
75
- assert_equal 1, warnings.count
76
- assert_match(/splash_color/, warnings[0][:message])
77
- assert_match(/bad/, warnings[0][:message])
78
- assert_equal 9, warnings[0][:line]
79
- assert_equal "manifest", warnings[0][:path]
80
- end
81
- def test_manifest_invalid_value_float
82
- warnings = test_manifest("manifest_invalid_value_float")
83
- assert_equal 1, warnings.count
84
- assert_match(/rsg_version/, warnings[0][:message])
85
- assert_match(/1/, warnings[0][:message])
86
- assert_equal 9, warnings[0][:line]
87
- assert_equal "manifest", warnings[0][:path]
88
- end
89
- def test_manifest_invalid_value_boolean
90
- warnings = test_manifest("manifest_invalid_value_boolean")
91
- assert_equal 1, warnings.count
92
- assert_match(/bs_prof_enabled/, warnings[0][:message])
93
- assert_match(/bad/, warnings[0][:message])
94
- assert_equal 9, warnings[0][:line]
95
- assert_equal "manifest", warnings[0][:path]
96
- end
97
- def test_manifest_invalid_value_negative
98
- warnings = test_manifest("manifest_invalid_value_negative")
99
- assert_equal 1, warnings.count
100
- assert_match(/major_version/, warnings[0][:message])
101
- assert_match(/-1/, warnings[0][:message])
102
- assert_equal 2, warnings[0][:line]
103
- assert_equal "manifest", warnings[0][:path]
104
- end
105
- def test_manifest_invalid_value_not_equal
106
- warnings = test_manifest("manifest_invalid_value_not_equal")
107
- assert_equal 1, warnings.count
108
- assert_match(/build_version/, warnings[0][:message])
109
- assert_match(/0/, warnings[0][:message])
110
- assert_equal 4, warnings[0][:line]
111
- assert_equal "manifest", warnings[0][:path]
112
- end
113
- def test_manifest_invalid_value_equals
114
- warnings = test_manifest("manifest_invalid_value_equals")
115
- assert_equal 1, warnings.count
116
- assert_match(/screensaver_private/, warnings[0][:message])
117
- assert_match(/2/, warnings[0][:message])
118
- assert_equal 9, warnings[0][:line]
119
- assert_equal "manifest", warnings[0][:path]
120
- end
121
- def test_manifest_invalid_value_starts_with
122
- warnings = test_manifest("manifest_invalid_value_starts_with")
123
- refute_equal 0, warnings.count
124
- assert_match(/mm_icon_focus_hd/, warnings[0][:message])
125
- assert_match(/bad/, warnings[0][:message])
126
- assert_match(/invalid value/, warnings[0][:message])
127
- assert_equal 5, warnings[0][:line]
128
- assert_equal "manifest", warnings[0][:path]
129
- end
130
- def test_manifest_has_value
131
- warnings = test_manifest("manifest_has_value")
132
- assert_equal 1, warnings.count
133
- assert_match(/rsg_version/, warnings[0][:message])
134
- assert_match(/1.0/, warnings[0][:message])
135
- assert_equal 9, warnings[0][:line]
136
- assert_equal "manifest", warnings[0][:path]
137
- end
138
- def test_manifest_missing_file
139
- warnings = test_manifest("manifest_missing_file")
140
- assert_equal 1, warnings.count
141
- assert_match(/mm_icon_focus_hd/, warnings[0][:message])
142
- assert_match(/missing.png/, warnings[0][:message])
143
- assert_equal 5, warnings[0][:line]
144
- assert_equal "manifest", warnings[0][:path]
145
- end
146
- def test_manifest_missing_attribute
147
- warnings = test_manifest("manifest_missing_attribute")
148
- assert_equal 1, warnings.count
149
- assert_match(/title/, warnings[0][:message])
150
- assert_equal "manifest", warnings[0][:path]
151
- refute warnings[0][:line]
152
- end
153
- def test_manifest_incorrect_image_resolution
154
- warnings = test_manifest("manifest_incorrect_image_resolution")
155
- assert_equal 1, warnings.count
156
- assert_match(/mm_icon_focus_hd/, warnings[0][:message])
157
- assert_match(/too_small.png/, warnings[0][:message])
158
- assert_match(/336x210/, warnings[0][:message])
159
- assert_match(/1x1/, warnings[0][:message])
160
- assert_equal 5, warnings[0][:line]
161
- assert_equal "manifest", warnings[0][:path]
162
- end
163
- def test_manifest_sd_image_resolution
164
- warnings = test_manifest("manifest_sd_image_resolution")
165
- assert_equal 0, warnings.count
166
- end
167
- def test_line_inspector_depricated_component
168
- warnings = test_file(text: "\"roVideoScreen\"")
169
- assert_equal 1, warnings.count
170
- assert_match(/deprecated/, warnings[0][:message])
171
- assert_match(/roVideoScreen/, warnings[0][:message])
172
- end
173
- def test_line_inspector_depricated_component_xml_file
174
- warnings = test_file(text: "\"roVideoScreen\"", file: "test.xml")
175
- assert_equal 1, warnings.count
176
- assert_match(/roVideoScreen/, warnings[0][:message])
177
- end
178
- def test_line_inspector_depricated_component_in_comment
179
- warnings = test_file(text: "'\"roVideoScreen\"")
180
- assert_equal 0, warnings.count
181
- end
182
- def test_line_inspector_depricated_component_before_comment
183
- warnings = test_file(text: "\"roVideoScreen\"'comment")
184
- assert_equal 1, warnings.count
185
- assert_match(/roVideoScreen/, warnings[0][:message])
186
- end
187
- def test_line_inspector_depricated_component_in_xml_comment
188
- warnings = test_file(text: "<!-- \"roVideoScreen\" -->", file: "test.xml")
189
- assert_equal 0, warnings.count
190
- end
191
- def test_line_inspector_depricated_component_before_xml_comment
192
- warnings = test_file(text: "\"roVideoScreen\" <!-- comment -->", file: "test.xml")
193
- assert_equal 1, warnings.count
194
- end
195
- def test_line_inspector_depricated_component_after_xml_comment
196
- warnings = test_file(text: "<!-- comment -->\"roVideoScreen\"", file: "test.xml")
197
- assert_equal 1, warnings.count
198
- end
199
- def test_line_inspector_depricated_component_in_xml_multiline_comment
200
- warnings = test_file(text: "<!-- line1 \n\"roVideoScreen\"\n line3 -->", file: "test.xml")
201
- assert_equal 0, warnings.count
202
- end
203
- def test_line_inspector_depricated_component_in_xml_multiline_comment_start
204
- warnings = test_file(text: "<!-- \"roVideoScreen\"\n line2 -->", file: "test.xml")
205
- assert_equal 0, warnings.count
206
- end
207
- def test_line_inspector_depricated_component_in_xml_multiline_comment
208
- warnings = test_file(text: "<!-- line1 \n\"roVideoScreen\"-->", file: "test.xml")
209
- assert_equal 0, warnings.count
210
- end
211
- def test_line_inspector_depricated_component_before_xml_multiline_comment
212
- warnings = test_file(text: "\"roVideoScreen\"<!-- line1 \n line2 -->", file: "test.xml")
213
- assert_equal 1, warnings.count
214
- end
215
- def test_line_inspector_depricated_component_after_xml_multiline_comment
216
- warnings = test_file(text: "<!-- line1 \n line2 -->\"roVideoScreen\"", file: "test.xml")
217
- assert_equal 1, warnings.count
218
- end
219
- def test_line_inspector_stop_command
220
- warnings = test_file(text: "test\nstop\n")
221
- assert_equal 1, warnings.count
222
- assert_equal 1, warnings[0][:line]
223
- end
224
- def test_raf_constructor_present_import_missing
225
- use_manifest("manifest_raf")
226
- warnings = test_file(text: "roku_ads()")
227
- assert warnings.count > 0
228
- assert_match(/constructor call is present.*import is missing/, warnings.first[:message])
229
- end
230
- def test_raf_constructor_present_manifest_missing
231
- warnings = test_file(text: "library \"roku_ads.brs\"\nroku_ads()")
232
- assert warnings.count > 0
233
- assert_match(/manifest entry is missing/, warnings.first[:message])
234
- end
235
- def test_raf_constructor_missing_manifest_present
236
- use_manifest("manifest_raf")
237
- warnings = test_file(text: "library \"roku_ads.brs\"")
238
- assert warnings.count > 0
239
- assert_match(/constructor call is not present/, warnings.first[:message])
240
- end
241
- def test_raf_manifest_present_import_missing
242
- use_manifest("manifest_raf")
243
- warnings = test_file(text: "roku_ads()")
244
- assert warnings.count > 0
245
- assert_match(/manifest entry is present.*import is missing/, warnings.last[:message])
246
- end
247
- def test_raf_constructor_missing_import_present
248
- use_manifest("manifest_raf")
249
- warnings = test_file(text: "library \"roku_ads.brs\"")
250
- assert warnings.count > 0
251
- assert_match(/constructor call is not present.*import is present/, warnings.last[:message])
252
- end
253
- def test_raf_proper_intergration
254
- use_manifest("manifest_raf")
255
- warnings = test_file(text: "library \"roku_ads.brs\"\nroku_ads()")
256
- assert_equal 1, warnings.count
257
- assert_match(/integrated properly/, warnings[0][:message])
258
- end
259
- def test_raf_proper_intergration_different_case
260
- use_manifest("manifest_raf")
261
- warnings = test_file(text: "library \"Roku_Ads.brs\"\nRoku_Ads()")
262
- assert_equal 1, warnings.count
263
- assert_match(/integrated properly/, warnings[0][:message])
264
- end
265
- def test_macosx_directory
266
- config = good_config(AnalyzerTest)
267
- config[:projects][:project1][:source_files].push("Test__MACOSX")
268
- @config, @options = build_config_options_objects(AnalyzerTest, {analyze: true, working: true}, false, config)
269
- folder = File.join(@root_dir, "Test__MACOSX")
270
- Dir.mkdir(folder) unless File.exist?(folder)
271
- warnings = test
272
- assert_equal 1, warnings.count
273
- assert_match(/MACOSX directory/, warnings[0][:message])
274
- Dir.rmdir(folder) if File.exist?(folder)
275
- end
276
- def test_extranious_files_zip
277
- warnings = test_file(text: "nothing", file: "test.zip")
278
- assert_equal 1, warnings.count
279
- assert_match(/extraneous file/, warnings[0][:message])
280
- end
281
- def test_extranious_files_md
282
- warnings = test_file(text: "nothing", file: "test.md")
283
- assert_equal 1, warnings.count
284
- assert_match(/extraneous file/, warnings[0][:message])
285
- end
286
- def test_extranious_files_pkg
287
- warnings = test_file(text: "nothing", file: "test.pkg")
288
- assert_equal 1, warnings.count
289
- assert_match(/extraneous file/, warnings[0][:message])
290
- end
291
- def test_source_directory
292
- folder = File.join(@root_dir, "source")
293
- Dir.rmdir(folder) if File.exist?(folder)
294
- warnings = test
295
- assert_equal 1, warnings.count
296
- assert_match(/"source".*not exist/, warnings[0][:message])
297
- end
298
- def test_manifest_file
299
- FileUtils.rm(File.join(@root_dir, "manifest"))
300
- warnings = test
301
- assert_equal 1, warnings.count
302
- assert_match(/Manifest.*missing/, warnings[0][:message])
303
- end
304
- def test_logging_error
305
- test_logger_with_file_content(text: "stop", severity: :error)
306
- end
307
- def test_logging_warning
308
- test_logger_with_file_content(text: "\"roCaptionRenderer\"", severity: :warn)
309
- end
310
- def test_logging_info
311
- test_logger_with_file_content(text: "\"roSGScreen\"", severity: :info)
312
- end
313
44
  def test_performance_function_return_types
314
45
  warnings = test_file(text: "function test() as String\n? \"test\"\nend function")
315
46
  assert_equal 1, warnings.count
@@ -353,6 +84,7 @@ module RokuBuilder
353
84
  def test_library_skip
354
85
  set_config({libraries: ["/source/test.brs"]})
355
86
  warnings = test_file(text: "\"roRegex\"")
87
+ puts warnings
356
88
  assert_equal 0, warnings.count
357
89
  end
358
90
  def test_library_skip_folder
@@ -7,3 +7,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
7
7
  mm_icon_focus_sd=pkg:/images/focus_sd.png
8
8
  splash_screen_hd=pkg:/images/splash_hd.png
9
9
  splash_screen_sd=pkg:/images/splash_sd.png
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
7
7
  mm_icon_focus_sd=pkg:/images/focus_sd.png
8
8
  splash_screen_hd=pkg:/images/splash_hd.png
9
9
  splash_screen_sd=pkg:/images/splash_sd.png
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  empty
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  rsg_version=1.0
10
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/too_small.png
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  bs_prof_enabled=bad
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  screensaver_private=2
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  rsg_version=1
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  splash_color=bad
10
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=bad
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -5,3 +5,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
5
5
  mm_icon_focus_sd=pkg:/images/focus_sd.png
6
6
  splash_screen_hd=pkg:/images/splash_hd.png
7
7
  splash_screen_sd=pkg:/images/splash_sd.png
8
+ supports_input_launch=1
@@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/missing.png
6
6
  mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  bs_libs_required=roku_ads_lib
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/too_small.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  splash_color=#121212
10
+ supports_input_launch=1
@@ -7,3 +7,4 @@ mm_icon_focus_sd=pkg:/images/focus_sd.png
7
7
  splash_screen_hd=pkg:/images/splash_hd.png
8
8
  splash_screen_sd=pkg:/images/splash_sd.png
9
9
  splash_color=#121212
10
+ supports_input_launch=1
@@ -0,0 +1,40 @@
1
+ '##COPYRIGHT HEADER##
2
+
3
+ sub main(externalParams)
4
+
5
+ port = createObject("roMessagePort")
6
+ screen = createObject("roSGScreen")
7
+ screen.setMessagePort(port)
8
+
9
+ m.global = screen.getGlobalNode()
10
+ m.global.observeField("redData", port)
11
+
12
+ m.input = createObject("roInput")
13
+ m.input.setMessagePort(port)
14
+
15
+ device = createObject("roDeviceInfo")
16
+ device.setMessagePort(port)
17
+ device.enableLinkStatusEvent(true)
18
+
19
+
20
+ scene = screen.createScene("Main")
21
+ screen.show()
22
+
23
+ scene.observeField("exitApplication", port)
24
+ scene.observeField("sessionLength", port)
25
+
26
+ while(true)
27
+ msg = wait(0, port)
28
+ msgType = type(msg)
29
+
30
+ if invalid <> msg
31
+ if "roInputEvent" = msgType
32
+ info = msg.getInfo()
33
+ if invalid <> info
34
+ mediaType = externalParams.mediaType
35
+ contentId = externalParams.contentId
36
+ end if
37
+ end if
38
+ end if
39
+ end while
40
+ end sub