Commit graph

14659 commits

Author SHA1 Message Date
David Rodríguez
1098fdf890 [rubygems/rubygems] Also document gem env argument aliases
6d841ccbd4
2022-06-29 03:25:45 +09:00
David Rodríguez
7a33d3df6a [rubygems/rubygems] Document better names for gem env arguments
I think `gem env home` and `gem env path` read very nice.

b89da79456
2022-06-29 03:25:45 +09:00
Burdette Lamar
59273ff6e2 [ruby/fileutils] [DOC] Changes to examples (https://github.com/ruby/fileutils/pull/96)
* Changes to examples

346a71b2cb
2022-06-29 00:39:59 +09:00
st0012
7d211c93af [ruby/irb] Color.colorable? needs to consider the condition when irb is not loaded
ruby/debug uses `irb/color` selectively:
0ac22406bb/lib/debug/color.rb (L4)

And in that case, `IRB.conf` won't be defined. So Color.colorable? needs
to consider that.

This also fixes the Ruby trunk CI.

b2cd07e795
2022-06-28 22:57:17 +09:00
Stan Lo
44c1316293 [ruby/irb] Centralize coloring control (https://github.com/ruby/irb/pull/374)
* Use colorable: argument as the only coloring control

* Centalize color controling logic at Color.colorable?

There are 2 requirements for coloring output:

1. It's supported on the platform
2. The user wants it: `IRB.conf[:USE_COLORIZE] == true`

Right now we check 1 and 2 separately whenever we colorize things.
But it's error-prone because while 1 is the default of `colorable`
parameter, 2 always need to manually checked. When 2 is overlooked, it
causes issues like https://github.com/ruby/irb/pull/362

And there's 0 case where we may want to colorize even when the user
disables it. So I think we should merge 2 into `Color.colorable?` so it
can be automatically picked up.

* Add tests for all inspect modes

* Simplify inspectors' coloring logic

* Replace use_colorize? with Color.colorable?

* Remove Context#use_colorize cause it's redundant

1c53023ac4
2022-06-28 22:30:42 +09:00
Nobuyoshi Nakada
5ccdcd8168 [ruby/rdoc] Remove dead code
f727854bd5
2022-06-28 21:24:59 +09:00
Nobuyoshi Nakada
131422ceea [ruby/rdoc] Support attributes defined by rb_struct_define
854b370763
2022-06-28 20:17:30 +09:00
Nobuyoshi Nakada
98bf8c83fa [ruby/rdoc] Refinement is added since ruby 3.1
c051eb90d1
2022-06-28 15:49:05 +09:00
Nobuyoshi Nakada
51be2cf6d2 [ruby/rdoc] Parse also InitVM-prefixed functions
Initialization depending on VM is separated.

030d10fccd
2022-06-28 14:51:49 +09:00
David Rodríguez
f9f85a513b [rubygems/rubygems] Print error messages just once in verbose mode
When running a command with the `--verbose` flag that ends up raising a
`BundlerError`, Bundler will unnecessarily print the error twice.

This commit fixes the issue by removing the duplicate logging.

689004a164
2022-06-27 23:35:45 +09:00
pocari
8c6c3e30f3 [ruby/reline] Enable to change the background color of dialogs. (https://github.com/ruby/reline/pull/413)
bd49537964
2022-06-27 22:28:49 +09:00
David Rodríguez
f83c5de6d5 [rubygems/rubygems] Improve error message when operating_system.rb fails to load
Show an absolute path instead of an unhelpful relative path.

f1eed36e2f
2022-06-27 17:03:24 +09:00
Peter Jones
e0bfdb23af [ruby/irb] Ensure stdout is a TTY before calling winsize
When outputting a (possibly truncated) value, IRB will query the
window size.  However, if IRB was piped to another process, stdout
will no longer be a TTY and will not support the `winsize` method.

This fix ensure that stdout is a TTY.

125de5eeea
2022-06-26 14:40:48 +09:00
Tomas Volf
56809537a4 [rubygems/rubygems] Clean up temporary directory after generate_index --update
While generate_index did clean up temporary directory, when running with
--update flag, that did not happen and the temporary directory was left
behind.

This commit fixes that and modifies tests in order to make sure this is
not reintroduced later on.

Fixes #5635.

9fa34dc329
2022-06-26 11:15:43 +09:00
David Rodríguez
12a5fa408b Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
David Rodríguez
6f229da2c0 [rubygems/rubygems] Fix standalone script generation for statically linked dev ruby
4d0d7b3c97
2022-06-23 18:17:37 +09:00
David Rodríguez
4f5eb48dea [rubygems/rubygems] Fix bundle package --no-install no longer skipping install
This is a regression from cf749f8ffa. The
funny thing is that we have a spec for this feature, so it was unclear
how we regressed here. It turns out there was a bug in one of our
negative matchers checking that gems ARE NOT included in a bundle.

This commit fixes the bug in the negative matcher and reverts
cf749f8ffa (with a slightly simpler diff).

3f9a4ff32a
2022-06-23 18:17:08 +09:00
Takuya Noguchi
812354ace4 [rubygems/rubygems] Bundler: fix man page for bundle-add
Follows up https://github.com/rubygems/bundler/pull/5610

Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>

0c4df2b8ca
2022-06-22 13:40:21 +09:00
Burdette Lamar
fdd1102550 [ruby/fileutils] Clarify difference between cp_r and install (https://github.com/ruby/fileutils/pull/95)
94a599e69f
2022-06-22 02:23:10 +09:00
Burdette Lamar
2e81fd764b [ruby/fileutils] Correct method references for secure removal (https://github.com/ruby/fileutils/pull/93)
42c9685826
2022-06-21 23:16:24 +09:00
Burdette Lamar
1002998c6d [ruby/fileutils] [DOC] Adding 'Related' (https://github.com/ruby/fileutils/pull/92)
fc3cc28397
2022-06-21 22:42:39 +09:00
Peter Zhu
5ca2335802 [ruby/irb] [DOC] Fix formatting in docs
3ddc89e38c
2022-06-20 22:42:30 +09:00
Stan Lo
2d4a41df6b [ruby/irb] Commands should respect USE_COLORIZE config (https://github.com/ruby/irb/pull/362)
534688dfc4
2022-06-20 22:27:30 +09:00
citrusmoose
8d689294d0 [rubygems/rubygems] Fix extension paths in generated standalone script
The paths for extensions of gems would contain the hardcoded ruby
version on which the extension was built. This will replace it with
runtime ruby version like the parent version directory. It will make the
standalone script compatible between different ruby version installations.

a9dae93d5d
2022-06-20 16:04:47 +09:00
Josh Nichols
aeab405878 [rubygems/rubygems] Improve performance of Bundler::SpecSet#for by using hash lookup of handled deps
I was looking at (yet another) flamegraph in speedscope, and used the
'left hand heavy' and was shocked to realize that 0.5s of the 1.7s
is spent in DepProxy#name. This method _only_ delegates the name to an
underlying spec, so it's not complex at all.

It seems to be of how often this line ends up calling it:

     next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"

The `handled` array is built up as dependencies are handled, so this get
slower as more dependencies are installed.

This change changes how `handled` is track. Instead of just an array, I've
tried using a Hash, with the key being a dep's name, and the value being
a list of deps with that name. This means it's constant time to find
the dependencies with the same name.

I saw a drop from 1.7s to 1.0s against master, and from 0.95s to 0.24s
when used with https://github.com/rubygems/rubygems/pull/5533

844dac30d4
2022-06-20 02:34:41 +09:00
Burdette Lamar
9327b6f222 [ruby/fileutils] [DOC] Revisions for module-level doc (https://github.com/ruby/fileutils/pull/90)
* Revisions for module-level doc

dcbad90a1f
2022-06-17 22:36:26 +09:00
David Rodríguez
1e8bf48fd5 [rubygems/rubygems] Bring TODO message up to date
e07dba0923
2022-06-17 17:05:21 +09:00
David Rodríguez
5450b409fc [rubygems/rubygems] Remove part of comment that fell out of date
272ac23aa8
2022-06-17 17:05:20 +09:00
David Rodríguez
8855b68f97 [rubygems/rubygems] Don't modify RbConfig at all when building extensions
Instead, pass sitearchdir and sitelibdir directly to `make`.

This also removes the need to create and use the siteconf file at all
when generating makefiles.

dea41fa2dc
2022-06-17 17:05:20 +09:00
David Rodríguez
1aaeff8e36 [rubygems/rubygems] Remove unnecessary condition
This variable can't be falsy.

b838f9a6f0
2022-06-17 17:05:19 +09:00
David Rodríguez
5a385677f3 [rubygems/rubygems] No need to change RbConfig::CONFIG at all
Only `RbConfig::MAKEFILE_CONFIG` is actually used.

b767cc0929
2022-06-17 17:05:19 +09:00
Burdette Lamar
0ab2bca11c [ruby/fileutils] [DOC] Small tweaks (https://github.com/ruby/fileutils/pull/89)
13ab96439b
2022-06-16 23:56:37 +09:00
Shishir Joshi
c310691dd8 [ruby/net-http] Make Net::HTTPHeader#content_range return nil on non-byte units
* Returning nil from the `content_range` method instead of raising an
  error when the unit in the content-range header is not "bytes".

Fix https://bugs.ruby-lang.org/issues/11450

0b5030dd86

Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-06-16 23:35:27 +09:00
Nobuyoshi Nakada
2223eb082a
Revert "HTTPHeader.content_range throws error on non-byte units"
This reverts commit 63546bfc15.
2022-06-16 22:10:59 +09:00
Nobuyoshi Nakada
1cc64a5514 [ruby/racc] Fix flag to Regexp.new
Probably intended to pass encoding "none".

65cd26efd8
2022-06-16 21:43:53 +09:00
Shishir Joshi
63546bfc15
HTTPHeader.content_range throws error on non-byte units
* Added a nil check in Net::HTTPHeader#initialize_http_header for keys in the header that do not have any value
* Returning nil from the content_range method instead of raising an error when the unit in the content-range header is not bytes
* Modified initialize_http_header to match trunk

fix [Bug #11450]
fix https://github.com/ruby/ruby/pull/1018
2022-06-16 20:16:47 +09:00
Burdette Lamar
1e8fed2d2a [ruby/fileutils] [DOC] More on paths and lists (https://github.com/ruby/fileutils/pull/88)
ba3ae2430d
2022-06-16 05:56:39 +09:00
Burdette Lamar
788a5e14fa [ruby/fileutils] [DOC] More on cp_r (https://github.com/ruby/fileutils/pull/87)
* More on cp_r

82a2b62578
2022-06-15 05:42:26 +09:00
Burdette Lamar
9b9cc8ad34 [ruby/fileutils] [DOC] More on paths and lists (https://github.com/ruby/fileutils/pull/86)
* More on paths and lists

c3d92d34f4
2022-06-14 22:52:22 +09:00
Burdette Lamar
9a381c240c [ruby/fileutils] [DOC] Clarify path arguments (https://github.com/ruby/fileutils/pull/85)
5f9ef9ddc8
2022-06-14 00:39:44 +09:00
Burdette Lamar
753da6deca [ruby/fileutils] [DOC] Enhanced Rdoc (https://github.com/ruby/fileutils/pull/84)
Treats:

    ::chown_R
    ::touch
    ::commands
    ::options
    ::have_option?
    ::options_of
    ::collect_method

5df0324f52
2022-06-13 21:11:45 +09:00
st0012
b1397e96da [ruby/reline] Revert "Merge pull request #441 from nevans/workaround-linker-script-so"
This reverts commit 4ccf128ffa, reversing
changes made to a2651419e9.

51053138a4
2022-06-13 19:33:15 +09:00
Nobuyoshi Nakada
d9ccb6b372 [ruby/reline] Check the ambiguous char width only on tty
It sent the char to check even to non-tty, e.g., pipe.
This causes `unknown command: "\xE2\x96\xBDstart ` warnings on
ruby's parallel test on Windows, where non-standard FDs cannot be
passed to child processes.

0d373647fb
2022-06-13 12:17:04 +09:00
David Rodríguez
d0bf31e6cf [rubygems/rubygems] Don't on gemspecs with invalid require_paths, just warn
These gemspecs already work most of the times. When they are installed
normally, the require_paths in the gemspec stub line becomes actually
correct, and the incorrect value in the real gemspec is ignored. It only
becomes an issue in standalone mode.

In Ruby 3.2, `Kernel#=~` has been removed, and that means that it
becomes harder for us to gracefully deal with this error in standalone
mode, because it now happens earlier due to calling `Array#=~` for this
invalid gemspec (since require_paths is incorrectly an array of arrays).

The easiest way to fix this is to actually make this just work instead
by automatically fixing the issue when reading the packaged gemspec.

d3f2fe6d26
2022-06-12 02:02:20 +09:00
David Rodríguez
7f9eb888a3 [rubygems/rubygems] Reuse package from the installer for extracting the specification
Previously we would instantiate two different packages and extract the
specification from the package twice for each gem installed. We can
reuse the installer for this so that we just need to do it once.

e454f850b1
2022-06-11 18:43:28 +09:00
David Rodríguez
965c314e34 [rubygems/rubygems] Move security exception handling to the only place using it
ba975b3b7f
2022-06-11 18:43:27 +09:00
David Rodríguez
bf8dc36e40 [rubygems/rubygems] Swapping should not raise any errors
600a9ac658
2022-06-11 18:43:27 +09:00
David Rodríguez
6292b36529 [rubygems/rubygems] Remove unclear comment
This is the explanation of why we do the swapping, not of why we
download the gem.

1a25eb7e7b
2022-06-11 18:43:26 +09:00
David Rodríguez
52cc76d134 [rubygems/rubygems] Gem::Specification.loaded_from is already set by the installer
796eebfdbf
2022-06-11 18:43:26 +09:00
David Rodríguez
22c97ab8ae [rubygems/rubygems] Refactor some more duplicated logic
9bd389e1b6
2022-06-11 18:43:25 +09:00