Skip to content

Commit

Permalink
Merge da1f17b into 43a62ef
Browse files Browse the repository at this point in the history
  • Loading branch information
greeneca committed Jul 30, 2019
2 parents 43a62ef + da1f17b commit 69a2fab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions lib/roku_builder/plugins/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module RokuBuilder
class Loader < Util
extend Plugin

def init
@warningFileSize = 250 * 1024
end

def self.commands
{
sideload: {source: true, device: true, stage: true},
Expand Down Expand Up @@ -153,6 +157,10 @@ def writeEntries(root_dir, entries, path, excludes, io)
else
unless excludes.include?(zipFilePath)
if File.exist?(diskFilePath)
if File.size(diskFilePath) > @warningFileSize
ignorePath = File.join(File.dirname(diskFilePath), "ignoreSize_"+File.basename(diskFilePath))
@logger.warn "Adding Large File: #{diskFilePath}" unless File.exist?(ignorePath)
end
# Deny filetypes that aren't compatible with Roku to avoid Certification issues.
if !zipFilePath.end_with?(".pkg", ".md", ".zip")
io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read()) }
Expand Down
10 changes: 7 additions & 3 deletions lib/roku_builder/plugins/packager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,13 @@ def sign_package(app_name_version:, password:, stage: nil)
out_file = File.join(@config.out[:folder], @config.out[:file])
out_file = out_file+".pkg" unless out_file.end_with?(".pkg")
File.open(out_file, 'w+b') {|fp| fp.write(response.body)}
pkg_size = File.size(out_file).to_f / 2**20
raise ExecutionError, "PKG file size is too large (#{pkg_size.round(2)} MB): #{out_file}" if pkg_size > 4.0
@logger.info("Outfile: #{out_file}")
if File.exist?(out_file)
pkg_size = File.size(out_file).to_f / 2**20
raise ExecutionError, "PKG file size is too large (#{pkg_size.round(2)} MB): #{out_file}" if pkg_size > 4.0
@logger.info("Outfile: #{out_file}")
else
@logger.warn("Outfile Missing: #{out_file}")
end
end

# Uses the device to generate a new signing key
Expand Down
4 changes: 2 additions & 2 deletions test/roku_builder/plugins/test_packager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_packager_package

logger.expect(:debug, nil, [String])
io.expect(:each_line, nil)
logger.expect(:info, nil) do |message|
logger.expect(:warn, nil) do |message|
assert_match(/#{tmp_folder}/, message)
end

Expand Down Expand Up @@ -142,7 +142,7 @@ def test_packager_package_squash

logger.expect(:debug, nil, [String])
io.expect(:each_line, nil)
logger.expect(:info, nil) do |message|
logger.expect(:warn, nil) do |message|
assert_match(/#{tmp_folder}/, message)
end

Expand Down

0 comments on commit 69a2fab

Please sign in to comment.