Skip to content

Commit

Permalink
Add qpid_proton stubs for macs so we can run zeitwek:check
Browse files Browse the repository at this point in the history
Before this, macs had to prevent zeitwerk from testing eager loading
the caller file expecting the Qpid constant to be known.

Now, we can run it:
DEBUG_MANAGEIQ_ZEITWERK=true bin/rails zeitwerk:check --trace
  • Loading branch information
jrafanie committed Oct 23, 2023
1 parent 883525a commit 9d31ed7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 0 additions & 6 deletions config/initializers/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,4 @@
Rails.autoloaders.main.collapse(Rails.root.join("lib/manageiq/reporting/charting"))
Rails.autoloaders.main.collapse(Rails.root.join("lib/ansible/runner/credential"))
Rails.autoloaders.main.collapse(Rails.root.join("lib/pdf_generator"))

# requires qpid, which is an optional dependency because LOL mac
if RUBY_PLATFORM.include?("darwin")
message_handler_path = Pathname.new(Vmdb::Plugins.paths[ManageIQ::Providers::Nuage::Engine]).join("app/models/manageiq/providers/nuage/network_manager/event_catcher/messaging_handler.rb")
Rails.autoloaders.main.ignore(message_handler_path)
end
end
9 changes: 9 additions & 0 deletions lib/qpid/proton/container.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fake qpid_proton stub so zeitwerk can autoload on platforms that can't build the gem, such as macos.
if RUBY_PLATFORM.include?("darwin")
module Qpid
module Proton
class Container
end
end
end
end
9 changes: 9 additions & 0 deletions lib/qpid/proton/messaging_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fake qpid_proton stub so zeitwerk can autoload on platforms that can't build the gem, such as macos.
if RUBY_PLATFORM.include?("darwin")
module Qpid
module Proton
class MessagingHandler
end
end
end
end

0 comments on commit 9d31ed7

Please sign in to comment.