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

Fix double colons in questions asked from GemcutterUtilities #7644

Closed

Conversation

technicalpickles
Copy link
Contributor

At some point, this is using Thor, and it automaticlaly adds a trailing : with space, so we don't need to do it ourselves.

What was the end-user or developer problem that led to this PR?

I was using https://github.com/rubygems/configure_trusted_publisher and got minorly annoyed by the double : prompts:

Enter your RubyGems.org credentials.
Don't have an account yet? Create one at https://rubygems.org/sign_up

Username/email: : [email protected]

      Password: : 
You have enabled multi-factor authentication. Please enter OTP code.

Code: : 12345678

What is your fix for the problem, implemented in this PR?

Update these ask calls to not include the :

Make sure the following tasks are checked

At some point, this is using Thor, and it automaticlaly adds a trailing
`:` with space, so we don't need to do it ourselves.
@technicalpickles
Copy link
Contributor Author

The tests are failing because there isn't a colon 😅 I wonder if it has to do with the thor version?

@deivid-rodriguez
Copy link
Member

I don't think RubyGems uses thor. Bundler uses thor, but uses a fixed version so even then thor version should be irrelevant. So maybe it's something else? I'm unsure about what could cause this.

@technicalpickles
Copy link
Contributor Author

Well, I can reproduce the test failure locally at least.

The place I observed it was in https://github.com/rubygems/configure_trusted_publisher ... my output is identical to the readme, ie:

$ gem exec configure_trusted_publisher rubygem
Configuring trusted publisher for rubygem0 in /Users/segiddins/Development/github.com/rubygems/configure_trusted_publisher for rubygems/configure_trusted_publisher

Enter your https://rubygems.org credentials.
Don't have an account yet? Create one at https://rubygems.org/sign_up
Username/email: : gem-author
      Password: :

  1) Automatically when a new tag matching v* is pushed
  2) Manually by running a GitHub Action

How would you like releases for rubygem0 to be triggered? (1, 2) [2]: 2

Successfully configured trusted publisher for rubygem0:
  https://rubygems.org/gems/rubygem0/trusted_publishers

Specifically, Username/email and Password have extra : in them.

@technicalpickles technicalpickles marked this pull request as draft May 13, 2024 19:46
@simi
Copy link
Member

simi commented May 31, 2024

@technicalpickles I can confirm this seems not actually fixing the problem you see. Can you reopen at https://github.com/rubygems/configure_trusted_publisher maybe?

irb(main):001> require 'rubygems/user_interaction'
=> true
irb(main):002> Gem::DefaultUserInteraction.ui.ask "Hello"
Hello  yes
=> "yes"
irb(main):003> Gem::DefaultUserInteraction.ui.ask "Hello:"
Hello:  no
=> "no"

@deivid-rodriguez
Copy link
Member

Yes, this seems definitely an issue in https://github.com/rubygems/configure_trusted_publisher. It uses https://github.com/postmodern/command_kit.rb/blob/2f8c485eca112d06bd3fbd301f5659d4967a3ac7/lib/command_kit/interactive.rb#L75 for asking questions, which adds ": " automatically. And it tries to remove the ":" from rubygems question at https://github.com/rubygems/configure_trusted_publisher/blob/4245c026d3de2dd63b92d714dfc7c35a7723ade6/lib/configure_trusted_publisher/cli.rb#L163 to avoid the duplication. However, I think the chomp is probably not working because there are spaces after the ":". I think strip.chomp(":") would probably do the trick!

@technicalpickles Since you're already using the trusted publishers CLI, I'll let you verify that the suggestion works and upstream it, but let me know if you'd prefer that I do that!

@technicalpickles
Copy link
Contributor Author

Thanks for looking into this! Filed rubygems/configure_trusted_publisher#11 for it

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.

None yet

3 participants