Skip to content

Commit

Permalink
ROKUPX-2770 - fix packager error
Browse files Browse the repository at this point in the history
  • Loading branch information
greeneca committed Jul 30, 2019
1 parent 0a16bd7 commit b8cd02a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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 b8cd02a

Please sign in to comment.