Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rackup removed its dependency on webrick #2785

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Earlopain
Copy link

Show a error message telling the user what they must do to solve this problem.

require 'capybara'
Capybara.server = :webrick

app = proc { |_env| [200, {}, ['Hello Server!']] }
server = Capybara::Server.new(app)
server.boot
/home/user/code/capybara/lib/capybara/server.rb:77: warning: webrick was loaded from the standard library, but is not part of the default gems starting from Ruby 3.0.0.
You can add webrick to your Gemfile or gemspec to silence this warning.
#<Thread:0x00007f3b6bca31d8 /home/user/code/capybara/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.3.6/lib/ruby/3.3.0/bundled_gems.rb:69:in `require': cannot load such file -- webrick (LoadError)

After:

#<Thread:0x00007fa56bb52fa8 /home/user/code/capybara/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/home/user/code/capybara/lib/capybara/registrations/servers.rb:21:in `rescue in rescue in block in <top (required)>': Capybara is unable to load `webrick` for its server, please add `webrick` to your project or specify a different server. (LoadError)

Ref: rack/rackup#23

Show a error message telling the user what they must do to solve this problem.

```rb
require 'capybara'
Capybara.server = :webrick

app = proc { |_env| [200, {}, ['Hello Server!']] }
server = Capybara::Server.new(app)
server.boot
```

```
/home/user/code/capybara/lib/capybara/server.rb:77: warning: webrick was loaded from the standard library, but is not part of the default gems starting from Ruby 3.0.0.
You can add webrick to your Gemfile or gemspec to silence this warning.
#<Thread:0x00007f3b6bca31d8 /home/user/code/capybara/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/home/user/.rbenv/versions/3.3.6/lib/ruby/3.3.0/bundled_gems.rb:69:in `require': cannot load such file -- webrick (LoadError)
```

After:
```
#<Thread:0x00007fa56bb52fa8 /home/user/code/capybara/lib/capybara/server.rb:76 run> terminated with exception (report_on_exception is true):
/home/user/code/capybara/lib/capybara/registrations/servers.rb:21:in `rescue in rescue in block in <top (required)>': Capybara is unable to load `webrick` for its server, please add `webrick` to your project or specify a different server. (LoadError)
```
begin
# Rackup 2.2.0 has removed its dependency on webrick. The user
# must add it to their bundle themselves.
verbose, $VERBOSE = $VERBOSE, nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This supresses the warning that ruby would produce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant