roku_builder 4.22.9 → 4.24.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 914ac6d549694894942d8d6904f65a24b83f146841191dcd04a7c367e04902f7
4
- data.tar.gz: b2fa7a6ddfdb98276d2a34f15eba26b385c8b1b5e5c72ba635cd589434252bbb
3
+ metadata.gz: b072e460501a9671d72c7014a21bfb00754563439d6e9bef567988c51607a362
4
+ data.tar.gz: 3ee7363cd19dfdb08217498c107508299e26f692a4dfb040846e14cfc4402411
5
5
  SHA512:
6
- metadata.gz: 35c1dc3f99d5761397b924e38473424fd302c52a5dd0111b3c326e247358d3a4a2c16aefde7cab6377ecccdf0bef3447ad46e09f69916b35fb62e4a18a97d0d3
7
- data.tar.gz: 3bc352f2204af791ddfc8d0a7ca7993ab97a0da684f8bc54e70a07a5190913cd1294181d9b0cf5ddf22d0edb664b8fcae6deef6fa893b46085facddc51a52e85
6
+ metadata.gz: 5f4eee2ac6a7a516c508a1339ea70bc941c66901744322fe27ce743ec161649fe7623141d04458d330edf473a063775a5ffe6513414dea607336e1af26b69577
7
+ data.tar.gz: 45de05bd19128a26f5443104c84535bf1ca0466de87efb94c177854dd871ae344c04391b4e1e50870177b30b8fc84a2e7587506ee29bffdd6010eb05bc55efaa
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).
@@ -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 @parsed[:stage]
173
- @parsed[:key] = @parsed[:stage][:key]
174
- get_global_key_config if @parsed[:key].class == String
175
- test_key_file
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
- MISSING_KEY = 22
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
@@ -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
 
@@ -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}
@@ -14,7 +14,7 @@ module RokuBuilder
14
14
  end
15
15
 
16
16
  def check_line(line:, number:, comment:)
17
- #byebug if number == 10 and @path.ends_with?(".brs")
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 ]*[^' \r\n']+.*$/i or @prev_line =~ /\breturn\b/i
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
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.22.9"
5
+ VERSION = "4.24.0"
6
6
  end
data/roku_builder.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = "~> 2.3"
21
+ spec.required_ruby_version = "~> 3.0"
22
22
 
23
23
  spec.add_dependency "rubyzip", "~> 1.2"
24
24
  spec.add_dependency "faraday", "~> 0.13"
@@ -123,9 +123,9 @@ module RokuBuilder
123
123
  def test_core_get_plugin_by_name
124
124
  parser = OptionParser.new
125
125
  options = {}
126
- plugin_name = Core.get_plugin_by_name("loader")
127
- assert plugin_name
128
- assert_match "RokuBuilder::Loader", plugin_name.to_s
126
+ plugin_name = Core.get_plugin_by_name("core")
127
+ refute_nil plugin_name
128
+ assert_match "RokuBuilder::Core", plugin_name.to_s
129
129
  end
130
130
  end
131
131
  end
@@ -138,7 +138,7 @@ module RokuBuilder
138
138
  all_text = "midline "
139
139
  txt = "split\nBrightScript Debugger> "
140
140
 
141
- result = @monitor.send(:manage_text, {all_text: all_text, txt: txt})
141
+ result = @monitor.send(:manage_text, all_text: all_text, txt: txt)
142
142
 
143
143
  assert_equal "", result
144
144
 
@@ -148,7 +148,7 @@ module RokuBuilder
148
148
 
149
149
  def test_monitor_manage_text_connection_used
150
150
  assert_raises ExecutionError do
151
- @monitor.send(:manage_text, {all_text: "", txt: "Console connection is already in use."})
151
+ @monitor.send(:manage_text, all_text: "", txt: "Console connection is already in use.")
152
152
  end
153
153
  end
154
154
  end
@@ -67,7 +67,7 @@ module RokuBuilder
67
67
  tester = Tester.new(config: config)
68
68
 
69
69
  text = "this\nis\na\ntest\nparagraph"
70
- tester.send(:handle_text, {txt: text})
70
+ tester.send(:handle_text, txt: text)
71
71
 
