rails / propshaft

Deliver assets for Rails
MIT License
864 stars 93 forks source link

Require rack/version for Rack::RELEASE constant #159

Closed aaronjensen closed 10 months ago

aaronjensen commented 10 months ago

Addresses uninitialized constant Rack::RELEASE (NameError) in cases where propshaft is required before rack.

brenogazzola commented 10 months ago

Thanks for this one @aaronjensen. Before I merge, how do I reproduce this? Just want to check if there is anything else we might need to fix in this situation.

aaronjensen commented 10 months ago
❯ bundle exec irb
irb(main):001:0> require "propshaft"
/Users/user/Source/open/propshaft/lib/propshaft/server.rb:43:in `<class:Server>': uninitialized constant Rack::RELEASE (NameError)

    if Gem::Version.new(Rack::RELEASE) < Gem::Version.new("3")
                            ^^^^^^^^^
        from /Users/user/Source/open/propshaft/lib/propshaft/server.rb:3:in `<top (required)>'
        from /Users/user/Source/open/propshaft/lib/propshaft/assembly.rb:4:in `require'
        from /Users/user/Source/open/propshaft/lib/propshaft/assembly.rb:4:in `<top (required)>'
        from /Users/user/Source/open/propshaft/lib/propshaft.rb:9:in `require'
        from /Users/user/Source/open/propshaft/lib/propshaft.rb:9:in `<top (required)>'
        from (irb):1:in `require'
        from (irb):1:in `<main>'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.3.7/exe/irb:11:in `<top (required)>'
        from /Users/user/.asdf/installs/ruby/3.2.2/bin/irb:25:in `load'
        from /Users/user/.asdf/installs/ruby/3.2.2/bin/irb:25:in `<top (required)>'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `load'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/cli/exec.rb:23:in `run'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/cli.rb:491:in `exec'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /Users/user/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'