Граф коммитов

1557 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 1f0e0dfb22
Thread::Queue.new should accept an Enumerable [Feature #17327]
Enumerable implements #to_a but not #to_array.
2021-02-12 12:21:49 +09:00
Chris Seaton c3b2bb0969
The Queue constructor should take an initial set of objects
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-02-11 19:14:18 +09:00
Kazuhiro NISHIYAMA f600226fb4
Fix failures with EditLine
On macOS with EditLine:
```
$ ruby -r readline -e 'Readline.readline("> "); p Readline::VERSION' < /dev/null
"EditLine wrapper"
```

On Linux with GNU readline:
```
$ ruby -r readline -e 'Readline.readline("> "); p Readline::VERSION' < /dev/null
> "8.0"
```
2021-02-03 14:38:31 +09:00
Kazuhiro NISHIYAMA acb6b395b6
Fix failure when build in srcdir/build
If `build` directory exists, `rake build` is `Rake::FileTask`.
So skip if exists.
2021-01-29 11:59:42 +09:00
Nobuyoshi Nakada 522adbc945 Fixed Kernel#rand spec
Float should not be compared by identity.
2021-01-29 11:36:13 +09:00
Benoit Daloze 2e32b919b4 Update to ruby/spec@8cafaa5 2021-01-28 17:08:57 +01:00
Kazuhiro NISHIYAMA 1b377b32c8
Add fallback when PWD is not set 2021-01-28 18:23:13 +09:00
Kazuhiro NISHIYAMA 763d242fcd
Use PWD instead of source_root
Because `.ext/common` is not relative from top source directory.
Fix failures with out-of-place build directory.
2021-01-28 18:01:06 +09:00
Kazuhiro NISHIYAMA 7cd97a81d1
Remove require_path from $LOADED_FEATURES
because some features are already loaded.
2021-01-28 18:00:10 +09:00
Kazuhiro NISHIYAMA 00bd645f09
Delete path including `/../` too 2021-01-28 18:00:10 +09:00
Nobuyoshi Nakada b409a34b41
Taint flags has been deprecated in 3.1 2021-01-27 14:45:31 +09:00
Gannon McGibbon 9e0075a3d9 Replace "iff" with "if and only if"
iff means if and only if, but readers without that knowledge might
assume this to be a spelling mistake. To me, this seems like
exclusionary language that is unnecessary. Simply using "if and only if"
instead should suffice.
2021-01-19 12:06:45 -08:00
Nobuyoshi Nakada c3d6bac325
Upcoming Struct#new behavior 2021-01-18 15:55:10 +09:00
Takashi Kokubun e1fee7f949
Rename RubyVM::MJIT to RubyVM::JIT
because the name "MJIT" is an internal code name, it's inconsistent with
--jit while they are related to each other, and I want to discourage future
JIT implementation-specific (e.g. MJIT-specific) APIs by this rename.

[Feature #17490]
2021-01-13 22:46:51 -08:00
Nobuyoshi Nakada 7dc0511ea4 Remove "." and ".." from Dir.glob with FNM_DOTMATCH [Bug #17280]
Co-authored-by: Jeremy Evans <code@jeremyevans.net>
2021-01-12 20:02:43 +09:00
Nobuyoshi Nakada 5e00eeb4d4
[ruby/matrix] use an exclusive range [Bug #17521] 2021-01-11 14:00:35 +09:00
Marc-André Lafortune d8c8b79d24
[ruby/matrix] Fix 0-th power [Bug #17521] (#4047) 2021-01-10 16:21:10 -05:00
Hiroshi SHIBATA 69ed64949b Track Bundler master(2.3.0.dev) branch at 55634a8af18a52df86c4275d70fa1179118bcc20 2021-01-04 13:14:43 +09:00
Nobuyoshi Nakada 64d79d333b
Suppress too big exponent warnings 2020-12-28 12:12:54 +09:00
Benoit Daloze 727c97da19 Update to ruby/spec@4ce9f41 2020-12-27 17:35:32 +01:00
Benoit Daloze 267bed0cd9 Update to ruby/mspec@a40a674 2020-12-27 17:35:30 +01:00
Marcus Stollsteimer 93a1ef6709 Fix typos 2020-12-24 23:20:04 +01:00
Jeremy Evans 1e215a66d2 Fix class of method in Method#inspect for singleton classes of classes
Previously, due to a change to fix bug 15608, Method#inspect output
changed for class methods:

Ruby 2.7
"#<Method: String.prepend(*)>"

Before change:
"#<Method: #<Class:Object>(Module)#prepend(*)>"

This is wrong because the Method object was created from String and
not Object. This is because the fix for bug 15608 assumed it was
being called on the singleton class of a instance, and would skip
the first singleton class until it got to the class itself.  For
class methods, this results in always using the superclass. Fix
behavior to not skip until the superclass if the singleton class
is the singleton class of a module or class.

After change:
"#<Method: #<Class:Object>(Module)#prepend(*)>"

Fixes [Bug #17428]
2020-12-23 19:29:19 -08:00
Hiroshi SHIBATA 339227363c Merge RubyGems 3.2.3 and Bundler 2.2.3 2020-12-23 10:17:41 +09:00
卜部昌平 fa356a798a Enumerator.new: raise unless block given
Has been deprecated since c73b6bd7eb.
[Feature #17116] [ruby-dev:50945]
2020-12-22 13:52:03 +09:00
Nobuyoshi Nakada a29b9e5efe
Remvoed no longer needed version guards 2020-12-22 07:52:14 +09:00
Nobuyoshi Nakada 8918a9cf6c Removed rb_cData entity
* Use the wrapper of rb_cObject instead of data access
* Replaced rest of extentions
* Updated the version guard for Data
* Added the version guard of rb_cData
2020-12-22 02:51:49 +09:00
卜部昌平 c30f03d328 Data: delete
Has been deprecated since 684bdf6171.

Matz says in [ruby-core:83954] that Data should be an alias of Object.
Because rb_cData has not been deprecated, let us deprecate the constant
to make it a C-level synonym of rb_cObject.
2020-12-22 02:51:49 +09:00
Kazuhiro NISHIYAMA 63849a1cd9
Fix misspellings [ci skip] 2020-12-21 10:54:24 +09:00
Nobuyoshi Nakada 9c73c75624
Use Integer instead of Fixnum/Bignum 2020-12-21 01:19:55 +09:00
Nobuyoshi Nakada fb8f011422
Fixed indefinite articles before "Integer" [ci skip] 2020-12-21 01:19:55 +09:00
Nobuyoshi Nakada ad534a677a
Fixnum as a Symbol was an old feature until 1.6 2020-12-21 01:19:55 +09:00
Nobuyoshi Nakada ed4381d941
BigDecimal#precs is deprecated 2020-12-20 03:14:58 +09:00
Radosław Bułat eb8ea336d3 Feature 17314: allow to pass array to public, protected and private methods 2020-12-19 18:19:49 +09:00
Marc-Andre Lafortune 0d3dc2ec80 Make `Hash#except` always return a Hash
[Feature #15822]
2020-12-19 03:59:51 -05:00
Radosław Bułat 51bcd50915 Feature 17314: alias_method returns symbol 2020-12-19 12:23:58 +09:00
Yusuke Endoh 346bf0f5a5 spec/ruby/core/module/attr_*: Add version guards 2020-12-19 03:16:20 +09:00
Radosław Bułat 5944c4b3cf
attr_reader, attr_writer, attr_accessor and attr methods returns array of symbols (#3935)
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2020-12-19 03:11:35 +09:00
Yusuke Endoh 982443e6e3 Revert "Better cooperation between public/protected/private with attr* and alias_method"
This reverts commit 81739ad4fd.
2020-12-18 16:08:55 +09:00
Hiroshi SHIBATA 0e40cc9b19 Merge RubyGems 3.2.2 and Bundler 2.2.2 2020-12-18 13:33:18 +09:00
Radosław Bułat 81739ad4fd Better cooperation between public/protected/private with attr* and alias_method 2020-12-17 12:46:02 -05:00
Marc-Andre Lafortune d5f0d338c7 Optimize `Enumerable#grep{_v}`
[Bug #17030]
2020-12-15 12:54:45 -05:00
Hiroshi SHIBATA 2fa9f3c032 Prepare to release rubygems-3.2.1 and bundler-2.2.1 2020-12-15 10:54:09 +09:00
Benoit Daloze f5c89c1660 Deprecate Random::DEFAULT
* Closes [Feature #17351].
2020-12-14 20:29:50 +01:00
Kazuki Tsujimoto a8cf526ae9
Don't emit warning when the pattern of one-line pattern matching is just a variable pattern
https://github.com/ruby/dev-meeting-log/blob/master/DevelopersMeeting20201210Japan.md#feature-17371-reintroduce-expr-in-pat-ktsj
2020-12-13 11:51:49 +09:00
Yusuke Endoh 7ef5226520 spec: suppress deprecations of "lambda(&proc_block)" pattern 2020-12-12 23:25:15 +09:00
nicholas a. evans 31e8de2920 Let Fiber#raise work with transferring fibers
This automatically choosess whether to use transfer on a transferring
fiber or resume on a yielding fiber.  If the fiber is resuming, it
raises a FiberError.
2020-12-12 10:18:19 +13:00
Nobuyoshi Nakada dea600046a
Ad-hoc fix of test-bundler 2020-12-09 13:10:28 +09:00
Hiroshi SHIBATA 473f9d2df0 Merge prepare version of Bundler 2.2.0 2020-12-08 17:30:02 +09:00
Lars Kanis ca76337a00
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings

Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650

This also removes the special encoding for ENV['PATH'] and some
complexity in the code that is unnecessary now.

* Windows: Improve readablity of getenv() encoding

getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.

* Windows: Change external C-API macros getenv() and execv() to use UTF-8

They used to process and return strings with locale encoding,
but since all ruby-internal spawn and environment functions use UTF-8,
it makes sense to change the C-API equally.
2020-12-08 02:00:39 +09:00
Lars Kanis 94b6933d1c
Set default for Encoding.default_external to UTF-8 on Windows (#2877)
* Use UTF-8 as default for Encoding.default_external on Windows
* Document UTF-8 change on Windows to Encoding.default_external

fix https://bugs.ruby-lang.org/issues/16604
2020-12-08 01:48:37 +09:00
Nobuyoshi Nakada 7817a438eb Removed deprecated Time#succ 2020-12-07 18:38:59 +09:00
Nobuyoshi Nakada 20d53dad47
Update the version guard to 3.0 2020-12-07 18:35:59 +09:00
卜部昌平 547c71dec4
Hash#index: delete
Has been deprecated since 0c97c8e335.
2020-12-07 18:35:58 +09:00
Benoit Daloze 9dbb2bfd73 Wrap SortedSet with `ruby_version_is ""..."3.0"`
* Using $ spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.0"' spec/ruby/library/set/sortedset/**/*_spec.rb
2020-12-05 11:40:00 +01:00
Benoit Daloze bb3d705819 Add MSpec tool to automatically wrap spec files with a guard 2020-12-05 11:39:33 +01:00
Benoit Daloze d0bd43c332 Revert "SortedSet was removed at a3db08d7b6ff119223f77e3df00b4f6deac971e2"
* This reverts commit b06ffce4ae.
* Do not revert specs, wrap them with `ruby_version_is` (tool for that in next commit).
2020-12-05 11:17:22 +01:00
Benoit Daloze 9ea1055eab 2.8 -> 3.0 in specs 2020-12-04 16:32:14 +01:00
Hiroshi SHIBATA e666bd1c5a
Skip subclass spec with SortedSet 2020-12-04 19:36:30 +09:00
Hiroshi SHIBATA b06ffce4ae
SortedSet was removed at a3db08d7b6 2020-12-04 19:36:12 +09:00
卜部昌平 43b95bafd5
delete deprecated IO-like methods
This commit deletes
{IO,ARGF,StringIO,Zib::GZipReader}#{bytes,chars,lines,codepoints}, which
have been deprecated since c47c095b97.

Note that String also has those methods.  They are neither depreacted
nor deleted because they are not aliases of counterpart each_something.
2020-12-03 12:47:51 +09:00
卜部昌平 12a121cc0f
ENV.index: delete
Has been deprecated since 373282f665.
2020-12-02 20:17:11 +09:00
Benoit Daloze ddb1736bfc Update to ruby/spec@c4170a3 2020-11-27 15:47:17 +01:00
Benoit Daloze f02d2f82bf Update to ruby/spec@ac878ad 2020-11-27 14:55:31 +01:00
Benoit Daloze f0bfa266d7 Update to ruby/mspec@b58e665 2020-11-27 14:55:29 +01:00
Benoit Daloze f0e2ea2859 Clarify spec and change of behavior for Random::DEFAULT 2020-11-27 10:29:39 +01:00
Koichi Sasada 2db2fb9f6c per-ractor Random::DEFAULT
Random generators are not Ractor-safe, so we need to prepare
per-ractor default random genearators. This patch set
`Random::DEFAULT = Randm` (not a Random instance, but the Random
class) and singleton methods like `Random.rand()` use a per-ractor
random generator.

[Feature #17322]
2020-11-27 17:03:30 +09:00
Nobuyoshi Nakada 82e836dc7d
Use hex-encoded binaries instead of UTF-8
Which UTF-8 char corresponds to the binary representation is
nonsense for other encodings, and just confusing.
2020-11-22 22:51:28 +09:00
Lars Kanis d403591b34
Add string encoding IBM720 alias CP720 (#3803)
The mapping table is generated from the ICU project:
  https://github.com/unicode-org/icu/blob/master/icu4c/source/data/mappings/ibm-720_P100-1997.ucm

Fixes bug 16233 : https://bugs.ruby-lang.org/issues/16233
2020-11-22 22:23:40 +09:00
Nobuyoshi Nakada 7c879cbb3f
Suppress a unused-variable warning 2020-11-22 19:10:58 +09:00
Jeremy Evans 58325daae3 Make String methods return String instances when called on a subclass instance
This modifies the following String methods to return String instances
instead of subclass instances:

* String#*
* String#capitalize
* String#center
* String#chomp
* String#chop
* String#delete
* String#delete_prefix
* String#delete_suffix
* String#downcase
* String#dump
* String#each/#each_line
* String#gsub
* String#ljust
* String#lstrip
* String#partition
* String#reverse
* String#rjust
* String#rpartition
* String#rstrip
* String#scrub
* String#slice!
* String#slice/#[]
* String#split
* String#squeeze
* String#strip
* String#sub
* String#succ/#next
* String#swapcase
* String#tr
* String#tr_s
* String#upcase

This also fixes a bug in String#swapcase where it would return the
receiver instead of a copy of the receiver if the receiver was the
empty string.

Some string methods were left to return subclass instances:

* String#+@
* String#-@

Both of these methods will return the receiver (subclass instance)
in some cases, so it is best to keep the returned class consistent.

Fixes [#10845]
2020-11-20 16:30:23 -08:00
Jeremy Evans ce9beb9d20 Improve error message when subclassing non-Class
Fixes [Bug #14726]
2020-11-13 07:06:13 -08:00
Benoit Daloze 6d05967468 Update to ruby/spec@b0b7f53 2020-11-13 13:17:24 +01:00
Benoit Daloze acbe7aa197 Update to ruby/mspec@f8b0618 2020-11-13 13:17:22 +01:00
Hiroshi SHIBATA 69c5474e10
Fixup 957efa95cc 2020-11-13 13:19:38 +09:00
Yusuke Endoh 6325866421 spec/ruby/core/file/utime_spec.rb: XFS seems to have Year 2038 problem
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20201112T123004Z.fail.html.gz
```
1)
File.utime allows Time instances in the far future to set mtime and
atime (but some filesystems limit it up to 2446-05-10) FAILED
Expected [559444, 2446].include? 2038
to be truthy but was false
/home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:80:in
`block (4 levels) in <top (required)>'
/home/chkbuild/chkbuild/tmp/build/20201112T123004Z/ruby/spec/ruby/core/file/utime_spec.rb:3:in
`<top (required)>'
```

```
$ touch foo
$ ./miniruby -e 'time = Time.at(1<<44); File.utime(time, time, "foo")'
$ ls -l foo
-rw-r--r--. 1 mame wheel 0 Jan 19  2038 foo
```
2020-11-12 23:39:27 +09:00
Kazuki Tsujimoto 5823f6c25b
Fix indentation 2020-11-07 22:12:22 +09:00
Kazuki Tsujimoto 640fd94eff
Fix and remove spec testing undefined behavior 2020-11-07 22:05:20 +09:00
Marc-Andre Lafortune 6f24be8565 Revert "Make `marshal_load` public"
This reverts commit ee7cc6ac35.

I'm not sure I agree with the spec, but I just tweaked it.
2020-11-04 17:52:03 -05:00
Jeremy Evans 2a294d499b
Make Array methods return Array instances instead of subclass instances
This changes the following methods to return Array instances instead
of subclass instances:

* Array#drop
* Array#drop_while
* Array#flatten
* Array#slice!
* Array#slice/#[]
* Array#take
* Array#take_while
* Array#uniq
* Array#*

Fixes [Bug #6087]
2020-11-03 14:01:38 -08:00
Kazuki Tsujimoto 963359a762
Use the suppress_warning helper instead of doing it manually 2020-11-01 19:00:22 +09:00
Kazuki Tsujimoto 7282f3113d
Suppress "One-line pattern matching is experimental" warning 2020-11-01 18:19:58 +09:00
Kazuki Tsujimoto e0e2492cd3
Fix Rubyspec (ruby-2.7) failures
https://github.com/ruby/ruby/runs/1337845174
2020-11-01 17:37:03 +09:00
Koichi Sasada 0e33028d69 use one-line pattern matching for warning tests 2020-11-01 13:55:54 +09:00
Nobuyoshi Nakada 52c630da00
Assoc pattern matching (#3703)
[Feature #17260] One-line pattern matching using tASSOC

R-assignment is rejected instead.
2020-10-26 18:00:24 +09:00
Benoit Daloze cffdacb15a Ignore <internal: entries from core library methods for Kernel#warn(message, uplevel: n)
* Fixes [Bug #17259]
2020-10-26 08:47:33 +01:00
Benoit Daloze fbb2d30ee6 Add specs that #caller and #caller_locations include core library methods defined in Ruby 2020-10-26 08:47:33 +01:00
Benoit Daloze 3673c3eafc Update to ruby/spec@b164536 2020-10-26 08:20:48 +01:00
Benoit Daloze ba24aee292 Remove spec which is too difficult to get working with various compilers
* The spec means to use an actual system library function, not a wrapper.
2020-10-26 08:06:33 +01:00
Nobuyoshi Nakada b6d0b3dfaf
Use gcc-specific pragma only on gcc (and the family) 2020-10-26 08:16:51 +09:00
Nobuyoshi Nakada 25a332f5cf
Fix compilation on MSVC
* cast scalar value instead of function
* use `rb_pid_t` for the portability
2020-10-25 22:07:09 +09:00
Benoit Daloze 99e067eac6 Try to fix compilation on MSVC 2020-10-25 11:42:20 +01:00
Benoit Daloze 148961adcd Update to ruby/spec@4f59d86 2020-10-24 15:53:53 +02:00
Benoit Daloze 342fbae83c Update to ruby/mspec@b56e7a2 2020-10-24 15:53:53 +02:00
Kenta Murata f754b42285
numeric.c, range.c: prohibit zero step
* numeric.c: prohibit zero step in Numeric#step

* range.c: prohibit zero step in Range#step

* Fix ruby-spec

[Feature #15573]
2020-10-23 15:26:51 +09:00
Kazuhiro NISHIYAMA ce62850334
Fix typos [ci skip] 2020-10-19 13:20:34 +09:00
Hiroshi SHIBATA b68c22b3c6 Partly reverted test failing with https://github.com/rubygems/rubygems/pull/3921 2020-10-15 17:19:02 +09:00
Hiroshi SHIBATA d386a58f6f Merge bundler-2.2.0.rc.2 2020-10-15 17:19:02 +09:00
Yusuke Endoh 0b1b0f134e spec/ruby/library/socket/socket/listen_spec.rb: Allow both EACCES and EOPNOSUPP
on Android
2020-10-12 23:36:52 +09:00
Koichi Sasada bf3b2a4374 relax Fiber#transfer's restriction
Using Fiber#transfer with Fiber#resume for a same Fiber is
limited (once Fiber#transfer is called for a fiber, the fiber
can not be resumed more). This restriction was introduced to
protect the resume/yield chain, but we realized that it is too much
to protect the chain. Instead of the current restriction, we
introduce some other protections.

(1) can not transfer to the resuming fiber.
(2) can not transfer to the yielding fiber.
(3) can not resume transferred fiber.
(4) can not yield from not-resumed fiber.

[Bug #17221]

Also at the end of a transferred fiber, it had continued on root fiber.
However, if the root fiber resumed a fiber (and that fiber can resumed
another fiber), this behavior also breaks the resume/yield chain.
So at the end of a transferred fiber, switch to the edge of resume
chain from root fiber.
For example, root fiber resumed f1 and f1 resumed f2, transferred to
f3 and f3 terminated, then continue from the fiber f2 (it was continued
from root fiber without this patch).
2020-10-12 22:58:41 +09:00
Yusuke Endoh 2fd71112fb Make the test suite pass on real Android/Termux environment
Attempting to create a hard link raises EACCES
2020-10-12 21:26:05 +09:00
Nobuyoshi Nakada c881678cd7
Removed meaningless system dependent tests
As [Bug #16662] lchmod available in linux since glibc 2.31.9000, a
system call may exist or not exist depending on the version.  It
is not a spec nor responsibility of Ruby.
2020-10-02 08:43:33 +09:00
Yusuke Endoh ab99a2ac44 spec/ruby/core/process/spawn_spec.rb: skip a test on Android
On Android, STDERR seems to be open even its invoker closes it.

http://rubyci.s3.amazonaws.com/android29-x86_64/ruby-master/log/20201001T014315Z.fail.html.gz

```
1)
Process.spawn closes STDERR in the child if :err => :close FAILED
Expected (59840): "out\nrescued\n"
         but got: "out\n"
```
2020-10-01 13:27:32 +09:00
Marc-Andre Lafortune b36a45c05c [ruby/ostruct] Improved YAML serialization.
Patch adapted from Pietro Monteiro [Fixes bug#8382]
2020-09-30 18:11:24 -04:00
Benoit Daloze 65e8a29389 Update to ruby/spec@bfd843a 2020-09-30 13:43:19 +02:00
Benoit Daloze bbecf1eb6b Update to ruby/mspec@e154fa1 2020-09-30 13:43:17 +02:00
Benoit Daloze 8dab56ea86 Update to ruby/spec@681e8cf 2020-09-30 12:39:20 +02:00
Benoit Daloze 31636bbddc Update to ruby/mspec@4120a62 2020-09-30 12:39:18 +02:00
Benoit Daloze 201d501640 Update to ruby/spec@9277d27 2020-09-30 12:21:48 +02:00
Jeremy Evans 346301e232 Add rb_category_warn{,ing} for warning messages with categories
This adds the following C-API functions that can be used to emit
warnings with categories included:

```c
void rb_category_warn(const char *, const char*, ...)
void rb_category_warning(const char*, const char*, ...)
```

Internally in error.c, there is an rb_warn_category function
that will call Warning.warn with the string and the category
keyword if it doesn't have an arity of 1, and will call
Warning.warn with just the string if it has an arity of 1.
This refactors the rb_warn_deprecated{,_to_remove} functions
to use rb_warn_category.

This makes Kernel#warn accept a category keyword and pass it
to Warning.warn, so that Ruby methods can more easily emit
warnings with categories.  rb_warn_category makes sure that
the passed category is a already defined category symbol
before calling Warning.warn.

The only currently defined warning category is :deprecated,
since that is what is already used.  More categories can be
added in later commits.
2020-09-28 08:38:06 -07:00
Benoit Daloze f2c6a3513f Clarify spec description for Hash#{each,each_pair} 2020-09-28 11:29:15 +02:00
Steven Peckins 8863bfb1f4 [rubygems/rubygems] Move comment below shebang in bin/console template
In an executable script, the shebang line should be the first line (the
file needs to start with the bytes 0x23 0x21).  Putting a comment above
it will break the script.

(Regression test included per @deivid-rodriguez)

https://github.com/rubygems/rubygems/commit/962e669feb
2020-09-28 14:54:22 +09:00
Koichi Sasada 0096d2b895 freeze all Range objects.
Matz want to try to freeze all Range objects.
[Feature #15504]
2020-09-25 22:16:55 +09:00
Koichi Sasada fde136152e should not check taint flag on rubyspec.
Now taint flag is obsolete and it is used fro shareaable flag.
So we should not check this flag.
2020-09-25 12:52:53 +09:00
Nobuyoshi Nakada 996af2ce08 Disable deprecation warning by the default [Feature #16345]
And `-w` option turns it on.
2020-09-25 09:50:33 +09:00
Hiroshi SHIBATA a46841612c
bump Bundler's version to 2.2.0.rc.1 2020-09-23 21:06:29 +09:00
Jeremy Evans 179384a668 Revert "Prevent SystemStackError when calling super in module with activated refinement"
This reverts commit eeef16e190.

This also reverts the spec change.

Preventing the SystemStackError would be nice, but there is valid
code that the fix breaks, and it is probably more common than cases
that cause the SystemStackError.

Fixes [Bug #17182]
2020-09-22 12:04:48 -07:00
Benoit Daloze 82998918ef Make Thread#join always convert its argument, as before 70f08f1eed 2020-09-21 16:22:04 +02:00
Benoit Daloze c19bcf38eb Fix Thread leak in Thread#join specs 2020-09-21 15:54:39 +02:00
Samuel Williams 70f08f1eed Make `Thread#join` non-blocking. 2020-09-21 11:48:44 +12:00
Kazuhiro NISHIYAMA e4dbb91f4c
Fix typos [ci skip]
s/overriden/overridden/
2020-09-17 20:34:59 +09:00
Benoit Daloze 3f6c0a6d74 Update to ruby/spec@e829fb0 2020-09-17 11:42:26 +02:00
Chris Seaton 8e173d8b27 Warn on a finalizer that captures the object to be finalized
Also improve specs and documentation for finalizers and more clearly
recommend a safe code pattern to use them.
2020-09-16 13:52:24 -07:00
Benoit Daloze 1af0319fc8 2.8 -> 3.0 in specs 2020-09-15 21:56:00 +02:00
Benoit Daloze 9b535f3ff7 Interpolated strings are no longer frozen with frozen-string-literal: true
* Remove freezestring instruction since this was the only usage for it.
* [Feature #17104]
2020-09-15 21:32:35 +02:00
Marc-Andre Lafortune 60f5d38482 [ruby/ostruct] Fix dup/clone 2020-09-14 16:10:37 -04:00
Marc-Andre Lafortune 125605abd9 [ruby/ostruct] method_missing is private 2020-09-14 16:10:37 -04:00
Benoit Daloze 178c1b0922 Make Mutex per-Fiber instead of per-Thread
* Enables Mutex to be used as synchronization between multiple Fibers
  of the same Thread.
* With a Fiber scheduler we can yield to another Fiber on contended
  Mutex#lock instead of blocking the entire thread.
* This also makes the behavior of Mutex consistent across CRuby, JRuby and TruffleRuby.
* [Feature #16792]
2020-09-14 16:44:09 +12:00
Hiroshi SHIBATA b194973dcd
Revert the related commits about `Tempfile.open` change.
Start with fa21985a7a
  to d7492a0be8
2020-09-09 21:10:48 +09:00
Marc-Andre Lafortune 5e16857315 Fix constant names set using const_set on a singleton class
Fixes [Bug #14895]
2020-09-02 00:05:14 -04:00
Nobuyoshi Nakada 2e80c8347e
Deprecate iterator? method
[Feature #15547] [Fix GH-2071]
2020-08-31 22:14:14 +09:00
卜部昌平 b674fc9ca2
Thread.exclusive: delete
Has been deprecated since 2069c9e031.

[Feature #17125][ruby-core:99636]
2020-08-31 18:08:57 +09:00
Benoit Daloze ff323b2a5c Adapt specs for the new Tempfile.open with block behavior 2020-08-29 12:11:07 +02:00
Benoit Daloze 1199f1a4aa Fix warnings related to new Socket.gethostby* deprecations 2020-08-29 11:58:56 +02:00
Benoit Daloze b49307c701 Update to ruby/spec@335eb9b 2020-08-28 20:26:02 +02:00
Benoit Daloze 3dd63108b0 Update to ruby/mspec@53a6e3e 2020-08-28 20:26:00 +02:00
Nobuyoshi Nakada 7e1fddba4a
States Time.at expects rational-like argument to respond to #to_int
https://bugs.ruby-lang.org/issues/17131
2020-08-28 19:47:29 +09:00
卜部昌平 cc2caa6edf do not test --version
`llvm-strip-7` is a sane valid strip command that LLVM 7 ships, albeit
it does not understand `--version`.  It is a bad idea to check that
option.  Instead just see if the command actually strips something.  A
copy of `/bin/sh` should suffice.  That file must be ubiquitous.
2020-08-22 00:33:37 +09:00
Nguyễn Quang Minh 1819652578
[Feature #16513] TracePoint#inspect returns "... file:line" (#3391)
* Fix debug documents to match Thread#to_s change (Feature #16412 ticket)

* TracePoint#inspect returns "... file:line" (Feature #16513)

* Guard older version of Ruby in Tracepoint inspection tests

* Focus on current thread only when running TracePoint inspection test
2020-08-06 11:56:24 +09:00
David Rodríguez 07dc9691a8 [rubygems/rubygems] https functionality was merged into `net/https`
https://github.com/rubygems/rubygems/commit/d81ce9e457
2020-07-31 21:07:19 +09:00
Benoit Daloze 241244739f Fix arity of Hash#to_proc [Bug #12671] 2020-07-29 18:09:53 +02:00
Kazuhiro NISHIYAMA 946cd6c534
Use https instead of http 2020-07-28 19:51:54 +09:00
Nobuyoshi Nakada f44114b502
Do not assume all compilers accept same flags as gcc 2020-07-28 16:43:38 +09:00
Benoit Daloze 126fd5f15c Update to ruby/spec@07164da 2020-07-27 21:41:08 +02:00
Benoit Daloze 7429841ab6 Update to ruby/mspec@9cffee9 2020-07-27 21:41:03 +02:00
Jeremy Evans d47e124857 Switch reserved for numbered parameter warning to SyntaxError 2020-07-22 08:34:51 -07:00
Nobuyoshi Nakada 840115bf46 Make StringIO encoding fixed
Get rid of affects by default external encoding.
2020-07-20 14:59:19 +09:00
David Rodríguez 5783d0dbfc Import remaining changes
The "sync with commits" scripts failed to properly import these for some
reason.
2020-07-15 16:05:12 +09:00
Utkarsh Gupta fd709382b6 [rubygems/rubygems] Tag the specs with :readline
The newly added specs needs to be tagged as
:readline, otherwise they fail on Windows with
the backtrace: `ZeroDivisionError: divided by 0`.

Such issues are already being skipped on Windows.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/391f860af4
2020-07-15 16:05:12 +09:00
Utkarsh Gupta c44c7019b5 [rubygems/rubygems] Add tests with different flag combinations
Since this PR was made because we missed checking
RuboCop offenses with different flags, therefore
adding tests so that all flag combinations are
tested.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/d08250efc2
2020-07-15 16:05:12 +09:00
David Rodríguez 4f9c673cab [rubygems/rubygems] Allow setting a tag prefix to be used by gem release tasks
https://github.com/rubygems/rubygems/commit/679008f23a
2020-07-15 16:05:12 +09:00
Utkarsh Gupta ca133c0366 [rubygems/rubygems] Fix line spacing to make Layout/EmptyLines happy
The Gemfile wasn't properly put in the last commit.
As a result, Layout/EmptyLines inspected an offense
in the Gemfile.

This also fixes the spec w.r.t change in the task
default.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/d1418fddd3
2020-07-15 16:05:12 +09:00
David Rodríguez 2fafc08aa3 [rubygems/rubygems] Remove unneeded trailing conditions on exitstatus
https://github.com/rubygems/rubygems/commit/27e0e4ecb6
2020-07-15 16:05:12 +09:00
David Rodríguez 547ba6608e [rubygems/rubygems] Easier way to find path to ruby binary
https://github.com/rubygems/rubygems/commit/cdc201f5c4
2020-07-15 16:05:12 +09:00
David Rodríguez 16823d4a05 [rubygems/rubygems] Remove unnecessary assertions on exitstatus
Since our helpers now raise by default if the subcommand fails, these
will never actually fail and are not necessary.

https://github.com/rubygems/rubygems/commit/6153b9321e
2020-07-15 16:05:12 +09:00
David Rodríguez 17b92d221f [rubygems/rubygems] No need to update remotes
Everything is already fetched locally.

https://github.com/rubygems/rubygems/commit/9c304639b1
2020-07-15 16:05:12 +09:00
David Rodríguez d189d31ce9 [rubygems/rubygems] Git clone already takes care of this
https://github.com/rubygems/rubygems/commit/6e0c28d3ab
2020-07-15 16:05:12 +09:00
David Rodríguez a73ea2126f [rubygems/rubygems] Clone rubygems from the local repo
It simplifies things and should avoid issues like the one we had where
the master branch had a bad `.gitattributes` file and changing it on a
PR would be disregarded.

In order for this to work, we need to make sure to fetch all tags from
the repository, so that they can properly be checked out later. This
does not apply to the case of testing against `RGV=..`, since no extra
cloning is needed there.

https://github.com/rubygems/rubygems/commit/d088d936b8
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 5ebca6d709 [rubygems/rubygems] Skip this spec on ruby_core workflow
ruby_core has an 'ast.rb' file that gets in the
middle and breaks this spec, so it's better we skip
this test on this workflow for now.

Also, slightly change the spec name from "run" to
"runs" and change the last assertion, it's cleaner
to check empty error.
Thanks to David Rodríguez for this!

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/ba8eaa70c3
2020-07-15 16:05:12 +09:00
Utkarsh Gupta d0810fdee4 [rubygems/rubygems] Use latest version of rubocop for RUBY_VERSION > 2.4
With older versions of rubocop, the dependency on
`jaro_winkler` seems to be a pain.
However, in the later versions of rubocop, this
dependency was dropped. So we only need to use
the older version for ruby2.3.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/9cd87eaee3
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 077dcacb08 [rubygems/rubygems] Use `--config .rubocop.yml` instead
because rubocop configuration inheritance is
messed up and when using `--ignore-parent-exclusion`,
even though the exit status is 0, the example
still fails because of the configuration issue.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/3e20b2738c
2020-07-15 16:05:12 +09:00
Utkarsh Gupta ecb87b55d8 [rubygems/rubygems] Lock rubocop version to 0.80.1
The later RuboCop versions don't work with ruby2.3
so we should lock the version to what works with
ruby2.3 as we haven't dropped the support yet.

And since we're using the older version of rubocop,
also fix `Max` value of `LineLength` to 120, which
is the current standard. Without this, rubocop
will throw the line length offenses.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/46d0a800a2
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 215f7c3165 [rubygems/rubygems] Fix linting and make Style/RedundantInterpolation happy
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/83e330fa87
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 4875a96edd [rubygems/rubygems] Fix test to run rubocop on the generated gem
With this, it will be ensured that the generated
(skeleton) gem will have no offenses.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/47411262e0
2020-07-15 16:05:12 +09:00
Utkarsh Gupta b28c6d04d0 [rubygems/rubygems] Make Style/HashSyntax cop happy
Previously, we were using the old syntax like:
`task :default => :spec`, but now this commit
uses the new Ruby 1.9 hash syntax.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/b41d0fdb56
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 449d24200b [rubygems/rubygems] WIP: add test to run rubocop on the generated gem
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/730b770f8a
2020-07-15 16:05:12 +09:00
Utkarsh Gupta 084489be87 [rubygems/rubygems] Fix tests pertaining to newgem
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/e2ee0b7de3
2020-07-15 16:05:12 +09:00
David Rodríguez 2b73f26fde [rubygems/rubygems] Show also output from all commands on rubygems checkout errors
https://github.com/rubygems/rubygems/commit/1fe24e471d
2020-07-15 16:05:12 +09:00
David Rodríguez 5ae80c5207 [rubygems/rubygems] Remove `--quiet` flag to `git checkout`
Since we don't show this output by default, it's better to be verbose
in case we happen to need more info.

https://github.com/rubygems/rubygems/commit/baa4ccf5a6
2020-07-15 16:05:12 +09:00
MSP-Greg 23cf99e99d [rubygems/rubygems] Bundler specs - Windows - remove skips, File.open => File.readlines
Using File.open without a block leaves a file reference that causes issues with file operations

commands/binstubs_spec.rb
install/gems/compact_index_spec.rb
install/gems/dependency_api_spec.rb
install/gems/standalone_spec.rb
runtime/executable_spec.rb

https://github.com/rubygems/rubygems/commit/4b9a6ca156
2020-07-15 16:05:12 +09:00
MSP-Greg ad743337b3 [rubygems/rubygems] bundler/spec/commands/binstubs_spec.rb - remove global Windows skip
Added one skip for:
bundle binstubs <gem>
when the gem exists in the lockfile
when generating bundle binstub outside bundler
should abort

https://github.com/rubygems/rubygems/commit/b77b484889
2020-07-15 16:05:12 +09:00
Koichi Sasada c25d249e63 RBasci::flags (VALUE) doesn't match int.
The type of RBasic::flags is VALUE, and INT2FIX(flags) does not
make sense. Use correct type to represent.
2020-07-15 13:36:38 +09:00
Nobuyoshi Nakada 99a9c3fe2e
Fixed yday and wday with timezone [Bug #17024] 2020-07-12 21:58:13 +09:00
Bart de Water 3621a7debf Avoid deprecated OpenSSL::Digest constants 2020-06-29 13:25:32 +09:00
Benoit Daloze 0faf6c8c0e Update to ruby/spec@6c466d4 2020-06-27 16:40:16 +02:00
Benoit Daloze b3fa158d1c Update to ruby/spec@b6b7752 2020-06-27 15:51:37 +02:00
Benoit Daloze 64d8c0815e Update to ruby/mspec@6cb1f10 2020-06-27 15:51:35 +02:00
Jeremy Evans 878af5147d Implement Proc#== and #eql?
Previously, these were not implemented, and Object#== and #eql?
were used.  This tries to check the proc internals to make sure
that procs created from separate blocks are treated as not equal,
but procs created from the same block are treated as equal, even
when the lazy proc allocation optimization is used.

Implements [Feature #14267]
2020-06-19 12:58:25 -07:00
Jeremy Evans aae8223c70 Dup splat array in certain cases where there is a block argument
This makes:

```ruby
  args = [1, 2, -> {}]; foo(*args, &args.pop)
```

call `foo` with 1, 2, and the lambda, in addition to passing the
lambda as a block.  This is different from the previous behavior,
which passed the lambda as a block but not as a regular argument,
which goes against the expected left-to-right evaluation order.

This is how Ruby already compiled arguments if using leading
arguments, trailing arguments, or keywords in the same call.

This works by disabling the optimization that skipped duplicating
the array during the splat (splatarray instruction argument
switches from false to true).  In the above example, the splat
call duplicates the array.  I've tested and cases where a
local variable or symbol are used do not duplicate the array,
so I don't expect this to decrease the performance of most Ruby
programs.  However, programs such as:

```ruby
  foo(*args, &bar)
```

could see a decrease in performance, if `bar` is a method call
and not a local variable.

This is not a perfect solution, there are ways to get around
this:

```ruby
  args = Struct.new(:a).new([:x, :y])
  def args.to_a; a; end
  def args.to_proc; a.pop; ->{}; end
  foo(*args, &args)
  # calls foo with 1 argument (:x)
  # not 2 arguments (:x and :y)
```

A perfect solution would require completely disabling the
optimization.

Fixes [Bug #16504]
Fixes [Bug #16500]
2020-06-18 08:19:33 -07:00
David Rodríguez 5f8ee14b9b [rubygems/rubygems] Make sure to pass URI's to `:git`
Passing paths should work in most cases, but on Windows the driver
letter is interpreted as the scheme and causes some case mismatches
because

```
irb> URI.parse("E:").to_s
=> "e:"
```

We fix this by passing file URI's instead.

https://github.com/rubygems/rubygems/commit/b6bc517628
2020-06-18 19:14:15 +09:00
David Rodríguez f217faf1da [rubygems/rubygems] Better skip messages
https://github.com/rubygems/rubygems/commit/4f519638ae
2020-06-18 19:14:15 +09:00
David Rodríguez 414b1485d6 [rubygems/rubygems] More portable PATH edition
https://github.com/rubygems/rubygems/commit/a6d50afad0
2020-06-18 19:14:15 +09:00
Utkarsh Gupta 22ee047f73 [rubygems/rubygems] Only add .rubocop.yml when --rubocop flag is passed
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/ef2dae4222
2020-06-18 19:14:15 +09:00
Utkarsh Gupta ec98d56153 Ship default .rubocop.yml
Currently, there is no `.rubocop.yml` shipped by default.
So when a user runs `rubocop` after creating a new gem via
`bundle gem foo`, it throws a bunch of offenses.

With the default `.rubocop.yml` present, the number of those
offenses significantly reduce by 25.

Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
2020-06-18 19:14:15 +09:00
Utkarsh Gupta d9c888d394 [rubygems/rubygems] Only add .rubocop.yml when --rubocop flag is passed
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>

https://github.com/rubygems/rubygems/commit/ef2dae4222
2020-06-18 19:14:15 +09:00
David Rodríguez 30f9fbdce8 Undeprecate the `--no-cache` flag
This is not a remembered option, so it shouldn't have been deprecated.
At least not for that reason.
2020-06-18 19:14:15 +09:00
David Rodríguez 9cc7847849 s/sys_exec!/sys_exec 2020-06-18 19:14:15 +09:00
David Rodríguez 77df7ccc10 [rubygems/rubygems] Remove now unused "bang helpers"
https://github.com/rubygems/rubygems/commit/84e4c58e83
2020-06-18 19:14:15 +09:00
David Rodríguez ea4824ee0f [rubygems/rubygems] s/run!/run
https://github.com/rubygems/rubygems/commit/e3f60d8aec
2020-06-18 19:14:15 +09:00
David Rodríguez 596588c697 [rubygems/rubygems] s/ruby!/ruby
https://github.com/rubygems/rubygems/commit/a73fa0760e
2020-06-18 19:14:15 +09:00
David Rodríguez a572e78201 [rubygems/rubygems] s/gem_command!/gem_command
https://github.com/rubygems/rubygems/commit/f52733f6a4
2020-06-18 19:14:15 +09:00
David Rodríguez 696a50751b [rubygems/rubygems] s/install_gemfile!/install_gemfile
https://github.com/rubygems/rubygems/commit/4d1a0c465a
2020-06-18 19:14:15 +09:00
David Rodríguez 1436b5026c [rubygems/rubygems] s/bundle!/bundle
https://github.com/rubygems/rubygems/commit/746a4b3d74
2020-06-18 19:14:15 +09:00
Frank Lam a1a5973daa [rubygems/rubygems] Prefer using bundle! to avoid unnecessary swallowing of errors
https://github.com/rubygems/rubygems/commit/6bac832a58
2020-06-18 19:14:15 +09:00
Frank Lam f6c8ca0359 [rubygems/rubygems] Move already configured --test hint to before test file creation
https://github.com/rubygems/rubygems/commit/9e5f7a9099
2020-06-18 19:14:15 +09:00
Frank Lam 0ba2f3e8a9 [rubygems/rubygems] Move already configured --ci hint to before CI file creation
https://github.com/rubygems/rubygems/commit/2af2abe5fd
2020-06-18 19:14:15 +09:00
Frank Lam 091daaa715 [rubygems/rubygems] Lower verboseness of user-facing text for bundle gem
https://github.com/rubygems/rubygems/commit/288f073c3c
2020-06-18 19:14:15 +09:00
Frank Lam 8e3136a03b [rubygems/rubygems] Make test framework/CI configuration for bundle gem consistent
* Add hints for --ci option

https://github.com/rubygems/rubygems/commit/5f779f45b0
2020-06-18 19:14:15 +09:00
Frank Lam 27e07cd34f [rubygems/rubygems] Set CI global config to false in gem_helper_spec
https://github.com/rubygems/rubygems/commit/39b18fe7fc
2020-06-18 19:14:15 +09:00
Frank Lam 760edb3743 [rubygems/rubygems] Fix CI spec typo
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
https://github.com/rubygems/rubygems/commit/24f3739585
2020-06-18 19:14:15 +09:00
Frank Lam 52a900773e [rubygems/rubygems] Incorporate naming/grammar suggestions from olleolleolle
https://github.com/rubygems/rubygems/commit/80571452ca
2020-06-18 19:14:15 +09:00
Frank Lam e6479ac3f6 [rubygems/rubygems] Move CI specs below test framework specs
https://github.com/rubygems/rubygems/commit/d8e416d89b
2020-06-18 19:14:15 +09:00
Frank Lam 0d3c185b59 [rubygems/rubygems] Remove shared examples for present test framework
* `bundle gem` has new option to select CI provider

https://github.com/rubygems/rubygems/commit/320f3546c1
2020-06-18 19:14:15 +09:00
Frank Lam 25ac5b3606 [rubygems/rubygems] Separate CI and test framework shared examples
* `bundle gem` has new option to choose CI provider other than Travis CI

https://github.com/rubygems/rubygems/commit/afaecf16de
2020-06-18 19:14:15 +09:00
Frank Lam b46895aa93 [rubygems/rubygems] Extract shared example for absence of CI files
https://github.com/rubygems/rubygems/commit/22cb599bcc
2020-06-18 19:14:15 +09:00
Hiroshi SHIBATA cc059b16b2 Manually cherry-picked at 80260b3496 2020-06-18 19:14:15 +09:00
David Rodríguez 9be1baedbc [rubygems/rubygems] Remove unnecessary `bundle install`
These specs doesn't really need an installed bundle, they only need a
`Gemfile`.

https://github.com/rubygems/rubygems/commit/06c85683ae
2020-06-18 19:14:15 +09:00
David Rodríguez 61b6f53337 [rubygems/rubygems] Make helpers raise by default
https://github.com/rubygems/rubygems/commit/ade0c441d5
2020-06-18 19:14:15 +09:00
David Rodríguez 529a9e8a1f [rubygems/rubygems] Fix a couple of specs that were loading an incorrect bundler
We have a check on an `at_exit` hook that checks that system bundler is
never loaded instead of our development copy. The check was failing in
these cases, but in a silent way because the errors were being swallowed.

This commit changes these specs to make sure they load the right
bundler.

https://github.com/rubygems/rubygems/commit/cd1c1bc297
2020-06-18 19:14:15 +09:00
David Rodríguez 5d78fb1c9a [rubygems/rubygems] Change spec to do the right thing on bundler 3
On bundler 3, the `--deployment` flag doesn't exist, so the `bundle
install --deployment` command was failing silently and the spec was
verifying a different scenario.

Change the spec to work the same regardless of bundler's major version.

Also, from the spec description it was not apparently that a specific
case involving deployment mode was being tested, so I reworded it to
make it more apparent.

https://github.com/rubygems/rubygems/commit/3e33e2b927
2020-06-18 19:14:15 +09:00
David Rodríguez 974c40c842 [rubygems/rubygems] Fix some sudo specs to do the right thing on bundler 3
On bundler 3, where the default install path is `.bundle`, these specs
were trying to change permissions of the
`.bundle/ruby/<ruby_abi_version>` folder, which didn't exist yet,so the
permission changing command was failing and the spec was not testing the
right thing.

Change the specs so that the permissions are correctly changed, by first
configuring the local path to be `.bundle` (which creates the `.bundle`
folder), and then changing permissions of the `.bundle` folder
explicitly, which exists already.

https://github.com/rubygems/rubygems/commit/2833162fb0
2020-06-18 19:14:15 +09:00
David Rodríguez 5454415750 [rubygems/rubygems] Fix spec to test the right thing on bundler 3
Bundler 3 installs by default to `.bundle`. That means that, because the
`bar` gem was not previously available at this location but as a system
gem, the initial `bundle install` was silently failing. As a
consequence, the spec was not testing the exact scenario it meant to
test.

https://github.com/rubygems/rubygems/commit/202399521c
2020-06-18 19:14:15 +09:00
David Rodríguez 9939f4ad43 [rubygems/rubygems] Remove bad `bundle install`
This spec is specifically testing for the case where there's no
`Gemfile.lock` file and it's only doing the expected thing because the
`bundle install` command is silently failing. Remove the `bundle
install` to reduce confusion.

https://github.com/rubygems/rubygems/commit/ec39fbde0e
2020-06-18 19:14:15 +09:00
David Rodríguez 8d7ed194cb [rubygems/rubygems] Simplify `bundle update --ruby` specs
They don't need to run that many commands, and the new version is also
more readable in my opinion.

https://github.com/rubygems/rubygems/commit/efff3e3210
2020-06-18 19:14:15 +09:00
David Rodríguez 66b327af56 [rubygems/rubygems] Fix redundant commands
They are preceded by `install_gemfile` calls, which mean `bundle
install` is being run twice for no reason.

https://github.com/rubygems/rubygems/commit/d2b2d10862
2020-06-18 19:14:15 +09:00
David Rodríguez cceb77f57b [rubygems/rubygems] Fix unintended Gemfile installation
This command is failing because of the same reason that the subsequent
`bundle exec` is failing: the gemspec is invalid. The `bundle install`
here deviates the `bundle exec` focus from the test and is unnecessary:
all we need is a `Gemfile` that will trigger the `bundle exec`, so let's
create and avoid the extra command.

https://github.com/rubygems/rubygems/commit/eb83cf6cf1
2020-06-18 19:14:15 +09:00
David Rodríguez 6aafea2d99 [rubygems/rubygems] Remove failing command that doesn't affect the spec
This command was silently failing but doesn't really affect the outcome
of the spec.

https://github.com/rubygems/rubygems/commit/7880d08146
2020-06-18 19:14:15 +09:00
David Rodríguez a8f9a97d49 [rubygems/rubygems] Remove broken test
It turns out that this test is checking essentially nothing useful. The
paperclip gem doesn't exist in our setup, so initial install is failing
and the test is only checking that calling `bundle check` 3 times on a
broken setup always returns the same thing.

I went to the history of this test:

* 105654a31e
* ae53be1f87
* d19f4a7b32
* 092f169d01
* 36878435b5

And have finally decided to remove it since I'm not sure changing it to
something else will lead to testing something useful and not already
tested.

https://github.com/rubygems/rubygems/commit/6184322967
2020-06-18 19:14:15 +09:00
David Rodríguez acd82bd923 [rubygems/rubygems] Fix silently broken spec
This spec was broken. The second `bundle install` was silently failing.
This means that the spec was actually checking an scenario completely
different from the one that was supposed to be tested. And also a very
dummy one: that running `bundle cache` twice doesn't cache a completely
unrelated gem.

https://github.com/rubygems/rubygems/commit/f11a5d2df9
2020-06-18 19:14:15 +09:00
David Rodríguez b0f07aff0b [rubygems/rubygems] Remove incorrect tags
The inner specs have separated specs for the `< 3` and `= 2` cases, so
this outer tag is incorrect.

https://github.com/rubygems/rubygems/commit/61e905ca27
2020-06-18 19:14:15 +09:00
David Rodríguez 8c686475c8 [rubygems/rubygems] Migrate some specs to use "the new way"
The commands these specs run were throwing warnings in bundler 2, and
failing on bundler 3, effectively testing a different scenario to what
they were supposed to.

https://github.com/rubygems/rubygems/commit/97ac1ced49
2020-06-18 19:14:15 +09:00
David Rodríguez 94fc709dd1 [rubygems/rubygems] s/rails_fail/rails_pinned_to_old_activesupport/
The `rails_fail` name is misleading because there's no specific reason
why such a gem would need to fail. As a matter of fact, `bundle
install`'ing a Genfile with only that dependency like the spec the
previous commit adds is not expected to fail.

https://github.com/rubygems/rubygems/commit/b947f40701
2020-06-18 19:14:15 +09:00
David Rodríguez f8f3f11ed5 [rubygems/rubygems] Fix `only_update_to_newer_versions` regression
The `only_update_to_newer_versions` feature flag will enable some new
behaviour in bundler 3 (or maybe earlier if we decide to consider it a
bug fix) that prevents `bundle update` from unexpectedly downgrading
direct dependencies.

This seems reasonable, but the current implementation is adding
additional requirements for all locked dependencies, not only from the
ones in the `Gemfile`. That causes some situations where the `Gemfile`
is edited and will resolve to older versions to start failing.

This commit fixes the problem by making sure extra requirements are
added exclusively for direct dependencies in the `Gemfile`, not for all
direct dependencies in the lock file.

https://github.com/rubygems/rubygems/commit/128b4596e1
2020-06-18 19:14:15 +09:00
David Rodríguez 094fb6ae0d Accommodate process title spec to ruby-core setup
I'm guessing the commands under ruby-core setup are very long, so the
title gets truncated. Use a shorter title, since the test doesn't really
care.
2020-06-15 12:38:39 +09:00
David Rodríguez 117b504b98 Fix most exec specs
The `gem_command` helper was failing to require `support/hax.rb`, which
takes care of making sure rubygems actually picks up the right `ruby`
executable under ruby-core setup (`ENV["RUBY"]`). This caused binstubs
to be generated with a wrong shebang, and that caused `bundle exec` to
not work. The error message was pretty confusing though due to
https://bugs.ruby-lang.org/issues/16952.
2020-06-15 12:38:39 +09:00
Nobuyoshi Nakada 1efc3d6d65
Suppress warnings [Feature #15973] 2020-06-13 22:57:31 +09:00
Nobuyoshi Nakada a6713a5758
Refined ioctl error description 2020-06-11 14:31:39 +09:00
Jeremy Evans f3e927b0cc Make proc/Proc.new without block an error instead of warning
The warning for these was added in 2.7.
2020-06-10 17:49:54 -07:00
Nobuyoshi Nakada 04fddf3573 ENV.delete should return the result of block on non-existing key
Fixes [Bug #16173]

Co-Authored-By: Burdette Lamar <burdettelamar@yahoo.com>
Co-Authored-By: Jeremy Evans <code@jeremyevans.net>
2020-06-10 12:49:27 -07:00
Yuki Nishijima 7cfd6a0bb9 Fix build failures 2020-06-06 13:02:08 -04:00
Hiroshi SHIBATA 459eb684b7 Manually pick from rubygems/rubygems changes at
ca5bf58402
2020-06-05 07:32:42 +09:00
David Rodríguez 4d233d18a2 Re-record all cassettes
I had to pin `redis-namespace` in our spec to 1.6.0 because on ruby
2.3.0 the spec no longer resolved to that version, so the cached `.gem`
file was missing there.
2020-06-05 07:32:42 +09:00
David Rodríguez 0fb2a7fa1c Fix `bin/rake spec:realworld:record`
Previously it was failing and not recording. Also, the
`BUNDLER_SPEC_FORCE_RECORD` environment variable was forcing every
request to be recorded, including duplicated requests to the same
endpoint. That meant the recorded `versions` file would be incorrect
because it would contain the result of the last request, which would be
`304 NOT MODIFIED`.

So, to rerecord, delete cassettes and let them be recorded when needed.
2020-06-05 07:32:42 +09:00
Carsten Wirth 0ae5cd55e5 [rubygems/rubygems] Remove multiline gem specifications correctly
https://github.com/rubygems/rubygems/commit/8dca0ad56e
2020-06-05 07:32:42 +09:00
DEVRAJ KUMAR 9139acca66 [rubygems/rubygems] Fix `bundle info` not indicating a gem which has been deleted, unlike `bundle show`
Co-Authored-By: David Rodríguez <deivid.rodriguez@riseup.net>

https://github.com/rubygems/rubygems/commit/2851b40ffb
2020-06-05 07:32:42 +09:00
Frank Lam 0d240de2f3 [rubygems/rubygems] Tag test framework hint specs and use out helper
https://github.com/rubygems/rubygems/commit/1db61b5b5e
2020-06-05 07:32:42 +09:00
Frank Lam 154c2717da [rubygems/rubygems] Add user hint specs for bundle gem --test
https://github.com/rubygems/rubygems/commit/1d2292a88f
2020-06-05 07:32:42 +09:00
Frank Lam f75bd9bb8b [rubygems/rubygems] Fix bundle gem ignoring global gem.test config
* bundle gem previously ignored gem.test when passed empty -t flag,
defaulting to RSpec
* bundle gem will now ask user for test framework when passed empty -t
flag and gem.test is set to false, but will not overwrite gem.test
* thor option parsing for String types falls back to human name for nil,
so setting lazy_default to nil won't work
* c5161501e0/lib/thor/parser/options.rb (L224)

Default to Bundler.settings["gem.test"] for empty --test

Add shared examples for test framework to newgem spec

Add examples for empty --test flag to newgem spec

Simplify conditional for prompting test framework

Follow naming conventions for bundler settings

Add more descriptive test framework help text for bundle gem

Update man pages for bundler

https://github.com/rubygems/rubygems/commit/ab0785a09f
2020-06-05 07:32:42 +09:00
David Rodríguez e413e746af [rubygems/rubygems] Remove `forgotten_command_line_usages` from specs
Instead, use the non-deprecated option except when specifically testing
deprecated CLI flags. In that case, pass the flag directly and limit
the specs to `bundler < 3`.

https://github.com/rubygems/rubygems/commit/3d5e186241
2020-06-05 07:32:42 +09:00
David Rodríguez 61b61f426a [rubygems/rubygems] Reword specs to not mention deprecated flags
https://github.com/rubygems/rubygems/commit/f878a81f22
2020-06-05 07:32:42 +09:00
David Rodríguez f02f19d62f [rubygems/rubygems] Rewrite dependency API specs to use new deployment mode
Some of them were passing "by chance" because they used a `bundle
install` command that failed, but the assertion was using the result of
the previous. Others were skipped on bundler 3. Now they all pass in all
versions.

https://github.com/rubygems/rubygems/commit/cedf611e11
2020-06-05 07:32:42 +09:00
David Rodríguez 5c924f597f [rubygems/rubygems] Make `forgotten_command_line_options` always "forget" options
https://github.com/rubygems/rubygems/commit/4d39338670
2020-06-05 07:32:42 +09:00
David Rodríguez 99dc55987d [rubygems/rubygems] Improve specs testing option remembering behavior
By making them more explicit.

https://github.com/rubygems/rubygems/commit/9979c5a811
2020-06-05 07:32:42 +09:00
David Rodríguez 332ecb0ad1 [rubygems/rubygems] Fix `bundle install` unintentionally saving configuration
Even if no explicit flags were passed to it.

https://github.com/rubygems/rubygems/commit/0598cbb68c
2020-06-05 07:32:42 +09:00
David Rodríguez 052d66050a [rubygems/rubygems] Change descriptions to not mention deprecated flags
https://github.com/rubygems/rubygems/commit/731b3783f1
2020-06-05 07:32:42 +09:00
David Rodríguez fed9419e55 [rubygems/rubygems] Fix flag name in spec descriptions
https://github.com/rubygems/rubygems/commit/6395392b83
2020-06-05 07:32:42 +09:00
David Rodríguez 5989827dc7 [rubygems/rubygems] Improve wording of some specs
https://github.com/rubygems/rubygems/commit/3372b21553
2020-06-05 07:32:42 +09:00
David Rodríguez ff74725dc3 [rubygems/rubygems] Remove old no longer meaningful spec
This spec was originally written many years ago to verity gems were
properly "remembered" in the lock file. At this point, the test feels a
bit dummy since the first `bundle install` already runs on a "clean
machine".

https://github.com/rubygems/rubygems/commit/dbfefb3f5a
2020-06-05 07:32:42 +09:00
David Rodríguez 09602f4301 [rubygems/rubygems] Revert multi ruby{,gems} version requirement fix
This reverts commit 20f06d9e178211a3016133852b72d21ac7bb93ad, reversing
changes made to f2b30cb70df8a518bef0e8a64bbceb86234d922d.

https://github.com/rubygems/rubygems/commit/40802bdb18
2020-06-05 07:32:42 +09:00
David Rodríguez 592762069d [rubygems/rubygems] Support running specs against a tarball
When bundler specs are run from a ruby tarball (ruby-core does this),
there's no git folder, so `git ls-files` fails.

Support this case by making specs rely on the list of files from the
bundler gemspec instead, and invert the spec that makes sure we ship the
right set of files.

As per the other quality specs, skip them in this case.

https://github.com/rubygems/rubygems/commit/b28d5ec931
2020-06-05 07:32:42 +09:00