72
72
  refute tester.instance_variable_get(:@in_tests)
73
73
  end
@@ -79,7 +79,7 @@ module RokuBuilder
79
79
 
80
80
  text = ["this","is","a","test","paragraph"]
81
81
 
82
- tester.send(:handle_text, {txt: text.join("\n")})
82
+ tester.send(:handle_text, txt: text.join("\n"))
83
83
  assert_equal text, tester.instance_variable_get(:@logs)
84
84
  assert tester.instance_variable_get(:@in_tests)
85
85
  end
@@ -91,7 +91,7 @@ module RokuBuilder
91
91
  text = ["this","*Start testing*","is","a","test","*End testing*","paragraph"]
92
92
  verify_text = ["***************","***************","*Start testing*","is","a","test","*End testing*","*************","*************"]
93
93
 
94
- tester.send(:handle_text, {txt: text.join("\n")})
94
+ tester.send(:handle_text, txt: text.join("\n"))
95
95
  refute tester.instance_variable_get(:@in_tests)
96
96
  assert_equal verify_text, tester.instance_variable_get(:@logs)
97
97
  end
@@ -103,7 +103,7 @@ module RokuBuilder
103
103
  text = ["connection already in use"]
104
104
 
105
105
  assert_raises IOError do
106
- tester.send(:handle_text, {txt: text.join("\n")})
106
+ tester.send(:handle_text, txt: text.join("\n"))
107
107
  end
108
108
  end
109
109
  end
@@ -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
@@ -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)
@@ -0,0 +1,8 @@
1
+ {
2
+ "keys": {
3
+ "test_key": {
4
+ "keyed_pkg": "/key/path",
5
+ "password": "password"
6
+ }
7
+ }
8
+ }
@@ -42,7 +42,7 @@ module RokuBuilder
42
42
  def test_logger_testing
43
43
  Logger.set_testing
44
44
  logger = Logger.instance
45
- assert_equal "/dev/null", logger.instance_variable_get(:@logdev).instance_variable_get(:@filename)
45
+ assert_nil logger.instance_variable_get(:@logdev).instance_variable_get(:@filename)
46
46
  end
47
47
  end
48
48
  end
@@ -26,7 +26,7 @@ module RokuBuilder
26
26
  parse_stub = lambda{ count+= 1; {validate: true} }
27
27
  options = Options.allocate
28
28
  options.stub(:parse, parse_stub) do
29
- options.send(:initialize, {options: {validate: true}})
29
+ options.send(:initialize, options: {validate: true})
30
30
  end
31
31
  assert_equal 0, count
32
32
  end
@@ -133,7 +133,7 @@ module RokuBuilder
133
133
  options = Options.allocate
134
134
  options.stub(:source_command?, true) do
135
135
  assert_raises InvalidOptions do
136
- options.send(:initialize, {options: {validate: true}})
136
+ options.send(:initialize, options: {validate: true})
137
137
  options.validate
138
138
  end
139
139
  end
@@ -164,7 +164,7 @@ module RokuBuilder
164
164
  logger.expect(:warn, nil, ["Depricated"])
165
165
  Logger.class_variable_set(:@@instance, logger)
166
166
  options.stub(:depricated_options, {validate: "Depricated"}) do
167
- options.send(:initialize, {options: {validate: true}})
167
+ options.send(:initialize, options: {validate: true})
168
168
  options.validate
169
169
  end
170
170
  logger.verify
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.22.9
4
+ version: 4.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2022-01-06 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
@@ -625,14 +626,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
625
626
  requirements:
626
627
  - - "~>"
627
628
  - !ruby/object:Gem::Version
628
- version: '2.3'
629
+ version: '3.0'
629
630
  required_rubygems_version: !ruby/object:Gem::Requirement
630
631
  requirements:
631
632
  - - ">="
632
633
  - !ruby/object:Gem::Version
633
634
  version: '0'
634
635
  requirements: []
635
- rubygems_version: 3.0.8
636
+ rubygems_version: 3.2.3
636
637
  signing_key:
637
638
  specification_version: 4
638
639
  summary: Build Tool for Roku Apps
@@ -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