Previously, each of these methods returned self, but it is
more useful to return arguments, to allow for simpler method
decorators, such as:
```ruby
cached private def foo; some_long_calculation; end
```
Where cached sets up caching for the method.
For each of these methods, the following behavior is used:
1) No arguments returns nil
2) Single argument is returned
3) Multiple arguments are returned as an array
The single argument case is really the case we are trying to
optimize for, for the same reason that def was changed to return
a symbol for the method.
Idea and initial patch from Herwin Quarantainenet.
Implements [Feature #12495]
Calling `Bundler.definition.specs` will memoize materialized specs.
However, requiring `bundler/setup` will end up materializing the same
set of specs, but not memoize them.
This change makes things consistent.
https://github.com/rubygems/rubygems/commit/e4c2b52824
We have a quality spec that check for debugger statements. Rubocop has a
cop that tests for the same thing. As such it makes sense to remove the
spec and activate the cop.
https://github.com/rubygems/rubygems/commit/dc1eb6eec5
Even if it's newer than the running versions. Dev versions are not
released to rubygems.org, so the warning message suggests a command that
doesn't work. And dev versions are currently non deterministic
(2.3.0.dev can be many different versions), so the warning doesn't
really make sense at the moment.
https://github.com/rubygems/rubygems/commit/6f31af27ef
We can skip most stuff in `Gem::RemoteFetcher#download`, and use
`Gem::RemoteFetcher#update_cache_path` directly.
This has the benefit of allowing us to remove some workarounds to
support several rubygems versions, but also allows us to pass the target
folder where the gem should be downloaded directly and skip the logic
inside `Gem::RemoteFetcher#download` to infer the cache path. This will
be useful later to fix some issues with the `global_gem_cache` feature
flag.
https://github.com/rubygems/rubygems/commit/8fe74a77e4
Previously they were printing the original command that was run, and
telling the user to rerun it. However, the command sometimes would not
match the exact command that was run (for example, when using the
`--local` flag), and in any case, it's simpler and more useful to print
the underlying error anyways.
https://github.com/rubygems/rubygems/commit/5bc0d51b58
In case we have a corrupted lockfile that claims to support a platform, but
it's missing platform specific gems for it, bundler has a check that
detects the situation and forces a re-resolve. The result of this check
is kept under the `@locked_specs_incomplete_for_platformn` instance
variable in `Definition`.
The installer, however, calls `Definition#nothing_changed?` before this
instance variable has been filled, so the result of it is actually
incorrect here since it will claim that nothing has changed, but
something has changed (locked specs are incomplete for the current
platform).
The consequence of this incorrect result is that the installer thinks it
can go on without re-resolving, resulting in the incomplete resolution
from the lockfile being used, and in a crash being triggered due to
that.
The solution is to make sure the `@locked_specs_incomplete_for_platform`
instance variable is filled before `nothing_changed?` gets called.
Moving it to `initialize` makes the most sense, not because it's the
best place for it (we can refactor this later), but because all of the
other "outdated definition" checks are already set there.
https://github.com/rubygems/rubygems/commit/708afdd789
The other way, in particular matching a substring in the gemspec
summary, is brittle and no longer used since Ruby 2.0.
This needed rewriting the specs that depended on that way.
https://github.com/rubygems/rubygems/commit/059dbfa971
The spec was just faking an installed gemspec without any installed gem
backing it up, resulting in `bundle install` claiming that the gem was
already installed when it was not.
https://github.com/rubygems/rubygems/commit/c35531d1c7
In 2021, Ruby 2.5 and older are EOL.
We can set the default required Ruby version to 2.6.0 to
encourage people to use newer Ruby.
If the command is executed with old Ruby, it falls back to 2.3.0.
It's still possible to create a gem for older Ruby just by changing
two lines of code (one in gemspec and another is in rubocop.yml).
We want to update the original repo, not a fresh one.
This went undetected because the `git commit` command inside the
`update_git` method ignores failures, and in this case it was failing
because all files are untracked in the new repo.
I will fix that later but for now fix the typo.
https://github.com/rubygems/rubygems/commit/c889f1d715
The glob information was not specified in the string representation for
a source, which led to non-deterministic behaviour when generating the
lockfile, since sources are sorted by this value.
https://github.com/rubygems/rubygems/commit/493b880abc
Previously, if an autoload failed (the file was loaded, but the
constant was not defined by the autoloaded file). Ruby will try
to autoload again if you delete the autoloaded file from
$LOADED_FEATURES. With this change, the autoload and the
constant itself are removed as soon as it fails.
To handle cases where multiple threads are autoloading, when
deleting an autoload, handle the case where another thread
already deleted it.
Fixes [Bug #15790]
The error had not be caught be specs because `bundle install` was
returning a zero exit code when plugin installation errors happened. So
I fixed that issue too.
https://github.com/rubygems/rubygems/commit/90cde87856
As part of a recent bug fix where bundler was accidentally hitting the
network when not supposed to, I made some refactoring, and the commit I'm
reverting here
(d74830d00b)
was some cleanup that those refactorings allowed according to "past me".
That was completely wrong, `bundle check` should never consider cached
gems, only installed gems, so the code that was removed was necessary.
https://github.com/rubygems/rubygems/commit/5483e98305
Use the `git branch --list` rather than the `git branch -l` for better
compatibility. Because the `git branch -l` is used to create a new branch in
Git version < 2.20.0.
https://github.com/rubygems/rubygems/commit/eac5be7d06
When setting the `RUBYGEMS_GEMDEPS` environment variable to allow
skipping `bundle exec`, `bundler` will print a warning about potential
incompatibility.
Initially the `RUBYGEMS_GEMDEPS` variable used a completely different
(re)implementation of `bundler` functionality. That implementation was
not battle tested and could potentially differ in behaviour from what
`bundler` does. That's why print a warning.
However, these days, all `rubygems` does when `RUBYGEMS_GEMDEPS` is set
is to require `bundler/setup`, so there's no risk of any
incompatibility, since that's just plain `bundler`.
https://github.com/rubygems/rubygems/commit/bbddc27016
When printing sources inside these error messages, it's useful to only
consider the current state of the source. For example, when requiring
`bundler/setup`, the source shouldn't be configured to be able to hit
the network, so the error message should only mention "locally installed
gems" to make that more clear.
https://github.com/rubygems/rubygems/commit/30eb14f853
In the case of path sources, the path the source is pointing to should
be added directly to the `$LOAD_PATH` without any modifications.
https://github.com/rubygems/rubygems/commit/d3bba936f0
Co-authored-by: Daniel Niknam <mhmd.niknam@gmail.com>
TSort was released as a library so we can install it, and also other
gems that are loaded by the spec. Also, Ruby on Windows apparently loads
fiddle 1.0.6, so we need to also install that to make that not fail.
https://github.com/rubygems/rubygems/commit/2b8dcab99e
Call `IOSpecs.io_fixture` with the default encoding explicitly.
`IOSpecs.closed_io` calls the method without optional `mode` which
is set to UTF-8 by default, while the default external encoding
depends on the locale environment variables.
Mashalling a closed IO object raised "closed stream (IOError)" before instead of TypeError.
This changes IO#(in|ex)ternal_encoding to still return the encoding even if the underlying FD is closed.
Fixes bug #18077
This updates the trace instructions to directly dispatch to
opt_send_without_block. So this should cause no slowdown in
non-trace mode.
To enable the tracing of the optimized methods, RUBY_EVENT_C_CALL
and RUBY_EVENT_C_RETURN are added as events to the specialized
instructions.
Fixes [Bug #14870]
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* Hide read function warning in string_spec_RSTRING_PTR_read function
* The type of `read` may be `ssize_t`
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This changes Thread::Location::Backtrace#absolute_path to return
nil for methods/procs defined in eval. If the realpath of an iseq
is nil, that indicates it was defined in eval, in which case you
cannot use RubyVM::AbstractSyntaxTree.of.
Fixes [Bug #16983]
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Bundler has deprecated gemfiles without a global source and this feature
is now obsolete. `Bundler::Definition#has_rubygems_remotes?` is removed
because it's not used anymore.
https://github.com/rubygems/rubygems/commit/d29dd2cb7b
`check_rubygems_source_safety` is responsible for:
1. if there are multiple global sources
- for bundle 3.x raise an error
- for bundle 2.x print a warning
2. print a warning if there is no explicit global source
The second responsibility was added recently and now the logic could be
extracted to improve readability. Conditions are still live in the `check_rubygems_source_safety` method
since we don't want to call both functions always and that would help us achieve that.
https://github.com/rubygems/rubygems/commit/f3d7e946ee
Raise a warning when parsing a Gemfile and it doesn't have a global source. Gemfiles like this, specially now that rubygems sources are are no longer merged into a single source for security, are very confusing because they generate a different lockfile depending on the gems you have locally installed. This is because bundler always use an implicit global source that defaults to locally installed gems.
https://github.com/rubygems/rubygems/commit/b7523ad21c
This method is created to tell whether any global source exist in the object or not and it will be used by `Bundler:Dsl` to print a warning if no global source has been defined in the Gemfile.
https://github.com/rubygems/rubygems/commit/422fec4438
This method is created to tell whether any remote exist in the object or not and it will be used by `Bundler:SourceList` to tell if a global source has been defined implicitly or not.
https://github.com/rubygems/rubygems/commit/47e3ff0e47
The is the previous intentional behaviour until
ca0676cb1c.
In my opinion, that previous behaviour was better and should be
restored, because we want our users to always see warnings and fix them.
And the original issue that motivated the change is fixable by other
means, namely through `BUNDLE_SILENCE_ROOT_WARNING`, or through
`BUNDLE_SILENCE_DEPRECATIONS` in general. Finally, the --quiet option is
still documented as "only print errors and warnings".
So this PR essentially reverts
ca0676cb1c
for the above reasons.
https://github.com/rubygems/rubygems/commit/35f2254dfc
We'll be removing the warning about no gem sources, so this spec will no
longer test that warnings are hidden by `--quiet`.
Test that in another way so that we don't lose the coverage when we
drop the specific warning about no gem server sources.
https://github.com/rubygems/rubygems/commit/cce4f86d28
A fresh `gem install` might not reproduce the exact `bundle install`
environment that originally caused the error. It also makes it harder
for the user to troubleshoot the error since she needs to run a separate
command.
Instead, show the original error and backtrace directly.
https://github.com/rubygems/rubygems/commit/49c2abfec6
To mimic built-in rubygems behaviour, only thing that should be
approximated is the lockfile version. Other alternatives like
`BUNDLER_VERSION` should be respected exactly.
https://github.com/rubygems/rubygems/commit/dbd667d4bc
Ruby 1.9.2 removed "." from LOAD_PATH for robustness and security reasons.
This code was introduced by 56fc830e19 commit
to helping users understand the issue and had a guard condition to include the message for `RUBY_VERSION >= "1.9"`.
However, the guard condition was removed as part of the "Ruby version leftover" cleanup by
8c9cf76e41
Ruby 1.9 development was ended a long time ago and this message is not useful anymore.
https://github.com/rubygems/rubygems/commit/a23609b15a
The existing interrupt handling using `SharedHelpers.trap` fails when the previous
handler for a signal is not callable (for example, when it is the string "DEFAULT").
Instead, we now handle interrupts by aborting the process when worker threads are
running, and restore the previous handler after worker threads are finished.
Fixes#4764.
https://github.com/rubygems/rubygems/commit/b9f455d487
```
1)
The -W command line option with :no-experimental suppresses experimental warnings FAILED
Expected "" =~ /is experimental/
to be truthy but was nil
```
it turns out that running `bundle plugin uninstall some-plugin` would remove that plugin from the list of hooks, but if the list of hooks for an event was now empty, we would serialize the empty array into yaml as an empty single bullet item. which would then get unserialized as a plugin with the name empty string. which we would then try to load and explode. 😬https://github.com/rubygems/rubygems/commit/545ebba9a5
When a development dependency was duplicated inside the gemspec and
Gemfile with the same requirements, we went from printing a warning to
removing the gem altogether.
This change makes it not print a warning, but don't remove the gem
either.
https://github.com/rubygems/rubygems/commit/8bb2488131
- Limit Unicode version 12.1.0 to Ruby versions 2.6.3 - 3.0
- Check that Ruby version 3.1 has Unicode version 13.0.0
- Limit Unicode Emoji version 12.1 to Ruby versions 2.7 - 3.0
- Check that Ruby version 3.1 has Unicode Emoji version 13.0
Depending on the float range, there could be an off-by-one error,
where the last result that should be in the range was missed. Fix
this by checking if the computed value for the expected value
outside the range is still inside the range, and if so, increment
the step size.
Fixes [Bug #16612]
Ruby uses a recursive algorithm for handling control/meta escapes
in strings (read_escape). However, the equivalent code for regexps
(tokadd_escape) in did not use a recursive algorithm. Due to this,
Handling of control/meta escapes in regexp did not have the same
behavior as in strings, leading to behavior such as the following
returning nil:
```ruby
/\c\xFF/ =~ "\c\xFF"
```
Switch the code for handling \c, \C and \M in literal regexps to
use the same code as for strings (read_escape), to keep behavior
consistent between the two.
Fixes [Bug #14367]
* Run nmake check on Actions
* Skip tests not working in mswin GitHub Actions
* Override TEMP
* Revert "Skip tests not working in mswin GitHub Actions"
This reverts commit 544d2575fcdf23ae63cd25aa03fce10c28b259f2.
* Revert "Revert "Skip tests not working in mswin GitHub Actions""
This reverts commit e1f8ad7862c9c4be52dc6e1031a004621eb07e6e.
* Fix timeouts
* Skip some more broken tests
* Update windows.yml
* Add a guard for rbasic_spec
* Revert "Update windows.yml"
This reverts commit bc9694b6b3b9594d406378d15ca11723fb052bc8.
* Skip the ensure clause
* Simplify the ensure
* Add test cases for Enumerable#tally with hash argument
* Add ruby/spec for Enumerable#tally with hash argument
* Fix Enumerable#tally does not update given frozen hash
* Add test cases for Enumerable#tally with hash convertible arguments
* Fix SEGV when Enumerable#tally takes non Hash convertible
* FIx cosmetic damage enum.c
* https://github.com/ruby/ruby/runs/1994688198
ruby 3.1.0dev (2021-02-27T16:42:17Z master 8305a48413) [x64-mingw32]
C-API Thread function rb_thread_call_without_gvl runs a C function with the global lock unlocked and unlocks IO with the generic RUBY_UBF_IO
Example took longer than the configured timeout of 60.0s
The documentation already specifies that they strip whitespace
and defines whitespace to include null.
This wraps the new behavior in the appropriate guards in the specs,
but does not specify behavior for previous versions, because this
is a bug that could be backported.
Fixes [Bug #17467]
http://ci.rvm.jp/logfiles/brlog.trunk-test.20210216-182358
```
1)
$LOAD_PATH.resolve_feature_path raises LoadError if feature cannot be found FAILED
Expected LoadError but no exception was raised (nil was returned)
/tmp/ruby/v3/src/trunk-test/spec/ruby/language/predefined_spec.rb:1275:in `block (3 levels) in <top (required)>'
/tmp/ruby/v3/src/trunk-test/spec/ruby/language/predefined_spec.rb:1259:in `block in <top (required)>'
/tmp/ruby/v3/src/trunk-test/spec/ruby/language/predefined_spec.rb:1258:in `<top (required)>'
```
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"
```
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.
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]
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]
* 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
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.