roku_builder 4.22.8 → 4.23.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/roku_builder/config.rb +5 -0
- data/lib/roku_builder/config_parser.rb +7 -4
- data/lib/roku_builder/config_validator.rb +1 -2
- data/lib/roku_builder/options.rb +11 -1
- data/lib/roku_builder/plugins/analyzer.rb +4 -2
- data/lib/roku_builder/plugins/core.rb +28 -3
- data/lib/roku_builder/plugins/indentation_inspector.rb +4 -2
- data/lib/roku_builder/plugins/packager.rb +2 -2
- data/lib/roku_builder/version.rb +1 -1
- data/test/roku_builder/plugins/test_core.rb +19 -0
- data/test/roku_builder/test_config.rb +31 -0
- data/test/roku_builder/test_config_validator.rb +0 -7
- data/test/roku_builder/test_files/analyzer_test/images/focus_hd.png +0 -0
- data/test/roku_builder/test_files/analyzer_test/source/main.brs +4 -0
- data/test/roku_builder/test_files/config_test/local_sub.json +8 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b9385582ee852b27c640473922b4942a16afa29327b0b8e38d963dd4e4d4a95
|
4
|
+
data.tar.gz: 4d52fe9d9a83e1d8af7c8856e211314bb161c2a803b3417fa17a19d3fc46e702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87685035b580f515a13b86d15ab3eff8b65c59823a40ba5768c93de7057996467f02dd9cd75200dd09b01cfaeab6287dfa008fe91ef480720bab04767197a8b1
|
7
|
+
data.tar.gz: e1a55a8931bbc6aec3123a2ef46887e14f2c329e209b7e8abd37ef8153d5a846032568124483837dc3db0e5d1d62fd1e2a775ce5ffcddabacbbdd572babf6ac8
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# RokuBuilder
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/roku_builder.svg)](https://badge.fury.io/rb/roku_builder)
|
4
|
-
[![Build Status](https://travis-ci.org/ViacomInc/roku_builder.svg?branch=master)](https://travis-ci.org/ViacomInc/roku_builder)
|
5
4
|
[![Coverage Status](https://coveralls.io/repos/github/ViacomInc/roku_builder/badge.svg?branch=master)](https://coveralls.io/github/ViacomInc/roku_builder?branch=master)
|
6
5
|
[![Code Climate](https://codeclimate.com/github/ViacomInc/roku_builder/badges/gpa.svg)](https://codeclimate.com/github/ViacomInc/roku_builder)
|
6
|
+
<!-- [![Build Status](https://travis-ci.org/ViacomInc/roku_builder.svg?branch=master)](https://travis-ci.org/ViacomInc/roku_builder) -->
|
7
7
|
|
8
8
|
A tool to help with Roku Development. Assists with many development/deployment
|
9
9
|
tasks. More information can be found in the [wiki](https://github.com/ViacomInc/roku_builder/wiki).
|
data/lib/roku_builder/config.rb
CHANGED
@@ -126,7 +126,12 @@ module RokuBuilder
|
|
126
126
|
if File.exist?(local_config_path) and !@loaded_configs.include?(File.expand_path(local_config_path))
|
127
127
|
local_config_hash = read_config(File.open(local_config_path))
|
128
128
|
add_missing_directories(local_config_hash)
|
129
|
+
local_sub_configs = "./.roku_config/*.json"
|
129
130
|
@config = @config.deep_merge(local_config_hash)
|
131
|
+
Dir.glob("./.roku_config/*.json").each do |sub_config_path|
|
132
|
+
sub_config_hash = read_config(File.open(sub_config_path))
|
133
|
+
@config = @config.deep_merge(sub_config_hash)
|
134
|
+
end
|
130
135
|
end
|
131
136
|
end
|
132
137
|
|
@@ -169,14 +169,17 @@ module RokuBuilder
|
|
169
169
|
end
|
170
170
|
|
171
171
|
def setup_key_config
|
172
|
-
if @
|
173
|
-
|
174
|
-
|
175
|
-
|
172
|
+
if @options.keyed_command?
|
173
|
+
if @parsed[:stage]
|
174
|
+
@parsed[:key] = @parsed[:stage][:key]
|
175
|
+
get_global_key_config if @parsed[:key].class == String
|
176
|
+
test_key_file
|
177
|
+
end
|
176
178
|
end
|
177
179
|
end
|
178
180
|
|
179
181
|
def get_global_key_config
|
182
|
+
raise ParseError, "No Keys Configured" unless @config[:keys]
|
180
183
|
raise ParseError, "Unknown Key: #{@parsed[:key]}" unless @config[:keys][@parsed[:key].to_sym]
|
181
184
|
@parsed[:key] = @config[:keys][@parsed[:key].to_sym].dup
|
182
185
|
if @config[:keys][:key_dir] and !@parsed[:key][:keyed_pkg].start_with?("./")
|
@@ -26,7 +26,7 @@ module RokuBuilder
|
|
26
26
|
KEY_MISSING_PATH = 19
|
27
27
|
KEY_MISSING_PASSWORD = 20
|
28
28
|
INVALID_MAPPING_INFO = 21
|
29
|
-
|
29
|
+
# = 22
|
30
30
|
MISSING_STAGE_METHOD = 23
|
31
31
|
|
32
32
|
def initialize(config:)
|
@@ -153,7 +153,6 @@ module RokuBuilder
|
|
153
153
|
errors= [
|
154
154
|
[STAGE_MISSING_BRANCH, (!stage[:branch] and project[:stage_method] == :git)],
|
155
155
|
[STAGE_MISSING_SCRIPT, (!stage[:script] and project[:stage_method] == :script)],
|
156
|
-
[MISSING_KEY, (!!stage[:key] and stage[:key].class == String and (!@config[:keys] or !@config[:keys][stage[:key].to_sym]))]
|
157
156
|
]
|
158
157
|
process_errors(errors: errors)
|
159
158
|
end
|
data/lib/roku_builder/options.rb
CHANGED
@@ -31,6 +31,10 @@ module RokuBuilder
|
|
31
31
|
device_commands.include?(command)
|
32
32
|
end
|
33
33
|
|
34
|
+
def keyed_command?
|
35
|
+
keyed_commands.include?(command)
|
36
|
+
end
|
37
|
+
|
34
38
|
def has_source?
|
35
39
|
!(keys & sources).empty?
|
36
40
|
end
|
@@ -41,7 +45,7 @@ module RokuBuilder
|
|
41
45
|
RokuBuilder.plugins.each do |plugin|
|
42
46
|
plugin.commands.each do |command, attributes|
|
43
47
|
commands << command
|
44
|
-
[:device, :source, :exclude].each do |type|
|
48
|
+
[:device, :source, :exclude, :keyed].each do |type|
|
45
49
|
if attributes[type]
|
46
50
|
send("#{type}_commands".to_sym) << command
|
47
51
|
end
|
@@ -148,5 +152,11 @@ module RokuBuilder
|
|
148
152
|
def device_commands
|
149
153
|
@device_commands ||= []
|
150
154
|
end
|
155
|
+
|
156
|
+
# List of commands that require a key
|
157
|
+
# @return [Array<Symbol>] List of commands that require a key
|
158
|
+
def keyed_commands
|
159
|
+
@keyed_commands ||= []
|
160
|
+
end
|
151
161
|
end
|
152
162
|
end
|
@@ -65,11 +65,13 @@ module RokuBuilder
|
|
65
65
|
def run_sca_tool(path:, ssai:)
|
66
66
|
if OS.unix?
|
67
67
|
command = File.join(File.dirname(__FILE__), "sca-cmd", "bin", "sca-cmd")
|
68
|
+
stderr = "/dev/null"
|
68
69
|
else
|
69
70
|
command = File.join(File.dirname(__FILE__), "sca-cmd", "bin", "sca-cmd.bat")
|
71
|
+
stderr = "nul"
|
70
72
|
end
|
71
73
|
@logger.debug("Command: '#{command}'")
|
72
|
-
results = `#{command} #{path}`.split("\n")
|
74
|
+
results = `#{command} #{path} 2>#{stderr}`.split("\n")
|
73
75
|
process_sca_results(results, ssai)
|
74
76
|
end
|
75
77
|
|
@@ -98,7 +100,7 @@ module RokuBuilder
|
|
98
100
|
end
|
99
101
|
libraries = @config.project[:libraries]
|
100
102
|
libraries ||= []
|
101
|
-
if libraries.any_is_start?(@sca_warning[:path].gsub(/pkg:/, "")) and not @options[:include_libraries]
|
103
|
+
if @sca_warning[:path] and libraries.any_is_start?(@sca_warning[:path].gsub(/pkg:/, "")) and not @options[:include_libraries]
|
102
104
|
return false
|
103
105
|
end
|
104
106
|
return true
|
@@ -8,7 +8,7 @@ module RokuBuilder
|
|
8
8
|
def self.commands
|
9
9
|
{
|
10
10
|
configure: {},
|
11
|
-
validate: {},
|
11
|
+
validate: {keyed: true},
|
12
12
|
increment: {source: true, stage: true},
|
13
13
|
dostage: {source: true},
|
14
14
|
dounstage: {source: true}
|
@@ -75,8 +75,9 @@ module RokuBuilder
|
|
75
75
|
parser.on("--debug", "Print Debug messages") do
|
76
76
|
options[:debug] = true
|
77
77
|
end
|
78
|
-
parser.on("-h", "--help", "Show
|
79
|
-
|
78
|
+
parser.on("-h", "--help [PLUGIN]", "Show help") do |h|
|
79
|
+
help_text = self.get_help_text(parser: parser, options: options, plugin_name: h)
|
80
|
+
puts help_text
|
80
81
|
exit
|
81
82
|
end
|
82
83
|
parser.on("-v", "--version", "Show version") do
|
@@ -112,6 +113,30 @@ module RokuBuilder
|
|
112
113
|
def dounstage(options:)
|
113
114
|
Stager.new(config: @config, options: options).unstage
|
114
115
|
end
|
116
|
+
|
117
|
+
def self.get_help_text(parser:, options:, plugin_name:)
|
118
|
+
plugin = self.get_plugin_by_name(plugin_name)
|
119
|
+
if nil == plugin
|
120
|
+
return parser.to_s
|
121
|
+
else
|
122
|
+
pluginParser = OptionParser.new
|
123
|
+
pluginParser.separator ""
|
124
|
+
pluginParser.separator "Options for #{plugin}:"
|
125
|
+
plugin.parse_options(parser: pluginParser, options: options)
|
126
|
+
return pluginParser.to_s
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.get_plugin_by_name(name)
|
131
|
+
if name.nil?
|
132
|
+
return nil
|
133
|
+
end
|
134
|
+
pluginIndex = RokuBuilder.plugins.map{|pluginClass| pluginClass.name.split('::').last().downcase}.index(name.downcase)
|
135
|
+
if !pluginIndex.nil?
|
136
|
+
plugin = RokuBuilder.plugins[pluginIndex]
|
137
|
+
return plugin
|
138
|
+
end
|
139
|
+
end
|
115
140
|
end
|
116
141
|
RokuBuilder.register_plugin(Core)
|
117
142
|
end
|
@@ -14,7 +14,7 @@ module RokuBuilder
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def check_line(line:, number:, comment:)
|
17
|
-
#byebug if number ==
|
17
|
+
#byebug if number == 190 and @path.ends_with?("ScreenManager.brs")
|
18
18
|
set_indentation(line: line)
|
19
19
|
regexp = /^#{@character}{#{@ind}}[^#{@character}]/
|
20
20
|
unless line =~ regexp or line == "\n" or line =~ /\'indent-ignore/ or comment
|
@@ -47,10 +47,12 @@ module RokuBuilder
|
|
47
47
|
@ind += @count
|
48
48
|
elsif @prev_line =~ /:\s*\bfunction\b|:\s*\bsub\b/i
|
49
49
|
@ind += @count
|
50
|
+
elsif @prev_line =~ /=\s*\bfunction\b|=\s*\bsub\b/i
|
51
|
+
@ind += @count
|
50
52
|
elsif @prev_line =~ /^\s*\bfunction\b|^\s*\bsub\b/i
|
51
53
|
@ind += @count
|
52
54
|
elsif @prev_line =~ /^\s*#?if\b|^\s*#?else\b/i
|
53
|
-
unless @prev_line =~ /\bthen\b[ \t
|
55
|
+
unless @prev_line =~ /\bthen\b[ \t]*[^' \r\n]+.*$/i or @prev_line =~ /\breturn\b/i
|
54
56
|
@ind += @count
|
55
57
|
end
|
56
58
|
elsif @prev_line =~ /^\s*\bfor\b|^\s*\bwhile\b/i
|
@@ -7,9 +7,9 @@ module RokuBuilder
|
|
7
7
|
|
8
8
|
def self.commands
|
9
9
|
{
|
10
|
-
package: {device: true, source: true, stage: true, exclude: true},
|
10
|
+
package: {device: true, source: true, stage: true, exclude: true, keyed: true},
|
11
11
|
genkey: {device: true},
|
12
|
-
key: {device: true, source: true}
|
12
|
+
key: {device: true, source: true, keyed: true}
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
data/lib/roku_builder/version.rb
CHANGED
@@ -108,6 +108,25 @@ module RokuBuilder
|
|
108
108
|
core.dounstage(options: options)
|
109
109
|
end
|
110
110
|
end
|
111
|
+
def test_core_help
|
112
|
+
parser = OptionParser.new
|
113
|
+
options = {}
|
114
|
+
help_text = Core.get_help_text(parser: parser, options: options, plugin_name: nil)
|
115
|
+
assert help_text
|
116
|
+
end
|
117
|
+
def test_core_help_plugin
|
118
|
+
parser = OptionParser.new
|
119
|
+
options = {}
|
120
|
+
help_text = Core.get_help_text(parser: parser, options: options, plugin_name: "Loader")
|
121
|
+
assert help_text
|
122
|
+
end
|
123
|
+
def test_core_get_plugin_by_name
|
124
|
+
parser = OptionParser.new
|
125
|
+
options = {}
|
126
|
+
plugin_name = Core.get_plugin_by_name("core")
|
127
|
+
refute_nil plugin_name
|
128
|
+
assert_match "RokuBuilder::Core", plugin_name.to_s
|
129
|
+
end
|
111
130
|
end
|
112
131
|
end
|
113
132
|
|
@@ -163,6 +163,37 @@ module RokuBuilder
|
|
163
163
|
assert_equal `pwd`.chomp, config.raw[:projects][:p2][:directory]
|
164
164
|
end
|
165
165
|
|
166
|
+
def test_config_read_local_sub_config
|
167
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
|
168
|
+
config = Config.new(options: options)
|
169
|
+
|
170
|
+
mock = Minitest::Mock.new
|
171
|
+
io = proc { |path|
|
172
|
+
if path == './.roku_config.json' or path == "keys.json"
|
173
|
+
mock
|
174
|
+
else
|
175
|
+
IO.new(IO.sysopen(path))
|
176
|
+
end
|
177
|
+
}
|
178
|
+
local_config_content = IO.read(File.join(test_files_path(ConfigTest), "local.json"))
|
179
|
+
mock.expect(:read, local_config_content)
|
180
|
+
local_sub_config_content = IO.read(File.join(test_files_path(ConfigTest), "local_sub.json"))
|
181
|
+
mock.expect(:read, local_sub_config_content)
|
182
|
+
|
183
|
+
File.stub(:exist?, true) do
|
184
|
+
File.stub(:open, io) do
|
185
|
+
Dir.stub(:glob, ["keys.json"]) do
|
186
|
+
config.load
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
mock.verify
|
192
|
+
refute_nil config.raw[:keys]
|
193
|
+
refute_nil config.raw[:keys][:test_key]
|
194
|
+
assert_equal "password", config.raw[:keys][:test_key][:password]
|
195
|
+
end
|
196
|
+
|
166
197
|
def test_config_edit
|
167
198
|
orginal = File.join(test_files_path(ConfigTest), "config.json")
|
168
199
|
tmp = File.join(test_files_path(ConfigTest), "tmpconfig.json")
|
@@ -167,13 +167,6 @@ module RokuBuilder
|
|
167
167
|
assert_equal [15, -1], validator.instance_variable_get(:@codes)
|
168
168
|
end
|
169
169
|
|
170
|
-
def test_config_manager_validate_project_key
|
171
|
-
config = good_config
|
172
|
-
config[:projects][:project2][:stages][:production][:key] = "b"
|
173
|
-
validator = ConfigValidator.new(config: config)
|
174
|
-
assert_equal [22], validator.instance_variable_get(:@codes)
|
175
|
-
end
|
176
|
-
|
177
170
|
def test_config_manager_validate_keys_pkg
|
178
171
|
config = good_config
|
179
172
|
config[:keys][:a][:keyed_pkg] = nil
|
Binary file
|
@@ -23,6 +23,10 @@ sub main(externalParams)
|
|
23
23
|
scene.observeField("exitApplication", port)
|
24
24
|
scene.observeField("sessionLength", port)
|
25
25
|
|
26
|
+
scene.signalBeacon("AppLaunchComplete")
|
27
|
+
scene.signalBeacon("AppDialogInitiate")
|
28
|
+
scene.signalBeacon("AppDialogComplete")
|
29
|
+
|
26
30
|
while(true)
|
27
31
|
msg = wait(0, port)
|
28
32
|
msgType = type(msg)
|
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.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- greeneca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -557,6 +557,7 @@ files:
|
|
557
557
|
- test/roku_builder/test_files/config_test/child.json
|
558
558
|
- test/roku_builder/test_files/config_test/config.json
|
559
559
|
- test/roku_builder/test_files/config_test/local.json
|
560
|
+
- test/roku_builder/test_files/config_test/local_sub.json
|
560
561
|
- test/roku_builder/test_files/config_test/multi_repeat_stages.json
|
561
562
|
- test/roku_builder/test_files/config_test/no_default_device.json
|
562
563
|
- test/roku_builder/test_files/config_test/no_default_project.json
|
@@ -684,6 +685,7 @@ test_files:
|
|
684
685
|
- test/roku_builder/test_files/config_test/child.json
|
685
686
|
- test/roku_builder/test_files/config_test/config.json
|
686
687
|
- test/roku_builder/test_files/config_test/local.json
|
688
|
+
- test/roku_builder/test_files/config_test/local_sub.json
|
687
689
|
- test/roku_builder/test_files/config_test/multi_repeat_stages.json
|
688
690
|
- test/roku_builder/test_files/config_test/no_default_device.json
|
689
691
|
- test/roku_builder/test_files/config_test/no_default_project.json
|