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

gem server uses Gem::RDoc.load_rdoc #1269

Closed
kou opened this issue Jan 2, 2025 · 2 comments · Fixed by #1270
Closed

gem server uses Gem::RDoc.load_rdoc #1269

kou opened this issue Jan 2, 2025 · 2 comments · Fixed by #1270

Comments

@kou
Copy link
Member

kou commented Jan 2, 2025

https://github.com/rubygems/rubygems-server/blob/55a910c18412213e960c385642f2a7dc6a98f36d/lib/rubygems/server.rb#L437

How to reproduce:

Install rubygems-server:

gem install rubygems-server

Run gem server:

$ gem server
ERROR:  While executing gem ... (NoMethodError)
    undefined method 'load_rdoc' for class RDoc::RubygemsHook

    Gem::RDoc.load_rdoc
             ^^^^^^^^^^
	/tmp/local/lib/ruby/gems/3.4.0+1/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:437:in 'Gem::Server#initialize'
	/tmp/local/lib/ruby/gems/3.4.0+1/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Class#new'
	/tmp/local/lib/ruby/gems/3.4.0+1/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Gem::Server.run'
	/tmp/local/lib/ruby/gems/3.4.0+1/gems/rubygems-server-0.3.0/lib/rubygems/commands/server_command.rb:83:in 'Gem::Commands::ServerCommand#execute'
	/tmp/local/lib/ruby/3.4.0+1/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
	/tmp/local/lib/ruby/3.4.0+1/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
	/tmp/local/lib/ruby/3.4.0+1/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
	/tmp/local/lib/ruby/3.4.0+1/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
	/tmp/local/lib/ruby/3.4.0+1/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
	/tmp/local/bin/gem:12:in '<main>'
@kou
Copy link
Member Author

kou commented Jan 2, 2025

@mterada1228 Do you want to take a look at this?

@mterada1228
Copy link
Contributor

@kou Yes, I do. I’ll check it later.

mterada1228 added a commit to mterada1228/rdoc that referenced this issue Jan 5, 2025
kou added a commit that referenced this issue Jan 7, 2025
This PR fixes #1269.

## Expected Behavior

`gem server` command is successful.

```console
$ gem server
Server started at http://[::]:8808
Server started at http://0.0.0.0:8808
```

http://127.0.0.1:8808/ works.

## Actual Behavior

`gem server` command doesn't work because `Gem::RDoc.load_rdoc` raises
`NoMethodError`.

```console
$ gem server
ERROR:  While executing gem ... (NoMethodError)
    undefined method 'load_rdoc' for class RDoc::RubygemsHook

    Gem::RDoc.load_rdoc
             ^^^^^^^^^^
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:437:in 'Gem::Server#initialize'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Class#new'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Gem::Server.run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/commands/server_command.rb:83:in 'Gem::Commands::ServerCommand#execute'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
        /Users/mterada/.rbenv/versions/3.4.1/bin/gem:12:in '<main>'
```

## Versions

```console
$ rdoc -v
6.10.0
```

---------

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@kou kou closed this as completed in #1270 Jan 7, 2025
matzbot pushed a commit to ruby/ruby that referenced this issue Jan 7, 2025
(ruby/rdoc#1270)

This PR fixes ruby/rdoc#1269.

## Expected Behavior

`gem server` command is successful.

```console
$ gem server
Server started at http://[::]:8808
Server started at http://0.0.0.0:8808
```

http://127.0.0.1:8808/ works.

## Actual Behavior

`gem server` command doesn't work because `Gem::RDoc.load_rdoc` raises
`NoMethodError`.

```console
$ gem server
ERROR:  While executing gem ... (NoMethodError)
    undefined method 'load_rdoc' for class RDoc::RubygemsHook

    Gem::RDoc.load_rdoc
             ^^^^^^^^^^
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:437:in 'Gem::Server#initialize'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Class#new'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Gem::Server.run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/commands/server_command.rb:83:in 'Gem::Commands::ServerCommand#execute'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
        /Users/mterada/.rbenv/versions/3.4.1/bin/gem:12:in '<main>'
```

## Versions

```console
$ rdoc -v
6.10.0
```

---------

ruby/rdoc@b6a82244a2

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants