Replaces https://github.com/pry/pry/pull/1692
(Remove the "default" method from `Pry::Helpers::Text`)
This alias serves no real purpose because `bold` is already superior: it's short
and understandable.
Since `~/.pryrc` was replaced by `$XDG_CONFIG_HOME` and `~/.config/pry/pryrc` in
https://github.com/pry/pry/pull/1609, we need to adjust some
documentation. `~/.pryrc` becomes simply `pryrc`.
I've also edited the wiki with this similar change.
Find configuration file in XDG Base Directory only if `PRYRC` is not
set, and `~/.pryrc` does not exist, therefore not confusing current
users. Note that cache file path is not modified.
Fixes#1789.
Readline is unable to add lines to its history that contain a null byte;
we should therefore avoid saving such lines to the history file, and
ignore any such lines that are already present in the file.
Fixes#1775 (Drop support for Rubinius)
I am amazed how many hacks we've had just to support Rubinius. It feels good to
be able to remove them and reduce the complexity of the codebase.
Commit a99861f1b1 broke some tests for me when I
try to run them locally. Example failures:
```
Failures:
1) gist nominally logs in
Failure/Error: expect(Pad.gist_calls[:login!]).not_to be_nil
expected: not nil
got: nil
2) show-doc on modules show-doc -a messages relating to -a indicates...
Failure/Error:
raise CommandError, "No docs found for: #{
obj_name ? obj_name : 'current context'
Pry::CommandError:
No docs found for: TestClassForShowSource
```
There's little reason to use our own task for specs since RSpec already provides
one. Switching to that deletes some old (likely unused) code and fixes the
failures for me. Win-win.
Rubocop is a really nice tool when configured properly. A lot of default rules
are very opinionated but the good thing is that it's very easy to disable them.
With help of Rubocop I'd like to improve the quality of Pry's code.
When copy pasting into pry a code like this
~~~ ruby
foo do
bar #note the tab here
done
~~~
then `@indent.indent(val)` replace the tab by two spaces, and so
`overhang = original_val.length - indented_val.length` is negative,
which yields an Exception in `whitespace = ' ' * overhang`.
Guard against this by taking the max with 0.
* PluginManager#load_cli_options: use the realpath
Since ruby 2.5, `require 'foo'` will use the realpath of the file
corresponding to foo.rb. However `require '/absolute/path/to/foo.rb'`
won't use the realpath.
So when $GEM_HOME contains a symlink (ie it is not the realpath), when a
pry plugin is loaded, by `activate!`:
require gem_name if !active?
the real_path of `gem_name` is used.
But then in load_cli_options:
cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
require cli_options_file if File.exist?(cli_options_file)
since the path given is absolute, it will be used directly without realpath.
This means that cli.rb may potentially be required twice (once via its realpath if the plugin requires it, the other via its $GEM_HOME path when required by `load_cli_options`), which could raise some errors.
Fix this by using the realpath in load_cli_options too.
Revision r59984 in ruby 2.5 introduced the use of realpath for load paths,
and it was backported to version 2.4 in the minor revision 2.4.4. So
only use the realpath ourselves for ruby versions above or equal to
2.4.4.