roku_builder 3.12.6 → 3.12.7
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 +4 -4
- data/CHANGELOG +7 -0
- data/Gemfile.lock +6 -6
- data/lib/roku_builder.rb +6 -0
- data/lib/roku_builder/config_parser.rb +8 -4
- data/lib/roku_builder/controller.rb +1 -1
- data/lib/roku_builder/error_handler.rb +6 -0
- data/lib/roku_builder/version.rb +1 -1
- data/test/roku_builder/test_config_parser.rb +120 -7
- data/test/roku_builder/test_error_handler.rb +2 -0
- data/test/roku_builder/test_files/controller_config_test/valid_config.json +2 -2
- data/test/roku_builder/test_helper.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9176b4d991a50edd2f0e9011fd487052eccb9897
|
|
4
|
+
data.tar.gz: 46e51f45694d978e9f39f6a6772cb81580eaddfa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83dae8e4eefc66c8a74b7d9c1cbc7ea4bff311c1933d690f1374ec197ddcf5d116ebe2e97a6d9f0fb8528a31ada834fd329abe127ed6731fce2a177c64a16646
|
|
7
|
+
data.tar.gz: 855e6e1ff0cf89a8f962f513828209425e5aa270928611f1f0a999dccfb68dcbd09a379b0f6b791b4d956f0ad1a94d730570a5deadee41aa7cbc186e7b49f80b
|
data/CHANGELOG
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
roku_builder (3.12.
|
|
4
|
+
roku_builder (3.12.7)
|
|
5
5
|
faraday (~> 0.11)
|
|
6
6
|
faraday-digestauth (~> 0.2)
|
|
7
7
|
git (~> 1.3)
|
|
@@ -15,11 +15,11 @@ GEM
|
|
|
15
15
|
specs:
|
|
16
16
|
byebug (9.0.6)
|
|
17
17
|
coderay (1.1.1)
|
|
18
|
-
coveralls (0.8.
|
|
18
|
+
coveralls (0.8.20)
|
|
19
19
|
json (>= 1.8, < 3)
|
|
20
|
-
simplecov (~> 0.
|
|
20
|
+
simplecov (~> 0.14.1)
|
|
21
21
|
term-ansicolor (~> 1.3)
|
|
22
|
-
thor (~> 0.19.
|
|
22
|
+
thor (~> 0.19.4)
|
|
23
23
|
tins (~> 1.6)
|
|
24
24
|
docile (1.1.5)
|
|
25
25
|
faraday (0.11.0)
|
|
@@ -80,13 +80,13 @@ GEM
|
|
|
80
80
|
ruby_dep (1.5.0)
|
|
81
81
|
rubyzip (1.2.1)
|
|
82
82
|
shellany (0.0.1)
|
|
83
|
-
simplecov (0.
|
|
83
|
+
simplecov (0.14.1)
|
|
84
84
|
docile (~> 1.1.0)
|
|
85
85
|
json (>= 1.8, < 3)
|
|
86
86
|
simplecov-html (~> 0.10.0)
|
|
87
87
|
simplecov-html (0.10.0)
|
|
88
88
|
slop (3.6.0)
|
|
89
|
-
term-ansicolor (1.
|
|
89
|
+
term-ansicolor (1.5.0)
|
|
90
90
|
tins (~> 1.0)
|
|
91
91
|
thor (0.19.4)
|
|
92
92
|
tins (1.13.2)
|
data/lib/roku_builder.rb
CHANGED
|
@@ -14,10 +14,10 @@ module RokuBuilder
|
|
|
14
14
|
# @return [Hash] Intermeidate configs
|
|
15
15
|
def self.parse_config(options:, config:, logger:)
|
|
16
16
|
configs = {init_params: {}}
|
|
17
|
+
#expand in
|
|
18
|
+
options[:in] = File.expand_path(options[:in]) if options[:in]
|
|
17
19
|
#set device
|
|
18
|
-
unless options[:device]
|
|
19
|
-
options[:device] = config[:devices][:default]
|
|
20
|
-
end
|
|
20
|
+
options[:device] = config[:devices][:default] unless options[:device]
|
|
21
21
|
#set project
|
|
22
22
|
setup_project(config: config, options: options) if project_required(options: options)
|
|
23
23
|
#set outfile
|
|
@@ -32,7 +32,8 @@ module RokuBuilder
|
|
|
32
32
|
stage = setup_stage_config(configs: configs, options: options, logger: logger)[1]
|
|
33
33
|
return [UNKNOWN_STAGE, nil, nil] if stage.nil? and project_required(options: options)
|
|
34
34
|
setup_sideload_config(configs: configs, options: options)
|
|
35
|
-
setup_package_config(config: config, configs: configs, options: options, stage: stage)
|
|
35
|
+
code = setup_package_config(config: config, configs: configs, options: options, stage: stage)
|
|
36
|
+
return [code, nil, nil] unless code == SUCCESS
|
|
36
37
|
setup_active_configs(config: config, configs: configs, options: options)
|
|
37
38
|
setup_manifest_configs(configs: configs, options: options)
|
|
38
39
|
setup_simple_configs(config: config, configs: configs, options: options)
|
|
@@ -116,6 +117,7 @@ module RokuBuilder
|
|
|
116
117
|
if config[:projects][:project_dir]
|
|
117
118
|
project_config[:directory] = File.join(config[:projects][:project_dir], project_config[:directory])
|
|
118
119
|
end
|
|
120
|
+
return BAD_PROJECT_DIR unless Dir.exist?(project_config[:directory])
|
|
119
121
|
project_config[:stage_method] = :working if options[:working]
|
|
120
122
|
end
|
|
121
123
|
project_config
|
|
@@ -207,6 +209,7 @@ module RokuBuilder
|
|
|
207
209
|
if config[:keys][:key_dir]
|
|
208
210
|
configs[:key][:keyed_pkg] = File.join(config[:keys][:key_dir], configs[:key][:keyed_pkg])
|
|
209
211
|
end
|
|
212
|
+
return BAD_KEY_FILE unless File.exist?(configs[:key][:keyed_pkg])
|
|
210
213
|
end
|
|
211
214
|
end
|
|
212
215
|
if options[:package]
|
|
@@ -224,6 +227,7 @@ module RokuBuilder
|
|
|
224
227
|
configs[:inspect_config][:pkg] = File.join(configs[:out][:folder], configs[:out][:file])
|
|
225
228
|
end
|
|
226
229
|
end
|
|
230
|
+
return SUCCESS
|
|
227
231
|
end
|
|
228
232
|
private_class_method :setup_package_config
|
|
229
233
|
|
|
@@ -196,7 +196,7 @@ module RokuBuilder
|
|
|
196
196
|
# List of commands requiring a source option
|
|
197
197
|
# @return [Array<Symbol>] List of command symbols that require a source in the options hash
|
|
198
198
|
def self.source_commands
|
|
199
|
-
[:sideload, :package, :test, :build, :key, :update]
|
|
199
|
+
[:sideload, :package, :test, :build, :key, :update, :print]
|
|
200
200
|
end
|
|
201
201
|
|
|
202
202
|
# List of commands the activate the exclude files
|
data/lib/roku_builder/version.rb
CHANGED
|
@@ -17,7 +17,7 @@ class ConfigParserTest < Minitest::Test
|
|
|
17
17
|
|
|
18
18
|
assert_equal RokuBuilder::SUCCESS, code
|
|
19
19
|
assert_equal Hash, config.class
|
|
20
|
-
assert_equal "/
|
|
20
|
+
assert_equal "/tmp", configs[:manifest_config][:root_dir]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def test_manifest_config_in
|
|
@@ -38,6 +38,24 @@ class ConfigParserTest < Minitest::Test
|
|
|
38
38
|
assert_equal :in, configs[:stage_config][:method]
|
|
39
39
|
end
|
|
40
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
|
+
|
|
41
59
|
def test_manifest_config_current
|
|
42
60
|
logger = Logger.new("/dev/null")
|
|
43
61
|
options = {
|
|
@@ -76,6 +94,63 @@ class ConfigParserTest < Minitest::Test
|
|
|
76
94
|
assert_nil project[:files]
|
|
77
95
|
end
|
|
78
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
|
|
109
|
+
|
|
110
|
+
def test_setup_project_config_bad_project_dir
|
|
111
|
+
config = good_config
|
|
112
|
+
config[:projects][:project1][:directory] = "/dev/null"
|
|
113
|
+
args = {
|
|
114
|
+
config: config,
|
|
115
|
+
options: {sideload: true, project: :project1}
|
|
116
|
+
}
|
|
117
|
+
project = {}
|
|
118
|
+
File.stub(:exist?, true) do
|
|
119
|
+
project = RokuBuilder::ConfigParser.send(:setup_project_config, **args)
|
|
120
|
+
end
|
|
121
|
+
assert_equal RokuBuilder::BAD_PROJECT_DIR, project
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_setup_project_config_bad_child_project_dir
|
|
125
|
+
config = good_config
|
|
126
|
+
config[:projects][:project_dir] = "/tmp"
|
|
127
|
+
config[:projects][:project1][:directory] = "bad"
|
|
128
|
+
args = {
|
|
129
|
+
config: config,
|
|
130
|
+
options: {sideload: true, project: :project1}
|
|
131
|
+
}
|
|
132
|
+
project = {}
|
|
133
|
+
File.stub(:exist?, true) do
|
|
134
|
+
project = RokuBuilder::ConfigParser.send(:setup_project_config, **args)
|
|
135
|
+
end
|
|
136
|
+
assert_equal RokuBuilder::BAD_PROJECT_DIR, project
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def test_setup_project_config_bad_parent_project_dir
|
|
140
|
+
config = good_config
|
|
141
|
+
config[:projects][:project_dir] = "/bad"
|
|
142
|
+
config[:projects][:project1][:directory] = "good"
|
|
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
|
|
153
|
+
|
|
79
154
|
def test_setup_stage_config_script
|
|
80
155
|
args = {
|
|
81
156
|
configs: {project_config: {directory: "/tmp", stage_method: :script, stages: {production: {script: "script"}}}},
|
|
@@ -116,7 +191,7 @@ class ConfigParserTest < Minitest::Test
|
|
|
116
191
|
|
|
117
192
|
assert_equal RokuBuilder::SUCCESS, code
|
|
118
193
|
assert_equal Hash, config.class
|
|
119
|
-
assert_equal "/
|
|
194
|
+
assert_equal "/tmp", configs[:project_config][:directory]
|
|
120
195
|
end
|
|
121
196
|
|
|
122
197
|
def test_manifest_config_project_directory
|
|
@@ -133,7 +208,9 @@ class ConfigParserTest < Minitest::Test
|
|
|
133
208
|
code = nil
|
|
134
209
|
configs = nil
|
|
135
210
|
|
|
136
|
-
|
|
211
|
+
Dir.stub(:exist?, true) do
|
|
212
|
+
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
|
213
|
+
end
|
|
137
214
|
|
|
138
215
|
assert_equal RokuBuilder::SUCCESS, code
|
|
139
216
|
assert_equal Hash, config.class
|
|
@@ -158,7 +235,9 @@ class ConfigParserTest < Minitest::Test
|
|
|
158
235
|
configs = nil
|
|
159
236
|
|
|
160
237
|
Pathname.stub(:pwd, Pathname.new("/tmp/project2")) do
|
|
161
|
-
|
|
238
|
+
Dir.stub(:exist?, true) do
|
|
239
|
+
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
|
240
|
+
end
|
|
162
241
|
end
|
|
163
242
|
|
|
164
243
|
assert_equal RokuBuilder::SUCCESS, code
|
|
@@ -167,11 +246,12 @@ class ConfigParserTest < Minitest::Test
|
|
|
167
246
|
end
|
|
168
247
|
|
|
169
248
|
def test_manifest_config_key_directory
|
|
249
|
+
tmp_file = Tempfile.new("pkg")
|
|
170
250
|
logger = Logger.new("/dev/null")
|
|
171
251
|
options = {key: true, project: :project2}
|
|
172
252
|
config = good_config
|
|
173
|
-
config[:keys][:key_dir] =
|
|
174
|
-
config[:keys][:a][:keyed_pkg] =
|
|
253
|
+
config[:keys][:key_dir] = File.dirname(tmp_file.path)
|
|
254
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
|
175
255
|
|
|
176
256
|
|
|
177
257
|
code = nil
|
|
@@ -181,7 +261,40 @@ class ConfigParserTest < Minitest::Test
|
|
|
181
261
|
|
|
182
262
|
assert_equal RokuBuilder::SUCCESS, code
|
|
183
263
|
assert_equal Hash, config.class
|
|
184
|
-
assert_equal
|
|
264
|
+
assert_equal tmp_file.path, configs[:key][:keyed_pkg]
|
|
265
|
+
tmp_file.close
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def test_manifest_config_key_directory_bad
|
|
269
|
+
tmp_file = Tempfile.new("pkg")
|
|
270
|
+
logger = Logger.new("/dev/null")
|
|
271
|
+
options = {key: true, project: :project2}
|
|
272
|
+
config = good_config
|
|
273
|
+
config[:keys][:key_dir] = "/bad"
|
|
274
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)
|
|
275
|
+
|
|
276
|
+
code = nil
|
|
277
|
+
configs = nil
|
|
278
|
+
|
|
279
|
+
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
|
280
|
+
|
|
281
|
+
assert_equal RokuBuilder::BAD_KEY_FILE, code
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def test_manifest_config_key_path_bad
|
|
285
|
+
tmp_file = Tempfile.new("pkg")
|
|
286
|
+
logger = Logger.new("/dev/null")
|
|
287
|
+
options = {key: true, project: :project2}
|
|
288
|
+
config = good_config
|
|
289
|
+
config[:keys][:key_dir] = File.dirname(tmp_file.path)
|
|
290
|
+
config[:keys][:a][:keyed_pkg] = File.basename(tmp_file.path)+".bad"
|
|
291
|
+
|
|
292
|
+
code = nil
|
|
293
|
+
configs = nil
|
|
294
|
+
|
|
295
|
+
code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
|
|
296
|
+
|
|
297
|
+
assert_equal RokuBuilder::BAD_KEY_FILE, code
|
|
185
298
|
end
|
|
186
299
|
|
|
187
300
|
def test_setup_sideload_config
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"projects": {
|
|
11
11
|
"default": "p1",
|
|
12
12
|
"p1": {
|
|
13
|
-
"directory": "/dev/
|
|
13
|
+
"directory": "/dev/nuller",
|
|
14
14
|
"folders": ["resources","source"],
|
|
15
15
|
"files": ["manifest"],
|
|
16
16
|
"app_name": "app",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"production": {
|
|
19
19
|
"branch": "master",
|
|
20
20
|
"key": {
|
|
21
|
-
"keyed_pkg": "/
|
|
21
|
+
"keyed_pkg": "/tmp",
|
|
22
22
|
"password": "password"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -27,7 +27,7 @@ def good_config
|
|
|
27
27
|
projects: {
|
|
28
28
|
default: :project1,
|
|
29
29
|
project1: {
|
|
30
|
-
directory: "/
|
|
30
|
+
directory: "/tmp",
|
|
31
31
|
folders: ["resources","source"],
|
|
32
32
|
files: ["manifest"],
|
|
33
33
|
app_name: "<app name>",
|
|
@@ -36,14 +36,14 @@ def good_config
|
|
|
36
36
|
production: {
|
|
37
37
|
branch: "production",
|
|
38
38
|
key: {
|
|
39
|
-
keyed_pkg: "/
|
|
39
|
+
keyed_pkg: "/tmp",
|
|
40
40
|
password: "<password for pkg>"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
project2: {
|
|
46
|
-
directory: "/
|
|
46
|
+
directory: "/tmp",
|
|
47
47
|
folders: ["resources","source"],
|
|
48
48
|
files: ["manifest"],
|
|
49
49
|
app_name: "<app name>",
|
|
@@ -58,7 +58,7 @@ def good_config
|
|
|
58
58
|
},
|
|
59
59
|
keys: {
|
|
60
60
|
a: {
|
|
61
|
-
keyed_pkg: "/
|
|
61
|
+
keyed_pkg: "/tmp",
|
|
62
62
|
password: "password"
|
|
63
63
|
}
|
|
64
64
|
},
|
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: 3.12.
|
|
4
|
+
version: 3.12.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- greeneca
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-03-
|
|
11
|
+
date: 2017-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rubyzip
|