roku_builder 4.12.3 → 4.13.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 +4 -4
- data/CHANGELOG +10 -0
- data/config.json.example +1 -2
- data/lib/roku_builder/config.rb +1 -1
- data/lib/roku_builder/config_parser.rb +10 -2
- data/lib/roku_builder/config_validator.rb +9 -6
- data/lib/roku_builder/plugins/loader.rb +11 -27
- data/lib/roku_builder/version.rb +1 -1
- data/test/roku_builder/plugins/test_analyzer.rb +1 -1
- data/test/roku_builder/test_config_validator.rb +14 -3
- data/test/roku_builder/test_helper.rb +2 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e77383c33c69d2858c263393e4e4ae038e2a8c9
|
4
|
+
data.tar.gz: 4ab74464ad9fcc48e0b2dd991d0799220de1802c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e3df3b2a6f7f138b6600c04d48de8bf46213e37fea263fd0c8090b53530690659c79aeddfa165a84ccc1bfa848698fc6bd4d0a5f0d4cfdb425bee4b423c8046
|
7
|
+
data.tar.gz: 3700e5da2d298fe907dd4638213daa4c128ace3c740de0b5db31f44295d750c507eb82cd2c3195c923ea95e8a4f1f9e7c534d4ce594722613be5414949ad3d47
|
data/CHANGELOG
CHANGED
data/config.json.example
CHANGED
@@ -12,8 +12,7 @@
|
|
12
12
|
"project_dir": "<optional parent directory for all projects>",
|
13
13
|
"<project id>": {
|
14
14
|
"directory": "<path/to/repo>",
|
15
|
-
"
|
16
|
-
"files": ["manifest"],
|
15
|
+
"source_files": ["resources","source", "manifest"],
|
17
16
|
"excludes": [],
|
18
17
|
"app_name": "<app name>",
|
19
18
|
"stage_method": "<git|script>",
|
data/lib/roku_builder/config.rb
CHANGED
@@ -97,7 +97,7 @@ module RokuBuilder
|
|
97
97
|
merge_local_config
|
98
98
|
expand_repeatable_stages
|
99
99
|
fix_config_symbol_values
|
100
|
-
RokuBuilder.process_hook(hook: "post_config_load", params: {config: @config})
|
100
|
+
RokuBuilder.process_hook(hook: "post_config_load", params: {config: @config, options: @options})
|
101
101
|
end
|
102
102
|
|
103
103
|
def read_config(io)
|
@@ -120,6 +120,7 @@ module RokuBuilder
|
|
120
120
|
@parsed[:project] = @config[:projects][@options[:project].to_sym].dup
|
121
121
|
raise ParseError, "Unknown Project: #{@options[:project]}" unless @parsed[:project]
|
122
122
|
set_project_directory
|
123
|
+
convert_to_source_files
|
123
124
|
check_for_working
|
124
125
|
end
|
125
126
|
end
|
@@ -130,8 +131,7 @@ module RokuBuilder
|
|
130
131
|
raise ParseError, "Missing Manifest: #{manifest}" unless File.exist?(manifest)
|
131
132
|
@parsed[:project] = {
|
132
133
|
directory: pwd,
|
133
|
-
|
134
|
-
files: nil,
|
134
|
+
source_files: nil,
|
135
135
|
stage_method: :current
|
136
136
|
}
|
137
137
|
end
|
@@ -145,6 +145,14 @@ module RokuBuilder
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
+
def convert_to_source_files
|
149
|
+
unless @parsed[:project][:source_files]
|
150
|
+
@parsed[:project][:source_files] = @parsed[:project][:files] + @parsed[:project][:folders]
|
151
|
+
@parsed[:project].delete(:files)
|
152
|
+
@parsed[:project].delete(:folders)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
148
156
|
def check_for_working
|
149
157
|
@parsed[:project][:stage_method] = :working if @options[:working]
|
150
158
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
module RokuBuilder
|
4
4
|
class ConfigValidator
|
5
5
|
|
6
|
+
DEPRICATED_FILES_FOLDERS = -1
|
6
7
|
VALID_CONFIG = 0
|
7
8
|
MISSING_DEVICES = 1
|
8
9
|
MISSING_DEVICES_DEFAULT = 2
|
@@ -15,7 +16,7 @@ module RokuBuilder
|
|
15
16
|
DEVICE_MISSING_PASSWORD = 9
|
16
17
|
PROJECT_MISSING_APP_NAME = 10
|
17
18
|
PROJECT_MISSING_DIRECTORY = 11
|
18
|
-
|
19
|
+
# = 12
|
19
20
|
PROJECT_FOLDERS_BAD = 13
|
20
21
|
PROJECT_MISSING_FILES = 14
|
21
22
|
PROJECT_FILES_BAD = 15
|
@@ -138,12 +139,12 @@ module RokuBuilder
|
|
138
139
|
errors= [
|
139
140
|
[PROJECT_MISSING_APP_NAME, (!project[:app_name])],
|
140
141
|
[PROJECT_MISSING_DIRECTORY, (!project[:directory])],
|
141
|
-
[PROJECT_MISSING_FOLDERS, (!project[:folders])],
|
142
142
|
[PROJECT_FOLDERS_BAD, (project[:folders] and !project[:folders].is_a?(Array))],
|
143
|
-
[PROJECT_MISSING_FILES, (!project[:files])],
|
143
|
+
[PROJECT_MISSING_FILES, (!project[:source_files] and !(project[:files] and project[:folders]))],
|
144
144
|
[PROJECT_FILES_BAD, (project[:files] and !project[:files].is_a?(Array))],
|
145
145
|
[MISSING_STAGE_METHOD, ( !project[:stage_method])],
|
146
|
-
[PROJECT_STAGE_METHOD_BAD, (![:git, :script, nil].include?(project[:stage_method]))]
|
146
|
+
[PROJECT_STAGE_METHOD_BAD, (![:git, :script, nil].include?(project[:stage_method]))],
|
147
|
+
[DEPRICATED_FILES_FOLDERS, (project[:files] or project[:folders])],
|
147
148
|
]
|
148
149
|
process_errors(errors: errors)
|
149
150
|
end
|
@@ -195,7 +196,7 @@ module RokuBuilder
|
|
195
196
|
"A device config is missing its password.",
|
196
197
|
"A project config is missing its app_name.", #10
|
197
198
|
"A project config is missing its directorty.",
|
198
|
-
"
|
199
|
+
"",
|
199
200
|
"A project config's folders is not an array.",
|
200
201
|
"A project config is missing its files.",
|
201
202
|
"A project config's files is not an array.", #15
|
@@ -206,7 +207,9 @@ module RokuBuilder
|
|
206
207
|
"A key is missing its password.", #20
|
207
208
|
"A input mapping is invalid",
|
208
209
|
"A key is missing from the keys section",
|
209
|
-
"A project is missing its stage method."
|
210
|
+
"A project is missing its stage method.",
|
211
|
+
#===============Warnings===============#
|
212
|
+
"Using depricated files/folders projects keys. Use the combined source_files instead" #-1
|
210
213
|
]
|
211
214
|
end
|
212
215
|
end
|
@@ -104,14 +104,13 @@ module RokuBuilder
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def setup_build_content()
|
107
|
-
content = {
|
108
|
-
|
107
|
+
content = {
|
108
|
+
excludes: []
|
109
|
+
}
|
109
110
|
if @options[:current]
|
110
|
-
content[:
|
111
|
-
content[:files] = Dir.entries(@config.root_dir).select {|entry| File.file? File.join(@config.root_dir, entry)}
|
111
|
+
content[:source_files] = Dir.entries(@config.root_dir).select {|entry| !(entry =='.' || entry == '..') }
|
112
112
|
else
|
113
|
-
content[:
|
114
|
-
content[:files] = @config.project[:files]
|
113
|
+
content[:source_files] = @config.project[:source_files]
|
115
114
|
content[:excludes] = @config.project[:excludes] if @config.project[:excludes] and (@options[:exclude] or @options.exclude_command?)
|
116
115
|
end
|
117
116
|
content
|
@@ -121,20 +120,7 @@ module RokuBuilder
|
|
121
120
|
path = file_path(:out)
|
122
121
|
File.delete(path) if File.exist?(path)
|
123
122
|
io = Zip::File.open(path, Zip::File::CREATE)
|
124
|
-
|
125
|
-
content[:folders].each do |folder|
|
126
|
-
base_folder = File.join(@config.root_dir, folder)
|
127
|
-
if File.exist?(base_folder)
|
128
|
-
entries = Dir.entries(base_folder)
|
129
|
-
entries.delete(".")
|
130
|
-
entries.delete("..")
|
131
|
-
writeEntries(@config.root_dir, entries, folder, content[:excludes], io)
|
132
|
-
else
|
133
|
-
@logger.warn "Missing Folder: #{base_folder}"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
# Add file to zip
|
137
|
-
writeEntries(@config.parsed[:root_dir], content[:files], "", content[:excludes], io)
|
123
|
+
writeEntries(@config.parsed[:root_dir], content[:source_files], "", content[:excludes], io)
|
138
124
|
io.close()
|
139
125
|
end
|
140
126
|
|
@@ -168,13 +154,11 @@ module RokuBuilder
|
|
168
154
|
}
|
169
155
|
end
|
170
156
|
def copy_channel_files(content)
|
171
|
-
[:
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
@logger.warn "Missing Entry: #{entity}"
|
177
|
-
end
|
157
|
+
content[:source_files].each do |entity|
|
158
|
+
begin
|
159
|
+
FileUtils.copy_entry(File.join(@config.parsed[:root_dir], entity), File.join(@target, entity))
|
160
|
+
rescue Errno::ENOENT
|
161
|
+
@logger.warn "Missing Entry: #{entity}"
|
178
162
|
end
|
179
163
|
end
|
180
164
|
end
|
data/lib/roku_builder/version.rb
CHANGED
@@ -260,7 +260,7 @@ module RokuBuilder
|
|
260
260
|
end
|
261
261
|
def test_macosx_directory
|
262
262
|
config = good_config(AnalyzerTest)
|
263
|
-
config[:projects][:project1][:
|
263
|
+
config[:projects][:project1][:source_files].push("Test__MACOSX")
|
264
264
|
@config, @options = build_config_options_objects(AnalyzerTest, {analyze: true, working: true}, false, config)
|
265
265
|
folder = File.join(@root_dir, "Test__MACOSX")
|
266
266
|
Dir.mkdir(folder) unless File.exist?(folder)
|
@@ -137,21 +137,32 @@ module RokuBuilder
|
|
137
137
|
|
138
138
|
def test_config_manager_validate_project_folders
|
139
139
|
config = good_config
|
140
|
+
config[:projects][:project1][:files] = ["manifest"]
|
140
141
|
config[:projects][:project1][:folders] = nil
|
142
|
+
config[:projects][:project1][:source_files] = nil
|
141
143
|
validator = ConfigValidator.new(config: config)
|
142
|
-
assert_equal [
|
144
|
+
assert_equal [14, -1], validator.instance_variable_get(:@codes)
|
143
145
|
end
|
144
146
|
|
145
147
|
def test_config_manager_validate_project_folders_is_array
|
146
148
|
config = good_config
|
147
149
|
config[:projects][:project1][:folders] = "Folders"
|
148
150
|
validator = ConfigValidator.new(config: config)
|
149
|
-
assert_equal [13], validator.instance_variable_get(:@codes)
|
151
|
+
assert_equal [13, -1], validator.instance_variable_get(:@codes)
|
150
152
|
end
|
151
153
|
|
152
154
|
def test_config_manager_validate_project_files
|
153
155
|
config = good_config
|
154
156
|
config[:projects][:project1][:files] = nil
|
157
|
+
config[:projects][:project1][:folders] = ["images", "source"]
|
158
|
+
config[:projects][:project1][:source_files] = nil
|
159
|
+
validator = ConfigValidator.new(config: config)
|
160
|
+
assert_equal [14, -1], validator.instance_variable_get(:@codes)
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_config_manager_validate_project_source_files
|
164
|
+
config = good_config
|
165
|
+
config[:projects][:project1][:source_files] = nil
|
155
166
|
validator = ConfigValidator.new(config: config)
|
156
167
|
assert_equal [14], validator.instance_variable_get(:@codes)
|
157
168
|
end
|
@@ -160,7 +171,7 @@ module RokuBuilder
|
|
160
171
|
config = good_config
|
161
172
|
config[:projects][:project1][:files] = "Files"
|
162
173
|
validator = ConfigValidator.new(config: config)
|
163
|
-
assert_equal [15], validator.instance_variable_get(:@codes)
|
174
|
+
assert_equal [15, -1], validator.instance_variable_get(:@codes)
|
164
175
|
end
|
165
176
|
|
166
177
|
def test_config_manager_validate_project_key
|
@@ -77,8 +77,7 @@ def good_config(klass=nil)
|
|
77
77
|
default: :project1,
|
78
78
|
project1: {
|
79
79
|
directory: root_dir,
|
80
|
-
|
81
|
-
files: ["manifest"],
|
80
|
+
source_files: ["manifest", "images", "source"],
|
82
81
|
app_name: "<app name>",
|
83
82
|
stage_method: :git,
|
84
83
|
stages:{
|
@@ -93,8 +92,7 @@ def good_config(klass=nil)
|
|
93
92
|
},
|
94
93
|
project2: {
|
95
94
|
directory: root_dir,
|
96
|
-
|
97
|
-
files: ["manifest"],
|
95
|
+
source_files: ["images","source","manifest"],
|
98
96
|
app_name: "<app name>",
|
99
97
|
stage_method: :script,
|
100
98
|
stages:{
|