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

Add missing RDoc::RubygemsHook API for gem server #1270

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

mterada1228
Copy link
Contributor

@mterada1228 mterada1228 commented Jan 5, 2025

This PR fixes #1269.

Expected Behavior

gem server command is successful.

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

Actual Behavior

gem server command doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError.

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

rdoc -v
6.10.0

@mterada1228 mterada1228 marked this pull request as draft January 5, 2025 01:49
@mterada1228 mterada1228 changed the title Fix: #1269 gem server doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError [WIP] Fix: #1269 gem server doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError Jan 5, 2025
lib/rdoc/rubygems_hook.rb Outdated Show resolved Hide resolved
lib/rdoc/rubygems_hook.rb Outdated Show resolved Hide resolved
@mterada1228 mterada1228 marked this pull request as ready for review January 5, 2025 08:02
@mterada1228
Copy link
Contributor Author

@kou

Thank you for your suggestion.
It looks good to me. so I applied all changes.

@mterada1228 mterada1228 changed the title [WIP] Fix: #1269 gem server doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError Fix: #1269 gem server doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError Jan 5, 2025
@kou
Copy link
Member

kou commented Jan 5, 2025

Could you also try http://localhost:8808/ ?

rubygems-server also uses Gem::RDoc#rdoc_installed? and Gem::RDoc#ri_installed?:
https://github.com/rubygems/rubygems-server/blob/55a910c18412213e960c385642f2a7dc6a98f36d/lib/rubygems/server.rb#L652-L653

@st0012 st0012 added the bug label Jan 5, 2025
@mterada1228
Copy link
Contributor Author

Could you also try http://localhost:8808/ ?

rubygems-server also uses Gem::RDoc#rdoc_installed? and Gem::RDoc#ri_installed?: https://github.com/rubygems/rubygems-server/blob/55a910c18412213e960c385642f2a7dc6a98f36d/lib/rubygems/server.rb#L652-L653

@kou

I'm apologize that my checking was not enough.
I must implement rdoc_installed? and ri_installed?.

Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!
@kou since I don't have as much context on this as you do, feel free to merge it when you think it's ready.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou changed the title Fix: #1269 gem server doesn't work because Gem::Rdoc.load_rdoc raise NoMethodError Add missing RDoc::RubygemsHook API for gem server Jan 7, 2025
@kou kou merged commit b6a8224 into ruby:master Jan 7, 2025
24 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request 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 <[email protected]>
@kou
Copy link
Member

kou commented Jan 7, 2025

Thanks.
I've merged.

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

Successfully merging this pull request may close these issues.

gem server uses Gem::RDoc.load_rdoc
3 participants