roku_builder 4.22.7 → 4.23.1

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: 69615f3a8b72c6ab7583a501c9fca23c3988a4256a542301a9c93ac2eca56136
4
- data.tar.gz: 270e35b7fc859dc9730aa915c3444fe16135f6a98529dbcef95b3a9d4122c4e3
3
+ metadata.gz: 1d1ca3fbc26d92a86625530b1578517b2db8f0932f10a723e27e471a08d848da
4
+ data.tar.gz: 8c06399f94abd5dd482bce4111da7f647ca16497ab021ffc838c0387d924691c
5
5
  SHA512:
6
- metadata.gz: 5ea0f11db87686bf2c476dc7584fbb1fb4c62a466d739740fafad06dfee6abc7727cc9ce93bd770ba2ef955ce5417df1e47f0536edc990eb1ee44dce3b4fad89
7
- data.tar.gz: 486cb4bdf607ad9fb427edc5a2a2e0429407654a1b9fe63463c6b92a015d3434a3fac4b3615984efd71ad4cb01ee0a99e95ae30224a708bdd8c2ec20f8ec0118
6
+ metadata.gz: ebd9c0cddf2a18fd73f69c864152b2e78fa942bb1ffc63862f35ad767623b3d9e109c14aa0fca8b5f5a7511967732677bb6f885aec5db8908ab8ac56257228bd
7
+ data.tar.gz: a6e9341c1e88ed59b10a6c2aafc6c9cff8646509e0cc7fa6092b549724d8964a5a2d822a67561fd058853b8fd8d80a25bc5df2acd4ccdf1bb10c6053f4b9d110
@@ -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,10 +169,12 @@ 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
 
@@ -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
 
@@ -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 this message") do
79
- puts parser
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
@@ -50,11 +50,13 @@ module RokuBuilder
50
50
  elsif @prev_line =~ /^\s*\bfunction\b|^\s*\bsub\b/i
51
51
  @ind += @count
52
52
  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
53
+ unless @prev_line =~ /\bthen\b[ \t]*[^' \r\n]+.*$/i or @prev_line =~ /\breturn\b/i
54
54
  @ind += @count
55
55
  end
56
56
  elsif @prev_line =~ /^\s*\bfor\b|^\s*\bwhile\b/i
57
57
  @ind += @count
58
+ elsif @prev_line =~ /^\s*\btry\b|^\s*\bcatch\b/i
59
+ @ind += @count
58
60
  end
59
61
  end
60
62
  if line =~ /^\'/ or line =~ /\'indent-ignore/
@@ -62,11 +64,13 @@ module RokuBuilder
62
64
  elsif line =~ /^\s*[\}\]\)]/
63
65
  @ind -= @count
64
66
  elsif line =~ /^\s*\bfunction\b|^\s*\bsub\b/i
65
- @ind -= 0
67
+ # Don't change indentation
66
68
  elsif line =~ /^\s*:?\s*#?end\b|^\s*#?endif\b|^\s*endfor\b|^\s*\bnext\b/i
67
69
  @ind -= @count
68
70
  elsif line =~ /^\s*#?else\b|^\s*elseif\b/i
69
71
  @ind -= @count
72
+ elsif line =~ /^\s*#?catch\b/i
73
+ @ind -= @count
70
74
  end
71
75
  end
72
76
  end
@@ -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.7"
5
+ VERSION = "4.23.1"
6
6
  end
@@ -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
@@ -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
+ }
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.7
4
+ version: 4.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2021-09-24 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