Skip to content

Commit

Permalink
fix: Allow the postprocessor image to do nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma authored Sep 20, 2021
1 parent 17e9391 commit cc927d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions owlbot-postprocessor/lib/owlbot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,20 @@ def entrypoint logger: nil, gem_name: nil

# @private
def multi_entrypoint logger: nil
error "No staging root dir #{STAGING_ROOT_NAME}" unless ::File.directory? STAGING_ROOT_NAME
unless ::File.directory? STAGING_ROOT_NAME
logger&.warn "No staging root dir #{STAGING_ROOT_NAME}. Nothing for the Ruby postprocessor to do."
return self
end
children = ::Dir.children STAGING_ROOT_NAME
error "No staging dirs under #{STAGING_ROOT_NAME}" if children.empty?
if children.empty?
logger&.warn "No staging dirs under #{STAGING_ROOT_NAME}. Nothing for the Ruby postprocessor to do."
return self
end
logger&.info "Multi-entrypoint found staging directories: #{children}"
children.each do |child|
entrypoint logger: logger, gem_name: child
end
self
end

private
Expand Down
6 changes: 6 additions & 0 deletions owlbot-postprocessor/test/test_owlbot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,5 +402,11 @@ def invoke_image *args
assert_gem_file "lib/foo.rb", "puts 'bar'\n", gem: "gem1"
assert_gem_file "lib/foo.rb", "puts 'baz'\n", gem: "gem2"
end

it "does not fail if there is no staging root dir" do
::FileUtils.rm_rf staging_root_dir

invoke_image
end
end
end

0 comments on commit cc927d0

Please sign in to comment.