roku_builder 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/Gemfile.lock +10 -5
- data/README.md +0 -2
- data/intergration/roku_builder/test_helper.rb +3 -1
- data/intergration/roku_builder/test_loader.rb +2 -2
- data/intergration/roku_builder/test_packager.rb +21 -2
- data/intergration/roku_builder/test_profiler.rb +10 -10
- data/lib/roku_builder.rb +1 -1
- data/lib/roku_builder/manifest.rb +1 -2
- data/lib/roku_builder/plugins/loader.rb +6 -1
- data/lib/roku_builder/plugins/monitor.rb +4 -0
- data/lib/roku_builder/plugins/navigator.rb +19 -7
- data/lib/roku_builder/plugins/packager.rb +6 -3
- data/lib/roku_builder/plugins/profiler.rb +4 -3
- data/lib/roku_builder/version.rb +1 -1
- data/roku_builder.gemspec +1 -1
- data/test/roku_builder/plugins/test_monitor.rb +41 -28
- data/test/roku_builder/plugins/test_navigator.rb +19 -5
- data/test/roku_builder/plugins/test_packager.rb +23 -1
- data/test/roku_builder/test_helper.rb +6 -2
- data/test/roku_builder/test_manifest.rb +2 -2
- data/test/roku_builder/test_roku_builder.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 573c78252bcce4dea40430de90789acd0d4f3a05
|
4
|
+
data.tar.gz: 8c96b5bfa0b1f2dcab2c8b19f47fe477f972e604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e144ca75cb797bbe36846cdcfc17512ac6c13333712d7e3862e4d90e0d0d455d28f1c83c308fc2a91bdc66efaed910024199db0158e691c1a579d23a0f75597
|
7
|
+
data.tar.gz: d41bb3e7113cd436cc2418e9c2f7c9a1288565bf140e373ccaf89c9da76c5a4464c1d34532d2be2de592804bcd18519e96a19df77808768da3b34a1afe45ea06
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
= 4.1.0 =
|
2
|
+
|
3
|
+
- Remove unnecessary default manifest values
|
4
|
+
- Print PKG path when packaging with --verbose
|
5
|
+
- Add build number to default out file name for packager
|
6
|
+
- Fail with useful message when packaging without configured key
|
7
|
+
- Monitor will check for used connection
|
8
|
+
- Screens command now prints all key combinations
|
9
|
+
- Replace nokogiri with oga
|
10
|
+
|
1
11
|
= 4.0.1 =
|
2
12
|
|
3
13
|
- Fix sideload bug
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
roku_builder (4.0
|
4
|
+
roku_builder (4.1.0)
|
5
5
|
faraday (~> 0.12)
|
6
6
|
faraday-digestauth (~> 0.2)
|
7
7
|
git (~> 1.3)
|
8
8
|
net-ping (~> 2.0)
|
9
9
|
net-telnet (~> 0.1)
|
10
|
-
|
10
|
+
oga (~> 2.10)
|
11
11
|
rubyzip (~> 1.2)
|
12
12
|
win32-security (~> 0.5)
|
13
13
|
|
@@ -16,6 +16,8 @@ GEM
|
|
16
16
|
specs:
|
17
17
|
addressable (2.5.1)
|
18
18
|
public_suffix (~> 2.0, >= 2.0.2)
|
19
|
+
ansi (1.5.0)
|
20
|
+
ast (2.3.0)
|
19
21
|
byebug (9.0.6)
|
20
22
|
coderay (1.1.1)
|
21
23
|
coveralls (0.8.21)
|
@@ -61,7 +63,6 @@ GEM
|
|
61
63
|
method_source (>= 0.6.7)
|
62
64
|
rake (>= 0.9.2.2)
|
63
65
|
method_source (0.8.2)
|
64
|
-
mini_portile2 (2.2.0)
|
65
66
|
minitest (5.10.2)
|
66
67
|
minitest-autotest (1.0.3)
|
67
68
|
minitest-server (~> 1.0)
|
@@ -74,11 +75,12 @@ GEM
|
|
74
75
|
net-http-digest_auth (1.4.1)
|
75
76
|
net-ping (2.0.1)
|
76
77
|
net-telnet (0.1.1)
|
77
|
-
nokogiri (1.8.0)
|
78
|
-
mini_portile2 (~> 2.2.0)
|
79
78
|
notiffany (0.1.1)
|
80
79
|
nenv (~> 0.1)
|
81
80
|
shellany (~> 0.0)
|
81
|
+
oga (2.10)
|
82
|
+
ast
|
83
|
+
ruby-ll (~> 2.1)
|
82
84
|
pry (0.10.4)
|
83
85
|
coderay (~> 1.1.0)
|
84
86
|
method_source (~> 0.8.1)
|
@@ -88,6 +90,9 @@ GEM
|
|
88
90
|
rb-fsevent (0.9.8)
|
89
91
|
rb-inotify (0.9.8)
|
90
92
|
ffi (>= 0.5.0)
|
93
|
+
ruby-ll (2.1.2)
|
94
|
+
ansi
|
95
|
+
ast
|
91
96
|
ruby_dep (1.5.0)
|
92
97
|
rubyzip (1.2.1)
|
93
98
|
safe_yaml (1.0.4)
|
data/README.md
CHANGED
@@ -15,6 +15,8 @@ require "minitest/autorun"
|
|
15
15
|
require "minitest/utils"
|
16
16
|
require "securerandom"
|
17
17
|
|
18
|
+
ROKU_IP = "192.168.1.114"
|
19
|
+
|
18
20
|
module Minitest
|
19
21
|
module Assertions
|
20
22
|
def wait_assert(timeout = 10, msg = nil)
|
@@ -103,7 +105,7 @@ module Helpers
|
|
103
105
|
devices: {
|
104
106
|
default: :roku,
|
105
107
|
roku: {
|
106
|
-
ip:
|
108
|
+
ip: ROKU_IP,
|
107
109
|
user: "rokudev",
|
108
110
|
password: "aaaa"
|
109
111
|
}
|
@@ -17,14 +17,14 @@ module RokuBuilder
|
|
17
17
|
def test_sideload
|
18
18
|
output = `#{roku} --sideload --stage production`
|
19
19
|
assert_log @uuid
|
20
|
-
|
20
|
+
refute_match(/WARN: Missing File/, output)
|
21
21
|
end
|
22
22
|
def test_delete
|
23
23
|
`#{roku} --sideload --working`
|
24
24
|
assert_log @uuid
|
25
25
|
`#{roku} --delete`
|
26
26
|
output = `#{roku} --app-list`
|
27
|
-
|
27
|
+
refute_match(/\|\s*dev\s*\|/, output)
|
28
28
|
end
|
29
29
|
def test_build
|
30
30
|
target = File.join(testfiles_path(LoaderIntergrationTest), "out.zip")
|
@@ -18,10 +18,29 @@ module RokuBuilder
|
|
18
18
|
target = File.join(testfiles_path(PackagerIntergrationTest), "pkg.pkg")
|
19
19
|
FileUtils.rm(target) if File.exist?(target)
|
20
20
|
output = `#{roku} --package --stage production --out #{target}`
|
21
|
-
|
21
|
+
refute_match(/WARN: Missing File/, output)
|
22
22
|
wait_assert {File.exist?(target)}
|
23
|
+
refute File.exist?(target+".zip")
|
23
24
|
FileUtils.rm(target) if File.exist?(target)
|
24
|
-
|
25
|
+
end
|
26
|
+
def test_package_output
|
27
|
+
target = File.join(testfiles_path(PackagerIntergrationTest), "pkg.pkg")
|
28
|
+
FileUtils.rm(target) if File.exist?(target)
|
29
|
+
output = `#{roku} --package --stage production --out #{target} -V`
|
30
|
+
refute_match(/WARN: Missing File/, output)
|
31
|
+
assert_match(/#{target}/, output)
|
32
|
+
wait_assert {File.exist?(target)}
|
33
|
+
refute File.exist?(target+".zip")
|
34
|
+
FileUtils.rm(target) if File.exist?(target)
|
35
|
+
end
|
36
|
+
def test_package_no_key
|
37
|
+
config = good_config(PackagerIntergrationTest)
|
38
|
+
config[:projects][:project1][:stages][:production].delete(:key)
|
39
|
+
@config = build_config(PackagerIntergrationTest, nil, config)
|
40
|
+
target = File.join(testfiles_path(PackagerIntergrationTest), "pkg.pkg")
|
41
|
+
FileUtils.rm(target) if File.exist?(target)
|
42
|
+
output = `#{roku} --package --stage production --out #{target}`
|
43
|
+
assert_match(/FATAL:.*Missing Key/, output)
|
25
44
|
end
|
26
45
|
def test_key
|
27
46
|
target = File.join(testfiles_path(PackagerIntergrationTest), "pkg.pkg")
|
@@ -18,31 +18,31 @@ module RokuBuilder
|
|
18
18
|
`#{roku} --sideload --working`
|
19
19
|
assert_log @uuid
|
20
20
|
output = `#{roku} --profile stats`
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
assert_match(/Name \| Count/, output)
|
22
|
+
assert_match(/Total \|\s*5/, output)
|
23
|
+
assert_match(/Default \|\s*1/, output)
|
24
|
+
assert_match(/RectangleExample \|\s*1/, output)
|
25
|
+
assert_match(/Poster \|\s*1/, output)
|
26
|
+
assert_match(/Node \|\s*1/, output)
|
27
|
+
assert_match(/Rectangle \|\s*1/, output)
|
28
28
|
end
|
29
29
|
def test_profile_all
|
30
30
|
`#{roku} --sideload --working`
|
31
31
|
assert_log @uuid
|
32
32
|
output = `#{roku} --profile all`
|
33
|
-
|
33
|
+
assert_match(/RectangleExample/, output)
|
34
34
|
end
|
35
35
|
def test_profile_images
|
36
36
|
`#{roku} --sideload --working`
|
37
37
|
assert_log @uuid
|
38
38
|
output = `#{roku} --profile images`
|
39
|
-
|
39
|
+
assert_match(/Available memory/, output)
|
40
40
|
end
|
41
41
|
def test_profile_textures
|
42
42
|
`#{roku} --sideload --working`
|
43
43
|
assert_log @uuid
|
44
44
|
output = `#{roku} --profile textures`
|
45
|
-
|
45
|
+
assert_match(/System textures/, output)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/roku_builder.rb
CHANGED
@@ -111,9 +111,8 @@ module RokuBuilder
|
|
111
111
|
major_version: 1,
|
112
112
|
minor_version: 0,
|
113
113
|
build_version: "010101.0001",
|
114
|
-
mm_icon_focus_fhd: "<insert fhd focus icon url>",
|
115
114
|
mm_icon_focus_hd: "<insert hd focus icon url>",
|
116
|
-
|
115
|
+
splash_screen_fhd: "<insert fhd splash screen url>"
|
117
116
|
}
|
118
117
|
end
|
119
118
|
end
|
@@ -43,9 +43,10 @@ module RokuBuilder
|
|
43
43
|
did_build = true
|
44
44
|
build(options: options)
|
45
45
|
end
|
46
|
+
keep_build_file = is_build_command(options) and options[:out]
|
46
47
|
upload
|
47
48
|
# Cleanup
|
48
|
-
File.delete(file_path(:in)) if did_build and not
|
49
|
+
File.delete(file_path(:in)) if did_build and not keep_build_file
|
49
50
|
end
|
50
51
|
|
51
52
|
|
@@ -67,6 +68,10 @@ module RokuBuilder
|
|
67
68
|
|
68
69
|
private
|
69
70
|
|
71
|
+
def is_build_command(options)
|
72
|
+
[:sideload, :build].include? options.command
|
73
|
+
end
|
74
|
+
|
70
75
|
def upload
|
71
76
|
payload = {
|
72
77
|
mysubmit: "Replace",
|
@@ -47,6 +47,7 @@ module RokuBuilder
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
}
|
50
|
+
thread.abort_on_exception = true
|
50
51
|
|
51
52
|
init_readline()
|
52
53
|
|
@@ -112,6 +113,9 @@ module RokuBuilder
|
|
112
113
|
# @param regexp [Regexp] regular expression to filter text on
|
113
114
|
# @return [String] remaining partial line text
|
114
115
|
def manage_text(all_text:, txt:, regexp: nil)
|
116
|
+
if /connection is already in use/ =~ txt
|
117
|
+
raise ExecutionError, "Connection is in use"
|
118
|
+
end
|
115
119
|
all_text += txt
|
116
120
|
while line = all_text.slice!(/^.*\n/) do
|
117
121
|
if !line.strip.empty?
|
@@ -129,13 +129,21 @@ module RokuBuilder
|
|
129
129
|
nav(options: {nav: @screens[type].join(", ")})
|
130
130
|
else
|
131
131
|
@logger.unknown("Cannot run command automatically")
|
132
|
+
display_screen_command(type)
|
132
133
|
end
|
133
|
-
display_screen_command(type)
|
134
134
|
end
|
135
135
|
|
136
136
|
# Show avaiable roku secret screens
|
137
137
|
def screens(options:)
|
138
|
-
|
138
|
+
logger = ::Logger.new(STDOUT)
|
139
|
+
logger.formatter = proc {|_severity, _datetime, _progname, msg|
|
140
|
+
"%s\n\r" % [msg]
|
141
|
+
}
|
142
|
+
logger.unknown("----------------------------------------------------------------------")
|
143
|
+
@screens.keys.each {|screen|
|
144
|
+
logger.unknown(sprintf("%10s: %s", screen.to_s, get_screen_command(screen)))
|
145
|
+
logger.unknown("----------------------------------------------------------------------")
|
146
|
+
}
|
139
147
|
end
|
140
148
|
|
141
149
|
private
|
@@ -208,6 +216,14 @@ module RokuBuilder
|
|
208
216
|
end
|
209
217
|
|
210
218
|
def display_screen_command(type)
|
219
|
+
logger = ::Logger.new(STDOUT)
|
220
|
+
logger.formatter = proc {|_severity, _datetime, _progname, msg|
|
221
|
+
"%s\n\r" % [msg]
|
222
|
+
}
|
223
|
+
logger.unknown(get_screen_command(type))
|
224
|
+
end
|
225
|
+
|
226
|
+
def get_screen_command(type)
|
211
227
|
display, count, string = [], [], ""
|
212
228
|
@screens[type].each do |command|
|
213
229
|
if display.count > 0 and display[-1] == command
|
@@ -224,11 +240,7 @@ module RokuBuilder
|
|
224
240
|
string = string + @commands[display[i]]+", "
|
225
241
|
end
|
226
242
|
end
|
227
|
-
|
228
|
-
@logger.info(string.strip)
|
229
|
-
else
|
230
|
-
@logger.unknown(string.strip)
|
231
|
-
end
|
243
|
+
string.strip
|
232
244
|
end
|
233
245
|
end
|
234
246
|
RokuBuilder.register_plugin(Navigator)
|
@@ -84,6 +84,8 @@ module RokuBuilder
|
|
84
84
|
def key(options:)
|
85
85
|
oldId = dev_id
|
86
86
|
|
87
|
+
raise ExecutionError, "Missing Key Config" unless @config.key
|
88
|
+
|
87
89
|
# upload new key with password
|
88
90
|
payload = {
|
89
91
|
mysubmit: "Rekey",
|
@@ -146,17 +148,18 @@ module RokuBuilder
|
|
146
148
|
out_file = nil
|
147
149
|
unless @config.out[:file]
|
148
150
|
out = @config.out
|
151
|
+
build_version = Manifest.new(config: @config).build_version
|
149
152
|
if stage
|
150
|
-
out[:file] = "#{@config.project[:app_name]}_#{stage}"
|
153
|
+
out[:file] = "#{@config.project[:app_name]}_#{stage}_#{build_version}"
|
151
154
|
else
|
152
|
-
out[:file] = "#{@config.project[:app_name]}
|
155
|
+
out[:file] = "#{@config.project[:app_name]}_working_#{build_version}"
|
153
156
|
end
|
154
157
|
@config.out = out
|
155
158
|
end
|
156
159
|
out_file = File.join(@config.out[:folder], @config.out[:file])
|
157
160
|
out_file = out_file+".pkg" unless out_file.end_with?(".pkg")
|
158
161
|
File.open(out_file, 'w+') {|fp| fp.write(response.body)}
|
159
|
-
|
162
|
+
@logger.info("Outfile: #{out_file}")
|
160
163
|
end
|
161
164
|
|
162
165
|
# Uses the device to generate a new signing key
|
@@ -41,8 +41,8 @@ module RokuBuilder
|
|
41
41
|
lines = get_command_response(command: "sgnodes all", start_reg: start_reg, end_reg: end_reg)
|
42
42
|
xml_string = lines.join("\n")
|
43
43
|
stats = {"Total" => 0}
|
44
|
-
doc =
|
45
|
-
handle_node(stats: stats, node: doc.
|
44
|
+
doc = Oga.parse_xml(xml_string)
|
45
|
+
handle_node(stats: stats, node: doc.children.first)
|
46
46
|
stats = stats.to_a
|
47
47
|
stats = stats.sort {|a, b| b[1] <=> a[1]}
|
48
48
|
printf "%30s | %5s\n", "Name", "Count"
|
@@ -52,7 +52,8 @@ module RokuBuilder
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def handle_node(stats:, node:)
|
55
|
-
node.
|
55
|
+
node.children.each do |element|
|
56
|
+
next unless element.class == Oga::XML::Element
|
56
57
|
stats[element.name] ||= 0
|
57
58
|
stats[element.name] += 1
|
58
59
|
stats["Total"] += 1
|
data/lib/roku_builder/version.rb
CHANGED
data/roku_builder.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency "git", "~> 1.3"
|
27
27
|
spec.add_dependency "net-ping", "~> 2.0"
|
28
28
|
spec.add_dependency "net-telnet", "~> 0.1"
|
29
|
-
spec.add_dependency "
|
29
|
+
spec.add_dependency "oga", "~> 2.10"
|
30
30
|
spec.add_dependency "win32-security", "~> 0.5" # For windows compatibility
|
31
31
|
|
32
32
|
spec.add_development_dependency "bundler", "~> 1.7"
|
@@ -12,7 +12,9 @@ module RokuBuilder
|
|
12
12
|
end
|
13
13
|
@options = build_options({monitor: "main"}, false)
|
14
14
|
@config = Config.new(options: @options)
|
15
|
-
@connection =
|
15
|
+
@connection = Object.new()
|
16
|
+
@connection.define_singleton_method(:waitfor) {}
|
17
|
+
@connection.define_singleton_method(:puts) {}
|
16
18
|
device_config = {
|
17
19
|
ip: "111.222.333",
|
18
20
|
user: "user",
|
@@ -21,9 +23,6 @@ module RokuBuilder
|
|
21
23
|
@config.instance_variable_set(:@parsed, {device_config: device_config, init_params: {}})
|
22
24
|
@monitor = Monitor.new(config: @config)
|
23
25
|
end
|
24
|
-
def teardown
|
25
|
-
@connection.verify
|
26
|
-
end
|
27
26
|
def test_scripter_parse_options_long
|
28
27
|
parser = OptionParser.new
|
29
28
|
options = {}
|
@@ -43,11 +42,10 @@ module RokuBuilder
|
|
43
42
|
assert_equal "regexp", options[:regexp]
|
44
43
|
end
|
45
44
|
def test_monitor_monit
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
count = 0
|
46
|
+
waitfor = proc {
|
47
|
+
count += 1
|
48
|
+
}
|
51
49
|
readline = proc {
|
52
50
|
sleep(0.1)
|
53
51
|
"q"
|
@@ -55,47 +53,50 @@ module RokuBuilder
|
|
55
53
|
|
56
54
|
Readline.stub(:readline, readline) do
|
57
55
|
Net::Telnet.stub(:new, @connection) do
|
58
|
-
@
|
56
|
+
@connection.stub(:waitfor, waitfor, "txt") do
|
57
|
+
@monitor.monitor(options: @options)
|
58
|
+
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
assert count > 0
|
62
63
|
end
|
63
64
|
|
64
65
|
def test_monitor_monit_and_manage
|
65
66
|
@monitor.instance_variable_set(:@show_prompt, true)
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
txt = "Fake Text"
|
71
|
-
blk.call(txt) == ""
|
72
|
-
end
|
73
|
-
|
67
|
+
count = 0
|
68
|
+
waitfor = proc {
|
69
|
+
count += 1
|
70
|
+
}
|
74
71
|
readline = proc {
|
75
72
|
sleep(0.1)
|
76
73
|
"q"
|
77
74
|
}
|
78
|
-
|
79
75
|
Readline.stub(:readline, readline) do
|
80
76
|
Net::Telnet.stub(:new, @connection) do
|
81
|
-
@
|
82
|
-
@monitor.
|
77
|
+
@connection.stub(:waitfor, waitfor, "txt") do
|
78
|
+
@monitor.stub(:manage_text, "") do
|
79
|
+
@monitor.monitor(options: @options)
|
80
|
+
end
|
83
81
|
end
|
84
82
|
end
|
85
83
|
end
|
84
|
+
assert count > 0
|
86
85
|
end
|
87
86
|
|
88
87
|
def test_monitor_monit_input
|
89
88
|
@monitor.instance_variable_set(:@show_prompt, true)
|
89
|
+
wait_count = 0
|
90
|
+
waitfor = proc {
|
91
|
+
wait_count += 1
|
92
|
+
}
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
@connection.expect(:puts, nil) do |text|
|
94
|
+
puts_count = 0
|
95
|
+
puts = proc { |text|
|
96
|
+
puts_count += 1
|
96
97
|
assert_equal("text", text)
|
97
98
|
@monitor.instance_variable_set(:@show_prompt, true)
|
98
|
-
|
99
|
+
}
|
99
100
|
|
100
101
|
readline = proc {
|
101
102
|
@count ||= 0
|
@@ -111,9 +112,15 @@ module RokuBuilder
|
|
111
112
|
|
112
113
|
Readline.stub(:readline, readline) do
|
113
114
|
Net::Telnet.stub(:new, @connection) do
|
114
|
-
@
|
115
|
+
@connection.stub(:waitfor, waitfor, "txt") do
|
116
|
+
@connection.stub(:puts, puts) do
|
117
|
+
@monitor.monitor(options: @options)
|
118
|
+
end
|
119
|
+
end
|
115
120
|
end
|
116
121
|
end
|
122
|
+
assert wait_count > 0
|
123
|
+
assert puts_count > 0
|
117
124
|
end
|
118
125
|
|
119
126
|
def test_monitor_manage_text
|
@@ -137,5 +144,11 @@ module RokuBuilder
|
|
137
144
|
mock.verify
|
138
145
|
|
139
146
|
end
|
147
|
+
|
148
|
+
def test_monitor_manage_text_connection_used
|
149
|
+
assert_raises ExecutionError do
|
150
|
+
@monitor.send(:manage_text, {all_text: "", txt: "Console connection is already in use."})
|
151
|
+
end
|
152
|
+
end
|
140
153
|
end
|
141
154
|
end
|
@@ -105,7 +105,6 @@ module RokuBuilder
|
|
105
105
|
@requests.push(stub_request(:post, "http://192.168.0.100:8060/keypress/Rev").
|
106
106
|
to_return(status: 200, body: "", headers: {}))
|
107
107
|
|
108
|
-
logger.expect(:info, nil, ["Home x 5, Fwd x 3, Rev x 2,"])
|
109
108
|
5.times do
|
110
109
|
logger.expect(:debug, nil, ["Send Command: /keypress/Home"])
|
111
110
|
end
|
@@ -123,15 +122,19 @@ module RokuBuilder
|
|
123
122
|
end
|
124
123
|
def test_navigator_screen_reboot
|
125
124
|
logger = Minitest::Mock.new
|
125
|
+
command_logger = Minitest::Mock.new
|
126
126
|
Logger.class_variable_set(:@@instance, logger)
|
127
127
|
options = {screen: "reboot"}
|
128
128
|
config, options = build_config_options_objects(NavigatorTest, options, false)
|
129
129
|
navigator = Navigator.new(config: config)
|
130
130
|
|
131
131
|
logger.expect(:unknown, nil, ["Cannot run command automatically"])
|
132
|
-
|
132
|
+
command_logger.expect(:unknown, nil, ["Home x 5, Up, Rev x 2, Fwd x 2,"])
|
133
|
+
command_logger.expect(:formatter=, nil, [Proc])
|
133
134
|
|
134
|
-
|
135
|
+
::Logger.stub(:new, command_logger) do
|
136
|
+
navigator.screen(options: options)
|
137
|
+
end
|
135
138
|
|
136
139
|
logger.verify
|
137
140
|
Logger.set_testing
|
@@ -153,11 +156,22 @@ module RokuBuilder
|
|
153
156
|
config, options = build_config_options_objects(NavigatorTest, options, false)
|
154
157
|
navigator = Navigator.new(config: config)
|
155
158
|
|
159
|
+
logger.expect(:formatter=, nil, [Proc])
|
160
|
+
logger.expect(:unknown, nil) do |msg|
|
161
|
+
/-+/=~ msg
|
162
|
+
end
|
156
163
|
navigator.instance_variable_get("@screens").each_key do |key|
|
157
|
-
logger.expect(:unknown, nil
|
164
|
+
logger.expect(:unknown, nil) do |msg|
|
165
|
+
/#{key}:/=~ msg
|
166
|
+
end
|
167
|
+
logger.expect(:unknown, nil) do |msg|
|
168
|
+
/-+/=~ msg
|
169
|
+
end
|
158
170
|
end
|
159
171
|
|
160
|
-
|
172
|
+
::Logger.stub(:new, logger) do
|
173
|
+
navigator.screens(options: options)
|
174
|
+
end
|
161
175
|
|
162
176
|
logger.verify
|
163
177
|
Logger.set_testing
|
@@ -76,7 +76,8 @@ module RokuBuilder
|
|
76
76
|
loader = Minitest::Mock.new
|
77
77
|
inspector = Minitest::Mock.new
|
78
78
|
io = Minitest::Mock.new
|
79
|
-
|
79
|
+
logger = Minitest::Mock.new
|
80
|
+
config, options = build_config_options_objects(PackagerTest, {package: true, stage: "production", inspect_package: true, verbose: true}, false)
|
80
81
|
|
81
82
|
@requests.push(stub_request(:post, "http://192.168.0.100/plugin_inspect").
|
82
83
|
to_return(status: 200, body: "", headers: {}).times(2))
|
@@ -91,6 +92,13 @@ module RokuBuilder
|
|
91
92
|
io.expect(:write, nil, ["package_body"])
|
92
93
|
inspector.expect(:inspect, nil, [Hash])
|
93
94
|
|
95
|
+
logger.expect(:debug, nil, [String])
|
96
|
+
io.expect(:each_line, nil)
|
97
|
+
logger.expect(:info, nil) do |message|
|
98
|
+
assert_match(/\/tmp\//, message)
|
99
|
+
end
|
100
|
+
|
101
|
+
Logger.class_variable_set(:@@instance, logger)
|
94
102
|
packager = Packager.new(config: config)
|
95
103
|
dev_id = Proc.new {"#{Random.rand(999999999999)}"}
|
96
104
|
Loader.stub(:new, loader) do
|
@@ -107,6 +115,7 @@ module RokuBuilder
|
|
107
115
|
io.verify
|
108
116
|
loader.verify
|
109
117
|
inspector.verify
|
118
|
+
logger.verify
|
110
119
|
end
|
111
120
|
def test_packager_dev_id
|
112
121
|
body = "v class=\"roku-font-5\"><label>Your Dev ID: </label> dev_id<hr></div>"
|
@@ -179,6 +188,19 @@ module RokuBuilder
|
|
179
188
|
end
|
180
189
|
end
|
181
190
|
|
191
|
+
def test_packager_no_key
|
192
|
+
config = good_config(PackagerTest)
|
193
|
+
config[:projects][:project1][:stages][:production].delete(:key)
|
194
|
+
config, options = build_config_options_objects(PackagerTest, {key: true, stage: "production"}, false, config)
|
195
|
+
packager = Packager.new(config: config)
|
196
|
+
dev_id = Proc.new {"#{Random.rand(999999999999)}"}
|
197
|
+
assert_raises ExecutionError do
|
198
|
+
packager.stub(:dev_id, dev_id) do
|
199
|
+
packager.key(options: options)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
182
204
|
def test_packager_genkey
|
183
205
|
loader = Minitest::Mock.new
|
184
206
|
loader.expect(:sideload, nil, [Hash])
|
@@ -27,10 +27,14 @@ def register_plugins(plugin_class)
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
30
|
-
def build_config_options_objects(klass, options = {validate: true}, empty_plugins = true)
|
30
|
+
def build_config_options_objects(klass, options = {validate: true}, empty_plugins = true, config_hash = nil)
|
31
31
|
options = build_options(options, empty_plugins)
|
32
32
|
config = RokuBuilder::Config.new(options: options)
|
33
|
-
|
33
|
+
if config_hash
|
34
|
+
config.instance_variable_set(:@config, config_hash)
|
35
|
+
else
|
36
|
+
config.instance_variable_set(:@config, good_config(klass))
|
37
|
+
end
|
34
38
|
config.parse
|
35
39
|
[config, options]
|
36
40
|
end
|
@@ -37,6 +37,7 @@ module RokuBuilder
|
|
37
37
|
@config.instance_variable_set(:@parsed, {root_dir: File.join(@root_dir, "test.zip")})
|
38
38
|
manifest = Manifest.new(config: @config)
|
39
39
|
assert_equal "010101.1", manifest.build_version
|
40
|
+
@config.instance_variable_set(:@parsed, {root_dir: @root_dir})
|
40
41
|
end
|
41
42
|
def test_manifest_update_attributes
|
42
43
|
manifest = Manifest.new(config: @config)
|
@@ -70,9 +71,8 @@ module RokuBuilder
|
|
70
71
|
assert !!manifest.major_version
|
71
72
|
assert !!manifest.minor_version
|
72
73
|
assert !!manifest.build_version
|
73
|
-
assert !!manifest.mm_icon_focus_fhd
|
74
74
|
assert !!manifest.mm_icon_focus_hd
|
75
|
-
assert !!manifest.
|
75
|
+
assert !!manifest.splash_screen_fhd
|
76
76
|
end
|
77
77
|
def test_manifest_increment_build_version
|
78
78
|
manifest = Manifest.new(config: @config)
|
@@ -6,7 +6,7 @@ module RokuBuilder
|
|
6
6
|
class RokuBuilderTest < Minitest::Test
|
7
7
|
def setup
|
8
8
|
Logger.set_testing
|
9
|
-
RokuBuilder.
|
9
|
+
RokuBuilder.setup_plugins
|
10
10
|
@ping = Minitest::Mock.new
|
11
11
|
@options = build_options({validate: true, device_given: false, working: true})
|
12
12
|
@options.define_singleton_method(:device_commands){
|
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.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- greeneca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: oga
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '2.10'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '2.10'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: win32-security
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|