roku_builder 3.12.8 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/CHANGELOG +9 -0
- data/Gemfile.lock +17 -11
- data/bin/roku +4 -8
- data/lib/roku_builder.rb +16 -24
- data/lib/roku_builder/config.rb +213 -0
- data/lib/roku_builder/config_parser.rb +304 -267
- data/lib/roku_builder/config_validator.rb +149 -126
- data/lib/roku_builder/controller.rb +34 -184
- data/lib/roku_builder/controller_commands.rb +85 -79
- data/lib/roku_builder/error_handler.rb +0 -11
- data/lib/roku_builder/errors.rb +12 -0
- data/lib/roku_builder/inspector.rb +6 -4
- data/lib/roku_builder/keyer.rb +1 -1
- data/lib/roku_builder/loader.rb +1 -1
- data/lib/roku_builder/logger.rb +32 -0
- data/lib/roku_builder/manifest_manager.rb +2 -2
- data/lib/roku_builder/monitor.rb +1 -1
- data/lib/roku_builder/options.rb +113 -0
- data/lib/roku_builder/stager.rb +2 -2
- data/lib/roku_builder/tester.rb +57 -11
- data/lib/roku_builder/util.rb +3 -4
- data/lib/roku_builder/version.rb +1 -1
- data/roku_builder.gemspec +2 -1
- data/test/roku_builder/test_config.rb +168 -0
- data/test/roku_builder/test_config_parser.rb +347 -394
- data/test/roku_builder/test_config_validator.rb +193 -190
- data/test/roku_builder/test_controller.rb +59 -178
- data/test/roku_builder/test_controller_commands.rb +407 -394
- data/test/roku_builder/test_error_handler.rb +67 -69
- data/test/roku_builder/test_files/config_test/bad.json +2 -0
- data/test/roku_builder/test_files/config_test/child.json +11 -0
- data/test/roku_builder/test_files/config_test/config.json +29 -0
- data/test/roku_builder/test_files/config_test/non_json.json +1 -0
- data/test/roku_builder/test_files/config_test/parent.json +21 -0
- data/test/roku_builder/test_files/config_test/parent_projects.json +35 -0
- data/test/roku_builder/test_files/manifest_manager_test/manifest_template_2 +1 -1
- data/test/roku_builder/test_helper.rb +55 -45
- data/test/roku_builder/test_inspector.rb +278 -213
- data/test/roku_builder/test_keyer.rb +144 -147
- data/test/roku_builder/test_linker.rb +91 -95
- data/test/roku_builder/test_loader.rb +279 -289
- data/test/roku_builder/test_logger.rb +47 -0
- data/test/roku_builder/test_manifest_manager.rb +92 -94
- data/test/roku_builder/test_monitor.rb +101 -103
- data/test/roku_builder/test_navigator.rb +240 -245
- data/test/roku_builder/test_options.rb +156 -0
- data/test/roku_builder/test_packager.rb +108 -108
- data/test/roku_builder/test_profiler.rb +20 -19
- data/test/roku_builder/test_scripter.rb +83 -81
- data/test/roku_builder/test_stager.rb +299 -311
- data/test/roku_builder/test_tester.rb +112 -115
- data/test/roku_builder/test_util.rb +18 -17
- metadata +39 -6
- data/lib/roku_builder/config_manager.rb +0 -161
- data/test/roku_builder/test_config_manager.rb +0 -372
data/lib/roku_builder/stager.rb
CHANGED
@@ -5,11 +5,11 @@ module RokuBuilder
|
|
5
5
|
# Change stage of roku application
|
6
6
|
class Stager
|
7
7
|
|
8
|
-
def initialize(key: nil, method:, root_dir: nil
|
8
|
+
def initialize(key: nil, method:, root_dir: nil)
|
9
9
|
@method = method
|
10
10
|
@key = key
|
11
11
|
@root_dir = root_dir
|
12
|
-
@logger =
|
12
|
+
@logger = Logger.instance
|
13
13
|
@stage_success = true
|
14
14
|
@stash_key = "roku-builder-temp-stash"
|
15
15
|
end
|
data/lib/roku_builder/tester.rb
CHANGED
@@ -8,9 +8,16 @@ module RokuBuilder
|
|
8
8
|
class Tester < Util
|
9
9
|
|
10
10
|
# Initialize starting and ending regular expressions
|
11
|
-
def init()
|
12
|
-
@
|
13
|
-
@
|
11
|
+
def init(root_dir:)
|
12
|
+
@root_dir = root_dir
|
13
|
+
@end_reg = /\*+\s*End testing\s*\*+/
|
14
|
+
@start_reg = /\*+\s*Start testing\s*\*+/
|
15
|
+
@test_logger = ::Logger.new(STDOUT)
|
16
|
+
@test_logger.formatter = proc {|_severity, _datetime, _progname, msg|
|
17
|
+
"%s\n\r" % [msg]
|
18
|
+
}
|
19
|
+
@in_tests = false
|
20
|
+
@logs = []
|
14
21
|
end
|
15
22
|
|
16
23
|
# Run tests and report results
|
@@ -21,15 +28,21 @@ module RokuBuilder
|
|
21
28
|
'Port' => 8085
|
22
29
|
}
|
23
30
|
|
31
|
+
@device_config[:init_params] = {
|
32
|
+
root_dir: @root_dir
|
33
|
+
}
|
24
34
|
loader = Loader.new(**@device_config)
|
25
35
|
connection = Net::Telnet.new(telnet_config)
|
26
36
|
code, _build_version = loader.sideload(**sideload_config)
|
27
|
-
|
28
37
|
if code == SUCCESS
|
29
|
-
|
38
|
+
@device_config[:init_params] = nil
|
39
|
+
linker = Linker.new(**@device_config)
|
40
|
+
linker.launch(options: "RunTests:true")
|
41
|
+
|
30
42
|
connection.waitfor(@end_reg) do |txt|
|
31
|
-
|
43
|
+
handle_text(txt: txt)
|
32
44
|
end
|
45
|
+
print_logs
|
33
46
|
connection.puts("cont\n")
|
34
47
|
end
|
35
48
|
end
|
@@ -40,13 +53,46 @@ module RokuBuilder
|
|
40
53
|
# @param txt [String] current text from telnet
|
41
54
|
# @param in_tests [Boolean] currently parsing test text
|
42
55
|
# @return [Boolean] currently parsing test text
|
43
|
-
def handle_text(txt
|
56
|
+
def handle_text(txt:)
|
57
|
+
check_for_used_connection(txt: txt)
|
44
58
|
txt.split("\n").each do |line|
|
45
|
-
|
46
|
-
@
|
47
|
-
|
59
|
+
check_for_end(line: line)
|
60
|
+
@logs.push line if @in_tests
|
61
|
+
check_for_start(line: line)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def check_for_used_connection(txt:)
|
66
|
+
if txt =~ /connection already in use/
|
67
|
+
raise IOError, "Telnet Connection Already in Use"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def check_for_end(line:)
|
72
|
+
if line =~ @end_reg
|
73
|
+
@in_tests = false
|
74
|
+
breakline = line.gsub(/./, '*')
|
75
|
+
@logs.push line
|
76
|
+
@logs.push breakline
|
77
|
+
@logs.push breakline
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def check_for_start(line:)
|
82
|
+
if line =~ @start_reg
|
83
|
+
@logs = []
|
84
|
+
@in_tests = true
|
85
|
+
breakline = line.gsub(/./, '*')
|
86
|
+
@logs.push breakline
|
87
|
+
@logs.push breakline
|
88
|
+
@logs.push line
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def print_logs
|
93
|
+
@logs.each do |log|
|
94
|
+
@test_logger.unknown log
|
48
95
|
end
|
49
|
-
in_tests
|
50
96
|
end
|
51
97
|
end
|
52
98
|
end
|
data/lib/roku_builder/util.rb
CHANGED
@@ -11,18 +11,17 @@ module RokuBuilder
|
|
11
11
|
# @param ip [String] IP address of roku device
|
12
12
|
# @param user [String] Username for roku device
|
13
13
|
# @param password [String] Password for roku device
|
14
|
-
def initialize(ip:, user:, password:,
|
14
|
+
def initialize(ip:, user:, password:, init_params: nil)
|
15
|
+
@logger = Logger.instance
|
15
16
|
@device_config = {
|
16
17
|
ip: ip,
|
17
18
|
user: user,
|
18
|
-
password: password
|
19
|
-
logger: logger
|
19
|
+
password: password
|
20
20
|
}
|
21
21
|
@roku_ip_address = ip
|
22
22
|
@dev_username = user
|
23
23
|
@dev_password = password
|
24
24
|
@url = "http://#{@roku_ip_address}"
|
25
|
-
@logger = logger
|
26
25
|
if init_params
|
27
26
|
init(**init_params)
|
28
27
|
else
|
data/lib/roku_builder/version.rb
CHANGED
data/roku_builder.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = %q{Build Tool for Roku Apps}
|
12
12
|
spec.description = %q{Allows the user to easily sideload, package, deeplink, test, roku apps.}
|
13
13
|
spec.homepage = ""
|
14
|
-
spec.license = "
|
14
|
+
spec.license = "Apache-2.0"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "net-ping", "~> 2.0"
|
28
28
|
spec.add_dependency "net-telnet", "~> 0.1"
|
29
29
|
spec.add_dependency "nokogiri", "~> 1.7"
|
30
|
+
spec.add_dependency "win32-security", "~> 0.5" # For windows compatibility
|
30
31
|
|
31
32
|
spec.add_development_dependency "bundler", "~> 1.7"
|
32
33
|
spec.add_development_dependency "rake", "~> 12.0"
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
2
|
+
|
3
|
+
require_relative "test_helper.rb"
|
4
|
+
|
5
|
+
module RokuBuilder
|
6
|
+
class ConfigTest < Minitest::Test
|
7
|
+
|
8
|
+
def test_config_init
|
9
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
|
10
|
+
config = Config.new(options: options)
|
11
|
+
config.load
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_config_expand_path
|
15
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
|
16
|
+
options[:config].sub!(/#{File.expand_path("~")}/, "~")
|
17
|
+
config = Config.new(options: options)
|
18
|
+
config.load
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_missing_config
|
22
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "missing.json"), validate: true})
|
23
|
+
assert_raises ArgumentError do
|
24
|
+
config = Config.new(options: options)
|
25
|
+
config.load
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_invalid_config
|
30
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "bad.json"), validate: true})
|
31
|
+
assert_raises InvalidConfig do
|
32
|
+
config = Config.new(options: options)
|
33
|
+
config.load
|
34
|
+
config.validate
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_non_json_config
|
39
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "non_json.json"), validate: true})
|
40
|
+
assert_raises InvalidConfig do
|
41
|
+
config = Config.new(options: options)
|
42
|
+
config.load
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_config_parse
|
47
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
|
48
|
+
config = Config.new(options: options)
|
49
|
+
config.load
|
50
|
+
config.parse
|
51
|
+
assert_equal Hash, config.parsed.class
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_config_read
|
55
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
|
56
|
+
config = Config.new(options: options)
|
57
|
+
config.load
|
58
|
+
assert_equal :roku, config.raw[:devices][:default]
|
59
|
+
assert_equal :p1, config.raw[:projects][:default]
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_config_read_parent
|
63
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "child.json"), validate: true})
|
64
|
+
config = Config.new(options: options)
|
65
|
+
config.load
|
66
|
+
assert_equal :roku, config.raw[:devices][:default]
|
67
|
+
assert_equal :p1, config.raw[:projects][:default]
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_config_read_parent
|
71
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "parent_projects.json"), validate: true})
|
72
|
+
config = Config.new(options: options)
|
73
|
+
config.load
|
74
|
+
assert_equal "app", config.raw[:projects][:p1][:app_name]
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_config_edit
|
78
|
+
orginal = File.join(test_files_path(ConfigTest), "config.json")
|
79
|
+
tmp = File.join(test_files_path(ConfigTest), "tmpconfig.json")
|
80
|
+
FileUtils.cp(orginal, tmp)
|
81
|
+
options = build_options({config: tmp, edit_params: "ip:123.456.789", validate: true})
|
82
|
+
config = Config.new(options: options)
|
83
|
+
config.load
|
84
|
+
config.edit
|
85
|
+
options = build_options({config: tmp, validate: true})
|
86
|
+
config = Config.new(options: options)
|
87
|
+
config.load
|
88
|
+
assert_equal "123.456.789", config.raw[:devices][:roku][:ip]
|
89
|
+
FileUtils.rm(tmp)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_config_update_package
|
93
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), package: true, stage: :production, set_stage: true})
|
94
|
+
config = Config.new(options: options)
|
95
|
+
config.load
|
96
|
+
config.parse
|
97
|
+
options[:build_version] = "BUILDVERSION"
|
98
|
+
config.update
|
99
|
+
assert_equal "app - production - BUILDVERSION", config.parsed[:package_config][:app_name_version]
|
100
|
+
assert_equal "/tmp/app_production_BUILDVERSION", config.parsed[:package_config][:out_file]
|
101
|
+
assert_equal "/tmp/app_production_BUILDVERSION", config.parsed[:inspect_config][:pkg]
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_config_update_build
|
105
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), build: true, stage: :production, set_stage: true})
|
106
|
+
config = Config.new(options: options)
|
107
|
+
config.load
|
108
|
+
config.parse
|
109
|
+
options[:build_version] = "BUILDVERSION"
|
110
|
+
config.update
|
111
|
+
assert_equal "/tmp/app_production_BUILDVERSION", config.parsed[:build_config][:out_file]
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_config_update_sideload
|
115
|
+
options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), sideload: true, stage: :production, set_stage: true, out: "/tmp2"})
|
116
|
+
config = Config.new(options: options)
|
117
|
+
config.load
|
118
|
+
config.parse
|
119
|
+
options[:build_version] = "BUILDVERSION"
|
120
|
+
config.update
|
121
|
+
assert_equal "/tmp2/app_production_BUILDVERSION", config.parsed[:sideload_config][:out_file]
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_config_configure_creation
|
125
|
+
target_config = File.join(test_files_path(ConfigTest), "configure_test.json")
|
126
|
+
options = build_options({config: target_config, configure: true})
|
127
|
+
File.delete(target_config) if File.exist?(target_config)
|
128
|
+
refute File.exist?(target_config)
|
129
|
+
config = Config.new(options: options)
|
130
|
+
config.configure
|
131
|
+
assert File.exist?(target_config)
|
132
|
+
File.delete(target_config) if File.exist?(target_config)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_config_configure_edit_params
|
136
|
+
target_config = File.join(test_files_path(ConfigTest), "configure_test.json")
|
137
|
+
options = build_options({
|
138
|
+
config: target_config,
|
139
|
+
configure: true,
|
140
|
+
edit_params: "ip:111.222.333.444"
|
141
|
+
})
|
142
|
+
File.delete(target_config) if File.exist?(target_config)
|
143
|
+
refute File.exist?(target_config)
|
144
|
+
config = Config.new(options: options)
|
145
|
+
config.configure
|
146
|
+
assert File.exist?(target_config)
|
147
|
+
assert_equal "111.222.333.444", config.raw[:devices][config.raw[:devices][:default]][:ip]
|
148
|
+
File.delete(target_config) if File.exist?(target_config)
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_config_configure_edit_params
|
152
|
+
target_config = File.join(test_files_path(ConfigTest), "configure_test.json")
|
153
|
+
options = build_options({
|
154
|
+
config: target_config,
|
155
|
+
configure: true
|
156
|
+
})
|
157
|
+
File.delete(target_config) if File.exist?(target_config)
|
158
|
+
refute File.exist?(target_config)
|
159
|
+
config = Config.new(options: options)
|
160
|
+
config.configure
|
161
|
+
assert File.exist?(target_config)
|
162
|
+
assert_raises InvalidOptions do
|
163
|
+
config.configure
|
164
|
+
end
|
165
|
+
File.delete(target_config) if File.exist?(target_config)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -2,438 +2,391 @@
|
|
2
2
|
|
3
3
|
require_relative "test_helper.rb"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
assert_equal RokuBuilder::SUCCESS, code
|
19
|
-
assert_equal Hash, config.class
|
20
|
-
assert_equal "/tmp", configs[:manifest_config][:root_dir]
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_manifest_config_in
|
24
|
-
logger = Logger.new("/dev/null")
|
25
|
-
options = {
|
26
|
-
config: File.expand_path(File.join(File.dirname(__FILE__), "test_files", "controller_config_test", "valid_config.json")),
|
27
|
-
in: "/dev/null/infile",
|
28
|
-
update_manifest: false,
|
29
|
-
fetch: false,
|
30
|
-
sideload: true
|
31
|
-
}
|
32
|
-
config = good_config
|
33
|
-
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
34
|
-
|
35
|
-
assert_equal RokuBuilder::SUCCESS, code
|
36
|
-
assert_equal Hash, config.class
|
37
|
-
assert_equal "/dev/null/infile", configs[:manifest_config][:root_dir]
|
38
|
-
assert_equal :in, configs[:stage_config][:method]
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_manifest_config_in_expand
|
42
|
-
logger = Logger.new("/dev/null")
|
43
|
-
options = {
|
44
|
-
config: File.expand_path(File.join(File.dirname(__FILE__), "test_files", "controller_config_test", "valid_config.json")),
|
45
|
-
in: "./infile",
|
46
|
-
update_manifest: false,
|
47
|
-
fetch: false,
|
48
|
-
sideload: true
|
49
|
-
}
|
50
|
-
config = good_config
|
51
|
-
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
52
|
-
|
53
|
-
assert_equal RokuBuilder::SUCCESS, code
|
54
|
-
assert_equal Hash, config.class
|
55
|
-
assert_equal File.join(Dir.pwd, "infile"), configs[:manifest_config][:root_dir]
|
56
|
-
assert_equal :in, configs[:stage_config][:method]
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_manifest_config_current
|
60
|
-
logger = Logger.new("/dev/null")
|
61
|
-
options = {
|
62
|
-
config: File.expand_path(File.join(File.dirname(__FILE__), "test_files", "controller_config_test", "valid_config.json")),
|
63
|
-
current: true,
|
64
|
-
update_manifest: false,
|
65
|
-
fetch: false,
|
66
|
-
sideload: true
|
67
|
-
}
|
68
|
-
code, configs = nil
|
69
|
-
config = good_config
|
70
|
-
Pathname.stub(:pwd, "/dev/null/infile") do
|
71
|
-
File.stub(:exist?, true) do
|
72
|
-
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
73
|
-
end
|
5
|
+
module RokuBuilder
|
6
|
+
class ConfigParserTest < Minitest::Test
|
7
|
+
def test_manifest_config
|
8
|
+
options = build_options({
|
9
|
+
sideload: true,
|
10
|
+
working: true
|
11
|
+
})
|
12
|
+
config = good_config
|
13
|
+
configs = ConfigParser.parse(options: options, config: config)
|
14
|
+
|
15
|
+
assert_equal Hash, config.class
|
16
|
+
assert_equal "/tmp", configs[:manifest_config][:root_dir]
|
74
17
|
end
|
75
18
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
File.stub(:exist?, true) do
|
89
|
-
project = RokuBuilder::ConfigParser.send(:setup_project_config, **args)
|
90
|
-
end
|
91
|
-
assert_equal Pathname.pwd.to_s, project[:directory]
|
92
|
-
assert_equal :current, project[:stage_method]
|
93
|
-
assert_nil project[:folders]
|
94
|
-
assert_nil project[:files]
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_setup_project_config_good_project_dir
|
98
|
-
config = good_config
|
99
|
-
args = {
|
100
|
-
config: config,
|
101
|
-
options: {sideload: true, project: :project1}
|
102
|
-
}
|
103
|
-
project = {}
|
104
|
-
File.stub(:exist?, true) do
|
105
|
-
project = RokuBuilder::ConfigParser.send(:setup_project_config, **args)
|
106
|
-
end
|
107
|
-
refute_equal RokuBuilder::BAD_PROJECT_DIR, project
|
108
|
-
end
|
19
|
+
def test_manifest_config_in
|
20
|
+
options = build_options({
|
21
|
+
in: "/dev/null/infile",
|
22
|
+
sideload: true
|
23
|
+
})
|
24
|
+
config = good_config
|
25
|
+
configs = ConfigParser.parse(options: options, config: config)
|
26
|
+
|
27
|
+
assert_equal Hash, config.class
|
28
|
+
assert_equal "/dev/null/infile", configs[:manifest_config][:root_dir]
|
29
|
+
assert_equal :in, configs[:stage_config][:method]
|
30
|
+
end
|
109
31
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
end
|
32
|
+
def test_manifest_config_in_expand
|
33
|
+
options = build_options({
|
34
|
+
in: "./infile",
|
35
|
+
sideload: true
|
36
|
+
})
|
37
|
+
config = good_config
|
38
|
+
configs = ConfigParser.parse(options: options, config: config)
|
39
|
+
|
40
|
+
assert_equal Hash, config.class
|
41
|
+
assert_equal File.join(Dir.pwd, "infile"), configs[:manifest_config][:root_dir]
|
42
|
+
assert_equal :in, configs[:stage_config][:method]
|
43
|
+
end
|
123
44
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
assert_equal RokuBuilder::BAD_PROJECT_DIR, project
|
137
|
-
end
|
45
|
+
def test_manifest_config_current
|
46
|
+
options = build_options({
|
47
|
+
current: true,
|
48
|
+
sideload: true
|
49
|
+
})
|
50
|
+
configs = nil
|
51
|
+
config = good_config
|
52
|
+
Pathname.stub(:pwd, "/dev/null/infile") do
|
53
|
+
File.stub(:exist?, true) do
|
54
|
+
configs = ConfigParser.parse(options: options, config: config)
|
55
|
+
end
|
56
|
+
end
|
138
57
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
args = {
|
144
|
-
config: config,
|
145
|
-
options: {sideload: true, project: :project1}
|
146
|
-
}
|
147
|
-
project = {}
|
148
|
-
File.stub(:exist?, true) do
|
149
|
-
project = RokuBuilder::ConfigParser.send(:setup_project_config, **args)
|
150
|
-
end
|
151
|
-
assert_equal RokuBuilder::BAD_PROJECT_DIR, project
|
152
|
-
end
|
58
|
+
assert_equal Hash, config.class
|
59
|
+
assert_equal "/dev/null/infile", configs[:manifest_config][:root_dir]
|
60
|
+
assert_equal :current, configs[:stage_config][:method]
|
61
|
+
end
|
153
62
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
63
|
+
def test_setup_project_config_bad_project
|
64
|
+
config = good_config
|
65
|
+
options = build_options({sideload: true, project: :project3, set_stage: true})
|
66
|
+
assert_raises ParseError do
|
67
|
+
File.stub(:exist?, true) do
|
68
|
+
ConfigParser.parse(options: options, config: config)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
163
72
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
73
|
+
def test_setup_project_config_current
|
74
|
+
options = build_options({ sideload: true, current: true })
|
75
|
+
config = good_config
|
76
|
+
configs = nil
|
77
|
+
File.stub(:exist?, true) do
|
78
|
+
configs = ConfigParser.parse(options: options, config: config)
|
79
|
+
end
|
80
|
+
project = configs[:project_config]
|
81
|
+
assert_equal Pathname.pwd.to_s, project[:directory]
|
82
|
+
assert_equal :current, project[:stage_method]
|
83
|
+
assert_nil project[:folders]
|
84
|
+
assert_nil project[:files]
|
85
|
+
end
|
173
86
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
sideload: true
|
182
|
-
}
|
183
|
-
config = good_config
|
87
|
+
def test_setup_project_config_good_project_dir
|
88
|
+
config = good_config
|
89
|
+
options = build_options({sideload: true, project: :project1, set_stage: true})
|
90
|
+
File.stub(:exist?, true) do
|
91
|
+
ConfigParser.parse(options: options, config: config)
|
92
|
+
end
|
93
|
+
end
|
184
94
|
|
185
|
-
|
186
|
-
|
95
|
+
def test_setup_project_config_bad_project_dir
|
96
|
+
config = good_config
|
97
|
+
config[:projects][:project1][:directory] = "/dev/null"
|
98
|
+
options = build_options({sideload: true, project: :project1, working: true})
|
99
|
+
assert_raises ParseError do
|
100
|
+
File.stub(:exist?, true) do
|
101
|
+
ConfigParser.parse(options: options, config: config)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
187
105
|
|
188
|
-
|
189
|
-
|
106
|
+
def test_setup_project_config_bad_child_project_dir
|
107
|
+
config = good_config
|
108
|
+
config[:projects][:project_dir] = "/tmp"
|
109
|
+
config[:projects][:project1][:directory] = "bad"
|
110
|
+
options = build_options({sideload: true, project: :project1, working: true})
|
111
|
+
assert_raises ParseError do
|
112
|
+
File.stub(:exist?, true) do
|
113
|
+
ConfigParser.parse(options: options, config: config)
|
114
|
+
end
|
115
|
+
end
|
190
116
|
end
|
191
117
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
118
|
+
def test_setup_project_config_bad_parent_project_dir
|
119
|
+
config = good_config
|
120
|
+
config[:projects][:project_dir] = "/bad"
|
121
|
+
config[:projects][:project1][:directory] = "good"
|
122
|
+
options = build_options({sideload: true, project: :project1, set_stage: true})
|
123
|
+
assert_raises ParseError do
|
124
|
+
File.stub(:exist?, true) do
|
125
|
+
ConfigParser.parse(options: options, config: config)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
196
129
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
130
|
+
def test_setup_stage_config_bad_stage
|
131
|
+
config = good_config
|
132
|
+
options = build_options({sideload: true, project: :project1, stage: :bad, set_stage: true})
|
133
|
+
assert_raises ParseError do
|
134
|
+
File.stub(:exist?, true) do
|
135
|
+
ConfigParser.parse(options: options, config: config)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
206
139
|
|
140
|
+
def test_setup_stage_config_bad_method
|
141
|
+
config = good_config
|
142
|
+
config[:projects][:project1][:stage_method] = :bad
|
143
|
+
options = build_options({sideload: true, project: :project1, set_stage: true})
|
144
|
+
assert_raises ParseError do
|
145
|
+
File.stub(:exist?, true) do
|
146
|
+
ConfigParser.parse(options: options, config: config)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
207
150
|
|
208
|
-
|
209
|
-
|
151
|
+
def test_setup_stage_config_missing_method
|
152
|
+
config = good_config
|
153
|
+
config[:projects][:project1][:stage_method] = nil
|
154
|
+
options = build_options({sideload: true, project: :project1, set_stage: true})
|
155
|
+
assert_raises ParseError do
|
156
|
+
File.stub(:exist?, true) do
|
157
|
+
ConfigParser.parse(options: options, config: config)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
210
161
|
|
211
|
-
|
212
|
-
|
162
|
+
def test_setup_stage_config_script
|
163
|
+
config = good_config
|
164
|
+
config[:projects][:project1][:stage_method] = :script
|
165
|
+
config[:projects][:project1][:stages][:production][:script] = {stage: "script", unstage: "script"}
|
166
|
+
options = build_options({stage: "production", sideload: true, set_stage: true})
|
167
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
168
|
+
assert_equal parsed[:project_config][:stages][:production][:script], config[:projects][:project1][:stages][:production][:script]
|
213
169
|
end
|
214
170
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
171
|
+
def test_setup_stage_config_git_ref
|
172
|
+
config = good_config
|
173
|
+
options = build_options({stage: "production", ref: "git-ref", sideload: true})
|
174
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
175
|
+
assert_equal options[:ref], parsed[:stage_config][:key]
|
176
|
+
end
|
219
177
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
fetch: false,
|
227
|
-
sideload: true
|
228
|
-
}
|
229
|
-
config = good_config
|
230
|
-
config[:projects][:project_dir] = "/tmp"
|
231
|
-
config[:projects][:project1][:directory] = "project1"
|
232
|
-
config[:projects][:project2][:directory] = "project2"
|
233
|
-
|
234
|
-
code = nil
|
235
|
-
configs = nil
|
236
|
-
|
237
|
-
Pathname.stub(:pwd, Pathname.new("/tmp/project2")) do
|
238
|
-
Dir.stub(:exist?, true) do
|
239
|
-
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
178
|
+
def test_manifest_config_project_select
|
179
|
+
options = build_options({ sideload: true, working: true })
|
180
|
+
config = good_config
|
181
|
+
configs = nil
|
182
|
+
Pathname.stub(:pwd, Pathname.new("/dev/nuller")) do
|
183
|
+
configs = ConfigParser.parse(options: options, config: config)
|
240
184
|
end
|
185
|
+
assert_equal Hash, config.class
|
186
|
+
assert_equal "/tmp", configs[:project_config][:directory]
|
241
187
|
end
|
242
188
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
189
|
+
def test_manifest_config_project_directory
|
190
|
+
options = build_options({
|
191
|
+
sideload: true,
|
192
|
+
working: true
|
193
|
+
})
|
194
|
+
config = good_config
|
195
|
+
config[:projects][:project_dir] = "/tmp"
|
196
|
+
config[:projects][:project1][:directory] = "project1"
|
197
|
+
config[:projects][:project2][:directory] = "project2"
|
247
198
|
|
248
|
-
|
249
|
-
tmp_file = Tempfile.new("pkg")
|
250
|
-
logger = Logger.new("/dev/null")
|
251
|
-
options = {key: true, project: :project2}
|
252
|
-
config = good_config
|
253
|
-
config[:keys][:key_dir] = File.dirname(tmp_file.path)
|
254
|
-
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
199
|
+
configs = nil
|
255
200
|
|
201
|
+
Dir.stub(:exist?, true) do
|
202
|
+
configs = ConfigParser.parse(options: options, config: config)
|
203
|
+
end
|
256
204
|
|
257
|
-
|
258
|
-
|
205
|
+
assert_equal Hash, config.class
|
206
|
+
assert_equal "/tmp/project1", configs[:project_config][:directory]
|
207
|
+
end
|
259
208
|
|
260
|
-
|
209
|
+
def test_manifest_config_project_directory_select
|
210
|
+
options = build_options({sideload: true, working: true})
|
211
|
+
config = good_config
|
212
|
+
config[:projects][:project_dir] = "/tmp"
|
213
|
+
config[:projects][:project1][:directory] = "project1"
|
214
|
+
config[:projects][:project2][:directory] = "project2"
|
215
|
+
|
216
|
+
configs = nil
|
217
|
+
Pathname.stub(:pwd, Pathname.new("/tmp/project2")) do
|
218
|
+
Dir.stub(:exist?, true) do
|
219
|
+
configs = ConfigParser.parse(options: options, config: config)
|
220
|
+
end
|
221
|
+
end
|
261
222
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
tmp_file.close
|
266
|
-
end
|
223
|
+
assert_equal Hash, config.class
|
224
|
+
assert_equal "/tmp/project2", configs[:project_config][:directory]
|
225
|
+
end
|
267
226
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
227
|
+
def test_key_config_key_directory
|
228
|
+
tmp_file = Tempfile.new("pkg")
|
229
|
+
options = build_options({key: true, project: :project2, set_stage: true})
|
230
|
+
config = good_config
|
231
|
+
config[:keys][:key_dir] = File.dirname(tmp_file.path)
|
232
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
275
233
|
|
276
|
-
|
277
|
-
configs = nil
|
234
|
+
configs = ConfigParser.parse(options: options, config: config)
|
278
235
|
|
279
|
-
|
236
|
+
assert_equal Hash, config.class
|
237
|
+
assert_equal tmp_file.path, configs[:key][:keyed_pkg]
|
238
|
+
tmp_file.close
|
239
|
+
end
|
280
240
|
|
281
|
-
|
282
|
-
|
241
|
+
def test_key_config_key_directory_bad
|
242
|
+
tmp_file = Tempfile.new("pkg")
|
243
|
+
options = build_options({key: true, project: :project2, set_stage: true})
|
244
|
+
config = good_config
|
245
|
+
config[:keys][:key_dir] = "/bad"
|
246
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
247
|
+
|
248
|
+
assert_raises ParseError do
|
249
|
+
ConfigParser.parse(options: options, config: config)
|
250
|
+
end
|
251
|
+
end
|
283
252
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)+".bad"
|
253
|
+
def test_key_config_key_path_bad
|
254
|
+
tmp_file = Tempfile.new("pkg")
|
255
|
+
options = build_options({key: true, project: :project2, set_stage: true})
|
256
|
+
config = good_config
|
257
|
+
config[:keys][:key_dir] = File.dirname(tmp_file.path)
|
258
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)+".bad"
|
291
259
|
|
292
|
-
|
293
|
-
|
260
|
+
assert_raises ParseError do
|
261
|
+
ConfigParser.parse(options: options, config: config)
|
262
|
+
end
|
263
|
+
end
|
294
264
|
|
295
|
-
|
265
|
+
def test_key_config_bad_key
|
266
|
+
options = build_options({key: true, project: :project1, set_stage: true})
|
267
|
+
config = good_config
|
268
|
+
config[:projects][:project1][:stages][:production][:key] = "bad"
|
296
269
|
|
297
|
-
|
298
|
-
|
270
|
+
assert_raises ParseError do
|
271
|
+
ConfigParser.parse(options: options, config: config)
|
272
|
+
end
|
273
|
+
end
|
299
274
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
options:
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
options:
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
options: {package: true}
|
336
|
-
}
|
337
|
-
RokuBuilder::ConfigParser.send(:setup_sideload_config, **args)
|
338
|
-
refute_nil args[:configs][:sideload_config][:content][:excludes]
|
339
|
-
|
340
|
-
args = {
|
341
|
-
configs: {project_config: {directory: "/tmp", folders: ["a", "b"], files: ["c", "d"], excludes: []}, init_params: {}},
|
342
|
-
options: {sideload: true, exclude: true}
|
343
|
-
}
|
344
|
-
RokuBuilder::ConfigParser.send(:setup_sideload_config, **args)
|
345
|
-
refute_nil args[:configs][:sideload_config][:content][:excludes]
|
346
|
-
end
|
275
|
+
def test_setup_sideload_config
|
276
|
+
config = good_config
|
277
|
+
options = build_options({sideload: true, working: true})
|
278
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
279
|
+
|
280
|
+
refute_nil parsed[:sideload_config]
|
281
|
+
refute_nil parsed[:sideload_config][:content]
|
282
|
+
refute_nil parsed[:build_config]
|
283
|
+
refute_nil parsed[:build_config][:content]
|
284
|
+
refute_nil parsed[:init_params][:loader]
|
285
|
+
refute_nil parsed[:init_params][:loader][:root_dir]
|
286
|
+
|
287
|
+
assert_nil parsed[:sideload_config][:content][:excludes]
|
288
|
+
assert_nil parsed[:sideload_config][:update_manifest]
|
289
|
+
assert_nil parsed[:sideload_config][:infile]
|
290
|
+
end
|
291
|
+
def test_setup_sideload_config_exclude
|
292
|
+
config = good_config
|
293
|
+
config[:projects][:project1][:excludes] = []
|
294
|
+
options = build_options({sideload: true, working: true})
|
295
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
296
|
+
assert_nil parsed[:sideload_config][:content][:excludes]
|
297
|
+
|
298
|
+
options = build_options({build: true, working: true})
|
299
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
300
|
+
refute_nil parsed[:sideload_config][:content][:excludes]
|
301
|
+
|
302
|
+
options = build_options({package: true, set_stage: true})
|
303
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
304
|
+
refute_nil parsed[:sideload_config][:content][:excludes]
|
305
|
+
|
306
|
+
options = build_options({sideload: true, working: true, exclude: true})
|
307
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
308
|
+
refute_nil parsed[:sideload_config][:content][:excludes]
|
309
|
+
end
|
347
310
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
options: {deeplink: "a:b", app_id: "xxxxxx"},
|
353
|
-
}
|
354
|
-
RokuBuilder::ConfigParser.send(:setup_simple_configs, **args)
|
355
|
-
end
|
311
|
+
def test_deeplink_app_config
|
312
|
+
config = good_config
|
313
|
+
options = build_options({deeplink: "a:b", app_id: "xxxxxx"})
|
314
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
356
315
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
configs: {project_config: {directory: "dir"}, init_params: {}, out: {}},
|
361
|
-
options: {monitor: "main", regexp: "^A$"},
|
362
|
-
}
|
363
|
-
RokuBuilder::ConfigParser.send(:setup_active_configs, **args)
|
364
|
-
refute_nil args[:configs][:monitor_config][:regexp]
|
365
|
-
assert args[:configs][:monitor_config][:regexp].match("A")
|
366
|
-
end
|
316
|
+
assert_equal parsed[:deeplink_config][:options], options[:deeplink]
|
317
|
+
assert_equal parsed[:deeplink_config][:app_id], options[:app_id]
|
318
|
+
end
|
367
319
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
320
|
+
def test_monitor_config
|
321
|
+
config = good_config
|
322
|
+
options = build_options({monitor: "main", regexp: "^A$"})
|
323
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
324
|
+
refute_nil parsed[:monitor_config][:regexp]
|
325
|
+
assert parsed[:monitor_config][:regexp].match("A")
|
326
|
+
end
|
327
|
+
def test_outfile_config_default
|
328
|
+
config = good_config
|
329
|
+
options = build_options({build: true, working: true, out: nil})
|
330
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
331
|
+
|
332
|
+
refute_nil parsed[:out]
|
333
|
+
refute_nil parsed[:out][:folder]
|
334
|
+
assert_nil parsed[:out][:file]
|
335
|
+
assert_equal "/tmp", parsed[:out][:folder]
|
336
|
+
end
|
337
|
+
def test_outfile_config_folder
|
338
|
+
config = good_config
|
339
|
+
|
340
|
+
options = build_options({build: true, working: true, out: "/home/user"})
|
341
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
342
|
+
refute_nil parsed[:out]
|
343
|
+
refute_nil parsed[:out][:folder]
|
344
|
+
assert_nil parsed[:out][:file]
|
345
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
346
|
+
end
|
347
|
+
def test_outfile_config_pkg
|
348
|
+
config = good_config
|
349
|
+
|
350
|
+
options = build_options({build: true, working: true, out: "/home/user/file.pkg"})
|
351
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
352
|
+
refute_nil parsed[:out]
|
353
|
+
refute_nil parsed[:out][:folder]
|
354
|
+
refute_nil parsed[:out][:file]
|
355
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
356
|
+
assert_equal "file.pkg", parsed[:out][:file]
|
357
|
+
end
|
358
|
+
def test_outfile_config_zip
|
359
|
+
config = good_config
|
360
|
+
|
361
|
+
options = build_options({build: true, working: true, out: "/home/user/file.zip"})
|
362
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
363
|
+
refute_nil parsed[:out]
|
364
|
+
refute_nil parsed[:out][:folder]
|
365
|
+
refute_nil parsed[:out][:file]
|
366
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
367
|
+
assert_equal "file.zip", parsed[:out][:file]
|
368
|
+
end
|
369
|
+
def test_outfile_config_jpg
|
370
|
+
config = good_config
|
371
|
+
|
372
|
+
options = build_options({build: true, working: true, out: "/home/user/file.jpg"})
|
373
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
374
|
+
refute_nil parsed[:out]
|
375
|
+
refute_nil parsed[:out][:folder]
|
376
|
+
refute_nil parsed[:out][:file]
|
377
|
+
assert_equal "/home/user", parsed[:out][:folder]
|
378
|
+
assert_equal "file.jpg", parsed[:out][:file]
|
379
|
+
end
|
380
|
+
def test_outfile_config_default_jpg
|
381
|
+
config = good_config
|
382
|
+
|
383
|
+
options = build_options({build: true, working: true, out: "file.jpg"})
|
384
|
+
parsed = ConfigParser.parse(options: options, config: config)
|
385
|
+
refute_nil parsed[:out]
|
386
|
+
refute_nil parsed[:out][:folder]
|
387
|
+
refute_nil parsed[:out][:file]
|
388
|
+
assert_equal "/tmp", parsed[:out][:folder]
|
389
|
+
assert_equal "file.jpg", parsed[:out][:file]
|
390
|
+
end
|
438
391
|
end
|
439
392
|
end
|