roku_builder 4.26.1 → 4.27.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.
- checksums.yaml +4 -4
- data/lib/roku_builder/config_parser.rb +12 -6
- data/lib/roku_builder/plugins/analyzer.rb +14 -9
- data/lib/roku_builder/plugins/line_inspector.rb +3 -3
- data/lib/roku_builder/plugins/sca-cmd/bin/sca-cmd +1 -1
- data/lib/roku_builder/plugins/sca-cmd/bin/sca-cmd.bat +1 -1
- data/lib/roku_builder/plugins/sca-cmd/lib/sca-cmd.jar +0 -0
- data/lib/roku_builder/version.rb +1 -1
- data/test/roku_builder/plugins/test_loader.rb +1 -1
- data/test/roku_builder/test_config_parser.rb +34 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b5e9ad1de8e6092b56c393b1f854d0209d4e9fe44a744447f59e63b99a172d2
|
|
4
|
+
data.tar.gz: c41fc8a97026d51cb5d573a5e9f7c78c2fbe97a4d38f2a6048e34a0809c82681
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f67847df29de9d54b7620b3676b1f164efa498974918356bd967564e9aac3dbaf1d2f8b7a450f77cb8106718d625e1d7392991da290619346d8c2ce0763a1419
|
|
7
|
+
data.tar.gz: '05589ffd1e88e5dda68a0378cfb695c7d1de22ae11ece61ff22d07aeca7cb60470c28d40c14434ee9a596a3b06cf47ea2be2211f2b54694faf2fad5536b83e2e'
|
|
@@ -83,24 +83,30 @@ module RokuBuilder
|
|
|
83
83
|
def setup_in_out_file
|
|
84
84
|
[:in, :out].each do |type|
|
|
85
85
|
@parsed[type] = {file: nil, folder: nil}
|
|
86
|
-
if
|
|
86
|
+
if user_file(type)
|
|
87
87
|
if file_defined?(type)
|
|
88
88
|
setup_file_and_folder(type)
|
|
89
|
-
elsif
|
|
90
|
-
@parsed[type][:folder] = File.expand_path(
|
|
89
|
+
elsif user_file(type)
|
|
90
|
+
@parsed[type][:folder] = File.expand_path(user_file(type))
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
set_default_outfile
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
+
def user_file(type)
|
|
98
|
+
file = @options[type]
|
|
99
|
+
file ||= @config[type]
|
|
100
|
+
file
|
|
101
|
+
end
|
|
102
|
+
|
|
97
103
|
def file_defined?(type)
|
|
98
|
-
|
|
104
|
+
user_file(type).end_with?(".zip") or user_file(type).end_with?(".pkg") or user_file(type).end_with?(".jpg")
|
|
99
105
|
end
|
|
100
106
|
|
|
101
107
|
def setup_file_and_folder(type)
|
|
102
|
-
@parsed[type][:folder], @parsed[type][:file] = Pathname.new(
|
|
103
|
-
if @parsed[type][:folder] == "." and not
|
|
108
|
+
@parsed[type][:folder], @parsed[type][:file] = Pathname.new(user_file(type)).split.map{|p| p.to_s}
|
|
109
|
+
if @parsed[type][:folder] == "." and not user_file(type).start_with?(".")
|
|
104
110
|
@parsed[type][:folder] = nil
|
|
105
111
|
else
|
|
106
112
|
@parsed[type][:folder] = File.expand_path(@parsed[type][:folder])
|
|
@@ -40,7 +40,7 @@ module RokuBuilder
|
|
|
40
40
|
loader = Loader.new(config: @config)
|
|
41
41
|
Dir.mktmpdir do |dir|
|
|
42
42
|
loader.copy(options: options, path: dir)
|
|
43
|
-
run_sca_tool(path: dir,
|
|
43
|
+
run_sca_tool(path: dir, linter_config: linter_config)
|
|
44
44
|
libraries = @config.project[:libraries]
|
|
45
45
|
libraries ||= []
|
|
46
46
|
Dir.glob(File.join(dir, "**", "*")).each do |file_path|
|
|
@@ -63,7 +63,7 @@ module RokuBuilder
|
|
|
63
63
|
|
|
64
64
|
private
|
|
65
65
|
|
|
66
|
-
def run_sca_tool(path:,
|
|
66
|
+
def run_sca_tool(path:, linter_config:)
|
|
67
67
|
if OS.unix?
|
|
68
68
|
command = File.join(File.dirname(__FILE__), "sca-cmd", "bin", "sca-cmd")
|
|
69
69
|
stderr = "/dev/null"
|
|
@@ -73,20 +73,20 @@ module RokuBuilder
|
|
|
73
73
|
end
|
|
74
74
|
@logger.debug("Command: '#{command}'")
|
|
75
75
|
results = `#{command} #{path} 2>#{stderr}`.split("\n")
|
|
76
|
-
process_sca_results(results,
|
|
76
|
+
process_sca_results(results, linter_config)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
def process_sca_results(results,
|
|
79
|
+
def process_sca_results(results, linter_config)
|
|
80
80
|
results.each do |result_line|
|
|
81
81
|
if /-----+/.match(result_line) or /\*\*\*\*\*+/.match(result_line)
|
|
82
|
-
@warnings.push(@sca_warning) if add_warning?(
|
|
82
|
+
@warnings.push(@sca_warning) if add_warning?(linter_config)
|
|
83
83
|
@sca_warning = {}
|
|
84
84
|
elsif data = /^(\[WARNING\]|\[INFO\]|\[ERROR\])(.*)$/.match(result_line)
|
|
85
|
-
@warnings.push(@sca_warning) if add_warning?(
|
|
85
|
+
@warnings.push(@sca_warning) if add_warning?(linter_config)
|
|
86
86
|
@sca_warning = {}
|
|
87
87
|
@sca_warning[:severity] = data[1].gsub(/(\[|\])/, "").downcase
|
|
88
88
|
@sca_warning[:message] = data[2]
|
|
89
|
-
elsif data = /^\
|
|
89
|
+
elsif data = /^\s*Path: ([^ ]*) Line: (\d*)./.match(result_line)
|
|
90
90
|
@sca_warning[:path] = data[1]+":"+data[2]
|
|
91
91
|
elsif @sca_warning and @sca_warning[:message]
|
|
92
92
|
@sca_warning[:message] += " " + result_line
|
|
@@ -94,9 +94,9 @@ module RokuBuilder
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
def add_warning?(
|
|
97
|
+
def add_warning?(linter_config)
|
|
98
98
|
if @sca_warning and @sca_warning[:severity]
|
|
99
|
-
if ssai and /SetAdUrl\(\) method is missing/.match(@sca_warning[:message])
|
|
99
|
+
if linter_config[:ssai] and /SetAdUrl\(\) method is missing/.match(@sca_warning[:message])
|
|
100
100
|
return false
|
|
101
101
|
end
|
|
102
102
|
libraries = @config.project[:libraries]
|
|
@@ -104,6 +104,11 @@ module RokuBuilder
|
|
|
104
104
|
if @sca_warning[:path] and libraries.any_is_start?(@sca_warning[:path].gsub(/pkg:/, "")) and not @options[:include_libraries]
|
|
105
105
|
return false
|
|
106
106
|
end
|
|
107
|
+
if linter_config[:ignore_warnings]
|
|
108
|
+
linter_config[:ignore_warnings].each do |regexp|
|
|
109
|
+
return false if @sca_warning[:message] =~ /#{regexp}/
|
|
110
|
+
end
|
|
111
|
+
end
|
|
107
112
|
return true
|
|
108
113
|
end
|
|
109
114
|
return false
|
|
@@ -67,8 +67,8 @@ module RokuBuilder
|
|
|
67
67
|
if (not line_inspector[:pass_if_match] and match) or (line_inspector[:pass_if_match] and not match)
|
|
68
68
|
error_match = match
|
|
69
69
|
if match
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
line_number = to_check[0..match.begin(0)+start].split("\n", -1).count - 1
|
|
71
|
+
start = match.end(0) + start
|
|
72
72
|
else
|
|
73
73
|
error_match = pass_match
|
|
74
74
|
line_number = to_check[0..start].split("\n", -1).count - 1
|
|
@@ -78,7 +78,7 @@ module RokuBuilder
|
|
|
78
78
|
add_warning(inspector: line_inspector, file: file_path, line: line_number, match: error_match)
|
|
79
79
|
end
|
|
80
80
|
elsif line_inspector[:pass_if_match]
|
|
81
|
-
start = stop +1
|
|
81
|
+
start = stop + 1
|
|
82
82
|
else
|
|
83
83
|
break
|
|
84
84
|
end
|
|
@@ -114,7 +114,7 @@ case "$( uname )" in #(
|
|
|
114
114
|
NONSTOP* ) nonstop=true ;;
|
|
115
115
|
esac
|
|
116
116
|
|
|
117
|
-
CLASSPATH=$APP_HOME/lib/sca-cmd.jar:$APP_HOME/lib/sca-library.jar:$APP_HOME/lib/utils-
|
|
117
|
+
CLASSPATH=$APP_HOME/lib/sca-cmd.jar:$APP_HOME/lib/sca-library.jar:$APP_HOME/lib/utils-4.0.0.jar:$APP_HOME/lib/configuration-4.0.0.jar:$APP_HOME/lib/compress-4.0.0.jar:$APP_HOME/lib/io-4.0.0.jar:$APP_HOME/lib/imaging-4.0.0.jar:$APP_HOME/lib/manifest-4.0.0.jar:$APP_HOME/lib/commons-cli-1.5.0.jar:$APP_HOME/lib/jackson-databind-2.13.3.jar:$APP_HOME/lib/jackson-core-2.13.3.jar:$APP_HOME/lib/jackson-annotations-2.13.3.jar:$APP_HOME/lib/jackson-dataformat-xml-2.13.3.jar:$APP_HOME/lib/commons-lang3-3.12.0.jar:$APP_HOME/lib/woodstox-core-6.2.7.jar:$APP_HOME/lib/stax2-api-4.2.1.jar:$APP_HOME/lib/commons-compress-1.21.jar:$APP_HOME/lib/commons-io-2.11.0.jar
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
# Determine the Java command to use to start the JVM.
|
|
@@ -67,7 +67,7 @@ goto fail
|
|
|
67
67
|
:execute
|
|
68
68
|
@rem Setup the command line
|
|
69
69
|
|
|
70
|
-
set CLASSPATH=%APP_HOME%\lib\sca-cmd.jar;%APP_HOME%\lib\sca-library.jar;%APP_HOME%\lib\utils-
|
|
70
|
+
set CLASSPATH=%APP_HOME%\lib\sca-cmd.jar;%APP_HOME%\lib\sca-library.jar;%APP_HOME%\lib\utils-4.0.0.jar;%APP_HOME%\lib\configuration-4.0.0.jar;%APP_HOME%\lib\compress-4.0.0.jar;%APP_HOME%\lib\io-4.0.0.jar;%APP_HOME%\lib\imaging-4.0.0.jar;%APP_HOME%\lib\manifest-4.0.0.jar;%APP_HOME%\lib\commons-cli-1.5.0.jar;%APP_HOME%\lib\jackson-databind-2.13.3.jar;%APP_HOME%\lib\jackson-core-2.13.3.jar;%APP_HOME%\lib\jackson-annotations-2.13.3.jar;%APP_HOME%\lib\jackson-dataformat-xml-2.13.3.jar;%APP_HOME%\lib\commons-lang3-3.12.0.jar;%APP_HOME%\lib\woodstox-core-6.2.7.jar;%APP_HOME%\lib\stax2-api-4.2.1.jar;%APP_HOME%\lib\commons-compress-1.21.jar;%APP_HOME%\lib\commons-io-2.11.0.jar
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
@rem Execute sca-cmd
|
|
Binary file
|
data/lib/roku_builder/version.rb
CHANGED
|
@@ -136,7 +136,7 @@ module RokuBuilder
|
|
|
136
136
|
end
|
|
137
137
|
def test_loader_squash
|
|
138
138
|
@request_stubs.push(stub_request(:post, "http://#{@device_config[:ip]}/plugin_install").
|
|
139
|
-
to_return(status: 200, body: "
|
|
139
|
+
to_return(status: 200, body: "squashfs file in internal memory", headers: {}))
|
|
140
140
|
@device_manager.expect(:reserve_device, @device, no_lock: false)
|
|
141
141
|
@device_manager.expect(:release_device, nil, [@device])
|
|
142
142
|
|
|
@@ -345,5 +345,39 @@ module RokuBuilder
|
|
|
345
345
|
assert_equal tmp_folder, parsed[:out][:folder]
|
|
346
346
|
assert_equal "file.jpg", parsed[:out][:file]
|
|
347
347
|
end
|
|
348
|
+
def test_outfile_config_config_out
|
|
349
|
+
config = good_config(ConfigParserTest)
|
|
350
|
+
config[:out] = "/home/user"
|
|
351
|
+
options = build_options({validate: true, working: true, out: nil})
|
|
352
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
|
353
|
+
|
|
354
|
+
refute_nil parsed[:out]
|
|
355
|
+
refute_nil parsed[:out][:folder]
|
|
356
|
+
assert_nil parsed[:out][:file]
|
|
357
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
|
358
|
+
end
|
|
359
|
+
def test_outfile_config_config_out_file
|
|
360
|
+
config = good_config(ConfigParserTest)
|
|
361
|
+
config[:out] = "/home/user/file.pkg"
|
|
362
|
+
options = build_options({validate: true, working: true, out: nil})
|
|
363
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
|
364
|
+
|
|
365
|
+
refute_nil parsed[:out]
|
|
366
|
+
refute_nil parsed[:out][:folder]
|
|
367
|
+
refute_nil parsed[:out][:file]
|
|
368
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
|
369
|
+
assert_equal "file.pkg", parsed[:out][:file]
|
|
370
|
+
end
|
|
371
|
+
def test_outfile_config_config_and_option_out
|
|
372
|
+
config = good_config(ConfigParserTest)
|
|
373
|
+
config[:out] = "/home/user"
|
|
374
|
+
options = build_options({validate: true, working: true, out: "/home/user2"})
|
|
375
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
|
376
|
+
|
|
377
|
+
refute_nil parsed[:out]
|
|
378
|
+
refute_nil parsed[:out][:folder]
|
|
379
|
+
assert_nil parsed[:out][:file]
|
|
380
|
+
assert_equal "/home/user2", parsed[:out][:folder]
|
|
381
|
+
end
|
|
348
382
|
end
|
|
349
383
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roku_builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.27.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- greeneca
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubyzip
|
|
@@ -653,7 +653,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
653
653
|
- !ruby/object:Gem::Version
|
|
654
654
|
version: '0'
|
|
655
655
|
requirements: []
|
|
656
|
-
rubygems_version: 3.3.
|
|
656
|
+
rubygems_version: 3.3.7
|
|
657
657
|
signing_key:
|
|
658
658
|
specification_version: 4
|
|
659
659
|
summary: Build Tool for Roku Apps
|