Commit graph

22 commits

Author SHA1 Message Date
Yusuke Endoh
6ab76a6212 [rubygems/rubygems] Prevent a warning: net/http: Content-Type did not set
`make test-all RUBYOPT=-w` in the ruby/ruby repo printed the warning.
This change prevents the warning by specifying the content-type
explicitly.

A follow-up to b70c1bb150

d573af07f6
2024-11-25 10:13:32 +00:00
Samuel Giddins
b70c1bb150 [rubygems/rubygems] Add --attestation option to gem push
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

a5412d9a0e
2024-11-20 19:32:49 +00:00
David Rodríguez
9ce1b5e11f [rubygems/rubygems] Fix commands with 2 MFA requests when webauthn is enabled
If a command requires two MFA authenticated requests, and webauthn is
enabled, then first one will succeed but the second one will fail
because it tries to reuse the OTP code from the first request and that
does not work.

This happens when you have not yet logged in to rubygems.org, or when
you have an API key with invalid scopes for the current operation. In
that case, we need:

* An API request to get a token or change scopes for the one that you
  have.
* Another API request to perform the actual operation.

Instead of trying to reuse the token, make sure it's cleared so we are
asked to authenticate again. We only do this when webauthn is enabled
because reusing TOPT tokens otherwise is allowed and I don't want to
break that.

669e343935
2024-11-04 10:04:58 +00:00
David Rodríguez
d64d0b5423
Vendor uri gem in RubyGems 2024-01-29 12:14:21 +09:00
David Rodríguez
ce924ce1fb [rubygems/rubygems] Vendor net-http and net-protocol in RubyGems
99d91c9ed2
2023-12-13 12:16:55 +09:00
Nobuyoshi Nakada
11ee4f2b71 [rubygems/rubygems] Suppress Content-Type warnings
97dbe4cabd
2023-06-19 17:24:38 +00:00
Jenny Shen
27322e51a7 [rubygems/rubygems] Add MockBrowser helper class
2d763cfd47

Co-authored-by: Jacques Chester <jacques.chester@shopify.com>
2023-04-12 11:51:04 +09:00
lukeg
28d6c6d69b [rubygems/rubygems] add some test suites under the Gem namespace, so as not to collide
To avoid collisions especially in ruby/ruby

e6b2359975
2023-04-05 14:38:20 +09:00
Hiroshi SHIBATA
a881b33818 [rubygems/rubygems] util/rubocop -A --only Performance/RegexpMatch
52ae4452c2
2023-04-04 12:20:43 +00:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
d8c5fa963f [rubygems/rubygems] util/rubocop -A --only Style/YodaCondition
3594945391
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
0b632b9cdd [rubygems/rubygems] util/rubocop -A --only Style/ClassCheck
1c3356a872
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
3d4c3f9e4f [rubygems/rubygems] util/rubocop -A --only Style/ParallelAssignment
5c88c77873
2023-03-17 18:50:55 +09:00
Yusuke Endoh
962f9932af [rubygems/rubygems] Prevent a "warning: assigned but unused variable - data"
ec3fd55d40
2022-09-30 15:50:46 +09:00
Jenny Shen
0522e31d57 [rubygems/rubygems] Refactor tests to use Net::HTTPResponse instances for fetcher.data[:path]
4d91cacb1f

Co-authored-by: Jacques Chester <jacques.chester@shopify.com>
2022-09-29 17:56:36 +09:00
Jenny Shen
17b783ad9e [rubygems/rubygems] Surface entire redirect uri in permanent redirections
da7837630b
2022-09-29 17:56:35 +09:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
Takuya Noguchi
d7ffd3fea4
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-07-22 12:07:23 +09:00
David Rodríguez
f04954d95c
[rubygems/rubygems] Normalize end alignment style with Bundler
f7f504b24c
2022-01-19 11:20:36 +09:00
Daniel Niknam
589377fbdc [rubygems/rubygems] Refactor Gem::RemoteFetcher::FetchError.build back to its initialize method
21dcdd2dc5
2021-08-31 19:06:14 +09:00
Daniel Niknam
3adc141a79 [rubygems/rubygems] Refactor Gem::RemoteFetcher::FetchError initializer to build method
The `initialize` method is already doing a lot and by adding the `Gem::PrintableUri` to redact sensitive information, things are getting complicated and hard to read here. For the start, I have refactored the `initialize` method into a class method called `build`.

4312e8fdf5
2021-08-31 19:06:14 +09:00
Yusuke Endoh
b957c3dbcb [rubygems/rubygems] Rename test/rubygems/test_{case,utilities}.rb to avoid "test_" prefix
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".

The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:

```
t.test_files = FileList['test/**/test_*.rb']
```

Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c6820971, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.

Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.

6460e018df
2021-06-03 12:23:22 +09:00
Renamed from test/rubygems/test_utilities.rb (Browse further)