roku_builder 4.27.1 → 4.28.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: f004d2edb610a728667cd7f9e64cb8ff2274a7592c192127b844f34323acbd39
4
- data.tar.gz: 8d5fa5f02a5b15e15ca1f4e02ee14be1cea8536902b8e8736ef99137baff7235
3
+ metadata.gz: 46e81906787a2404d186ec7a628e03c41a9b918c0f9af442c3bfd49e765df12b
4
+ data.tar.gz: befa6a6ba8d8f4ccac02080ac26644b010366cfbeefe3e13e278abadff48a75c
5
5
  SHA512:
6
- metadata.gz: feebd2677a569000a4d9d2ff3467d873c3d207491cbbdd62c76de3388752f245b57c026d8b1a949c31414f602f613cdf9e8c7f03b4189f0b8f3c9fd201e34af6
7
- data.tar.gz: 9fc9f42ef0eefbc4674b0f3e48ae21037480a416f1994e65eca6a309f0ea8f580ba70c045089609396950f1a3803503d61b3e73af0b7a2e12f517c5e22aff1dc
6
+ metadata.gz: 2d332bb657dcbb40691b521e8c65f8dca2357ad7fb53e94af334c1e5c9e8acabe4e0dc4eaa5f3bc40fd13e1190d2a2ac201dd9cb61c6258baf8bbbb88592f9a1
7
+ data.tar.gz: d0ab2b92f24d46a305ee943635e75e2513240679db8316b71591b3dc97e525689155e79acf7fe8560fdd2777b0887330f0f4f4c94ecb379bafa2ccfcf060daa4
@@ -23,7 +23,8 @@ module RokuBuilder
23
23
  load_config
24
24
  end
25
25
 
26
- def parse(stage: nil)
26
+ def parse(stage: nil, options: nil)
27
+ @options = options if options
27
28
  @options[:stage] = stage if stage
28
29
  @parsed = ConfigParser.parse(options: @options, config: @config)
29
30
  end
@@ -29,6 +29,7 @@ module RokuBuilder
29
29
  setup_key_config
30
30
  setup_root_dir
31
31
  setup_input_mappings
32
+ setup_console_log
32
33
  end
33
34
 
34
35
  def process_in_argument
@@ -212,5 +213,9 @@ module RokuBuilder
212
213
  def setup_input_mappings
213
214
  @parsed[:input_mappings] = @config[:input_mappings]
214
215
  end
216
+
217
+ def setup_console_log
218
+ @parsed[:console_log] = @config[:console_log]
219
+ end
215
220
  end
216
221
  end
@@ -59,6 +59,14 @@ module RokuBuilder
59
59
  end
60
60
  parser.separator ""
61
61
  parser.separator "Other Options:"
62
+ parser.on("-L", "--console_log [FILE]", "Save monitor logs in file") do |l|
63
+ options[:logfile] = l || "config"
64
+ options[:logging] = true
65
+ end
66
+ parser.on("-C", "--clear_log [FILE]", "Clear saved monitor logs in file") do |l|
67
+ options[:logfile] = l || "config"
68
+ options[:clearfile] = true
69
+ end
62
70
  parser.on("-O", "--out PATH", "Output file/folder. If PATH ends in .pkg/.zip/.jpg, file is assumed, otherwise folder is assumed") do |o|
63
71
  options[:out] = o
64
72
  end
@@ -51,6 +51,18 @@ module RokuBuilder
51
51
 
52
52
  # Sideload an app onto a roku device
53
53
  def sideload(options:, device: nil)
54
+ if !options[:logfile].nil?
55
+ if options[:logfile].match("config")
56
+ options[:logfile] = @config.console_log
57
+ end
58
+ if options[:clearfile]
59
+ if !options[:logfile].nil?
60
+ File.delete(options[:logfile]) if File.exist?(options[:logfile])
61
+ else
62
+ @logger.unknown "Cannot clear, console_log file not set."
63
+ end
64
+ end
65
+ end
54
66
  did_build = false
55
67
  unless options[:in]
56
68
  did_build = true
@@ -33,6 +33,26 @@ module RokuBuilder
33
33
  # Monitor a development log on the Roku device
34
34
  def monitor(options:)
35
35
  get_device(no_lock: true) do |device|
36
+ if !options[:logfile].nil?
37
+ if options[:logfile].match("config")
38
+ options[:logfile] = @config.console_log
39
+ end
40
+ if options[:clearfile]
41
+ if !options[:logfile].nil?
42
+ File.delete(options[:logfile]) if File.exist?(options[:logfile])
43
+ else
44
+ @logger.unknown "Cannot clear, console_log file not set."
45
+ end
46
+ end
47
+ end
48
+ if options[:logging]
49
+ if !options[:logfile].nil?
50
+ @logger.unknown "Logging to: " + options[:logfile]
51
+ else
52
+ @logger.unknown "Cannot log, console_log file not set."
53
+ options[:logging] = false
54
+ end
55
+ end
36
56
  type = options[:monitor].to_sym
37
57
  telnet_config = { 'Host' => device.ip, 'Port' => @ports[type] }
38
58
  waitfor_config = { 'Match' => /./, 'Timeout' => false }
@@ -44,7 +64,7 @@ module RokuBuilder
44
64
  all_text = ""
45
65
  while true
46
66
  connection.waitfor(waitfor) do |txt|
47
- all_text = manage_text(all_text: all_text, txt: txt, regexp: options[:regexp])
67
+ all_text = manage_text(all_text: all_text, txt: txt, regexp: options[:regexp], logging: options[:logging], logfile: options[:logfile])
48
68
  end
49
69
  end
50
70
  }
@@ -115,7 +135,7 @@ module RokuBuilder
115
135
  # @param txt [String] current string from telnet
116
136
  # @param regexp [Regexp] regular expression to filter text on
117
137
  # @return [String] remaining partial line text
118
- def manage_text(all_text:, txt:, regexp: nil)
138
+ def manage_text(all_text:, txt:, regexp: nil, logging: false, logfile:)
119
139
  raise ExecutionError, "Connection Closed" unless txt
120
140
  if /connection is already in use/ =~ txt
121
141
  raise ExecutionError, "Connection is in use"
@@ -124,6 +144,11 @@ module RokuBuilder
124
144
  while line = all_text.slice!(/^.*\n/) do
125
145
  if !line.strip.empty?
126
146
  puts line if regexp.nil? or line.match(regexp)
147
+ if logging
148
+ open(logfile, 'a') do |f|
149
+ f.puts line
150
+ end
151
+ end
127
152
  end
128
153
  end
129
154
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.27.1"
5
+ VERSION = "4.28.0"
6
6
  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.27.1
4
+ version: 4.28.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-12-13 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip