-
Notifications
You must be signed in to change notification settings - Fork 208
Description
I was experimenting with warbling a Sidekiq jar but because it had Rails and Rack in its dependencies the "war" trait activated automatically.
Currently, the "war" trait activates if it detects either Rails or Rack:
warbler/lib/warbler/traits/war.rb
Lines 20 to 22 in ef819a7
| def self.detect? | |
| Traits::Rails.detect? || Traits::Rack.detect? | |
| end |
And the "jar" trait deactivates if the "war" trait activates:
warbler/lib/warbler/traits/jar.rb
Lines 19 to 21 in 085c783
| def self.detect? | |
| !War.detect? | |
| end |
But Sidekiq is server that runs from the command-line, so I was forced to manually disable those other traits:
diff -rU 5 ../warbler/lib/warbler/traits/rack.rb ../jruby/lib/ruby/gems/shared/gems/warbler-2.1.0/lib/warbler/traits/rack.rb
--- ../warbler/lib/warbler/traits/rack.rb 2025-10-01 10:24:06
+++ ../jruby/lib/ruby/gems/shared/gems/warbler-2.1.0/lib/warbler/traits/rack.rb 2025-10-22 14:47:25
@@ -10,11 +10,11 @@
# The Rack trait adds config.ru to a Rack-based war project.
class Rack
include Trait
def self.detect?
- !Rails.detect? && (File.exist?("config.ru") || !Dir['*/config.ru'].empty?)
+ false #!Rails.detect? && (File.exist?("config.ru") || !Dir['*/config.ru'].empty?)
end
def self.requirements
[ Traits::War ]
end
diff -rU 5 ../warbler/lib/warbler/traits/war.rb ../jruby/lib/ruby/gems/shared/gems/warbler-2.1.0/lib/warbler/traits/war.rb
--- ../warbler/lib/warbler/traits/war.rb 2025-10-01 10:24:06
+++ ../jruby/lib/ruby/gems/shared/gems/warbler-2.1.0/lib/warbler/traits/war.rb 2025-10-22 14:44:12
@@ -16,11 +16,11 @@
include PathmapHelper
DEFAULT_GEM_PATH = '/WEB-INF/gems'
def self.detect?
- Traits::Rails.detect? || Traits::Rack.detect?
+ false #Traits::Rails.detect? || Traits::Rack.detect?
end
def before_configure
config.gem_path = DEFAULT_GEM_PATH
config.pathmaps = default_pathmapsI am not an expert at Rake internals, so perhaps there's another way to disable this, but it seems not because it autodetects all traits and activates whatever is "detected".