roku_builder 4.27.1 → 4.27.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f004d2edb610a728667cd7f9e64cb8ff2274a7592c192127b844f34323acbd39
4
- data.tar.gz: 8d5fa5f02a5b15e15ca1f4e02ee14be1cea8536902b8e8736ef99137baff7235
3
+ metadata.gz: efc602510a82d3cff193e13043545a4ce51ce65cc44efe011e95bfac75a6a820
4
+ data.tar.gz: b9d38640ea2be785eb4fc370216ab6f8cb82edf6e54027eed2a3abd2812a0c4a
5
5
  SHA512:
6
- metadata.gz: feebd2677a569000a4d9d2ff3467d873c3d207491cbbdd62c76de3388752f245b57c026d8b1a949c31414f602f613cdf9e8c7f03b4189f0b8f3c9fd201e34af6
7
- data.tar.gz: 9fc9f42ef0eefbc4674b0f3e48ae21037480a416f1994e65eca6a309f0ea8f580ba70c045089609396950f1a3803503d61b3e73af0b7a2e12f517c5e22aff1dc
6
+ metadata.gz: ad5fa526a32f9fa53e12d78d6243eb2381c5b8c7c43877718c319c8eb70537eda7de8f649de242611155f1638f3730ea51cd5543d94d69b181d1c527d331b36a
7
+ data.tar.gz: e7bdab7f64cdbb74bc0bcae86b8c6d5b6b551ac4da95b0e547562470022bb32b25b3744a91e6f148a577eeb4ebd52093a86972e90e5ca07c517cb8abb88d08d8
@@ -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.27.2"
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.27.2
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-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip