Projects
Mega:23.09
rubygem-pry
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 3
View file
_service:tar_scm:rubygem-pry.spec
Changed
@@ -1,27 +1,16 @@ %global gem_name pry Name: rubygem-%{gem_name} -Version: 0.13.1 -Release: 2 +Version: 0.14.2 +Release: 1 Summary: An IRB alternative and runtime developer console License: MIT URL: https://rubygems.org/gems/pry Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source1: https://github.com/pry/%{gem_name}/archive/v%{version}.tar.gz -# rm stray openstruct reference. Upstream at -# https://github.com/pry/pry/commit/70942ad3b2d93e028fc3e8bfe1c6bd11ec79ffad -Patch0: pry-0.13.1-Fix-broken-spec.patch -%if 0%{?fc19} || 0%{?fc20} || 0%{?el7} -Requires: ruby(release) ruby(rubygems) rubygem(coderay) => 1.1.0 rubygem(coderay) < 1.2 -Requires: rubygem(slop) => 3.4 rubygem(slop) < 4 rubygem(method_source) => 0.8.1 -Requires: rubygem(method_source) < 0.9 -%endif BuildRequires: ruby(release) rubygems-devel ruby rubygem(rspec) rubygem(coderay) => 1.1.0 +BuildRequires: rubygem(did_you_mean) ruby-irb BuildRequires: rubygem(slop) => 3.4 rubygem(method_source) => 0.8.1 vi rubygem(bundler) -Patch001: 0001-do-not-undef-unless-defined-2149.patch BuildArch: noarch -%if 0%{?fc19} || 0%{?fc20} || 0%{?el7} -Provides: rubygem(%{gem_name}) = %{version} -%endif %description An IRB alternative and runtime developer console. @@ -36,7 +25,6 @@ gem unpack %{SOURCE0} %setup -q -D -T -n %{gem_name}-%{version} gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec -%patch001 -p1 %build gem build %{gem_name}.gemspec @@ -55,9 +43,9 @@ pushd .%{gem_instdir} tar xvf %{SOURCE1} ln -s %{gem_name}-%{version}/spec spec -cat %{PATCH0} | patch -p1 touch Rakefile sed -i '/pry\/foo/ s/pry/pry-%{version}/' spec/cli_spec.rb +env COLUMNS=160 \ RUBYOPT=-rbundler rspec -rspec_helper spec popd @@ -77,6 +65,9 @@ %doc %{gem_instdir}/README.md %changelog +* Thu Nov 16 2023 liyanan <liyanan61@h-partners.com> - 0.14.2-1 +- Update to 0.14.2 + * Tue Aug 01 2023 chenchen <chen_aka_jan@163.com> - 0.13.1-2 - fix build error for ruby upgrade to 3.2.2
View file
_service:tar_scm:0001-do-not-undef-unless-defined-2149.patch
Deleted
@@ -1,27 +0,0 @@ -From b548784b4a31b49026b69849430a9ec9072ae94a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= - <shyouhei@ruby-lang.org> -Date: Thu, 6 Aug 2020 22:21:10 +0900 -Subject: PATCH do not undef =~ unless defined (#2149) - -Undefining a nonexistent definition is an error in Ruby. This has not been a problem because there always was `Object#=~` predefined. But we are planning to delete that useless method. This would become an error unless properly guarded. ---- - lib/pry/code.rb | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/pry/code.rb b/lib/pry/code.rb -index ad38b4f2..1fb206c4 100644 ---- a/lib/pry/code.rb -+++ b/lib/pry/code.rb -@@ -339,7 +339,7 @@ class Pry - super - end - end -- undef =~ -+ undef =~ if method_defined?(:=~) - - # Check whether String responds to missing methods. - def respond_to_missing?(method_name, include_private = false) --- -2.41.0 -
View file
_service:tar_scm:pry-0.13.1-Fix-broken-spec.patch
Deleted
@@ -1,26 +0,0 @@ -From 25f5022fcf3c43c43bfdb10ff2c1dc60588b9fa6 Mon Sep 17 00:00:00 2001 -From: Barrett Ingram <bingram@eab.com> -Date: Sat, 2 Jan 2021 17:53:36 -0600 -Subject: PATCH Add CI support for ruby 3 and fix broken spec - -Spec started failing because a statement which we expected to be a -syntax error is now interpreted as a valid pattern-matching statement. -Swapping the hash-rockets for colons turns this back into a syntax -error. ---- - spec/syntax_checking_spec.rb | 2 +- - 1 files changed, 1 insertions(+), 1 deletion(-) - -diff --git a/spec/syntax_checking_spec.rb b/spec/syntax_checking_spec.rb -index ca75ba9f0..beba497f1 100644 ---- a/spec/syntax_checking_spec.rb -+++ b/spec/syntax_checking_spec.rb -@@ -36,7 +36,7 @@ - "o = Object.new.tap{ def o.render;", "'MEH'", "}", - - # multiple syntax errors reported in one SyntaxException -- "puts {'key'=>'val'}.to_json" -+ "puts {key: 'val'}.to_json" - .compact.each do |foo| - it "should raise an error on invalid syntax like #{foo.inspect}" do - redirect_pry_io(InputTester.new(*foo), @str_output) do
View file
_service
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="url">git@gitee.com:src-openeuler/rubygem-pry.git</param> <param name="scm">git</param> - <param name="revision">openEuler-23.09</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/plugins.rb
Deleted
@@ -1,139 +0,0 @@ -# frozen_string_literal: true - -require 'ostruct' - -class Pry - class PluginManager - PRY_PLUGIN_PREFIX = /^pry-/.freeze - - # Placeholder when no associated gem found, displays warning - class NoPlugin - def initialize(name) - @name = name - end - - def method_missing(*) - warn "Warning: The plugin '#{@name}' was not found! (no gem found)" - super - end - - def respond_to_missing?(*) - false - end - end - - class Plugin - attr_accessor :name, :gem_name, :enabled, :spec, :active - - def initialize(name, gem_name, spec, enabled) - @name = name - @gem_name = gem_name - @enabled = enabled - @spec = spec - end - - # Disable a plugin. (prevents plugin from being loaded, cannot - # disable an already activated plugin) - def disable! - self.enabled = false - end - - # Enable a plugin. (does not load it immediately but puts on - # 'white list' to be loaded) - def enable! - self.enabled = true - end - - # Load the Command line options defined by this plugin (if they exist) - def load_cli_options - cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb") - return unless File.exist?(cli_options_file) - - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4") - cli_options_file = File.realpath(cli_options_file) - end - require cli_options_file - end - - # Activate the plugin (require the gem - enables/loads the - # plugin immediately at point of call, even if plugin is - # disabled) - # Does not reload plugin if it's already active. - def activate! - # Create the configuration object for the plugin. - Pry.config.send("#{gem_name.tr('-', '_')}=", OpenStruct.new) - - begin - require gem_name unless active? - rescue LoadError => e - warn "Found plugin #{gem_name}, but could not require '#{gem_name}'" - warn e - rescue StandardError => e - warn "require '#{gem_name}' # Failed, saying: #{e}" - end - - self.active = true - self.enabled = true - end - - alias active? active - alias enabled? enabled - - def supported? - pry_version = Gem::Version.new(VERSION) - spec.dependencies.each do |dependency| - if dependency.name == "pry" - return dependency.requirement.satisfied_by?(pry_version) - end - end - true - end - end - - def initialize - @plugins = - end - - # Find all installed Pry plugins and store them in an internal array. - def locate_plugins - gem_list.each do |gem| - next if gem.name !~ PRY_PLUGIN_PREFIX - - plugin_name = gem.name.split('-', 2).last - plugin = Plugin.new(plugin_name, gem.name, gem, false) - @plugins << plugin.tap(&:enable!) if plugin.supported? && !plugin_located?(plugin) - end - @plugins - end - - # @return Hash A hash with all plugin names (minus the 'pry-') as - # keys and Plugin objects as values. - def plugins - h = Hash.new { |_, key| NoPlugin.new(key) } - @plugins.each do |plugin| - hplugin.name = plugin - end - h - end - - # Require all enabled plugins, disabled plugins are skipped. - def load_plugins - @plugins.each do |plugin| - plugin.activate! if plugin.enabled? - end - end - - private - - def plugin_located?(plugin) - @plugins.any? { |existing| existing.gem_name == plugin.gem_name } - end - - def gem_list - Gem.refresh - return Gem::Specification if Gem::Specification.respond_to?(:each) - - Gem.source_index.find_name('') - end - end -end
View file
_service:tar_scm:pry-0.13.1.gem/checksums.yaml.gz -> _service:tar_scm:pry-0.14.2.gem/checksums.yaml.gz
Changed
@@ -1,7 +1,7 @@ --- SHA256: - metadata.gz: 9a8834347bff9e94179a35d225768c377a94b33750c989983f42c6cd90b9f0a5 - data.tar.gz: 363c3c38dea1cba4b0b0b0b0b617b36a91a3d0761c349687deeff54711210886 + metadata.gz: 6d8bac7565d29bff46039481c17aa6a88fec28084916dd8dad12cd4e83b146c1 + data.tar.gz: 90b46a979aaac6d01ddf589217baca57bc2d7ce8197c8f27bc22f823eeaffcdd SHA512: - metadata.gz: deda71757450c541d7e0e9981058244817c1ea8ccf9f8ffec81c1d1919bf8bc45493cd392f8ef44baaac4e70e69c4170dd893e3cb5204770494124b033668507 - data.tar.gz: bbdeb8c6e1f41f107d49ffd9c042121011870516c0228662e98b905bd41c5714748aa9dd09763a9d8c88a030daa3a317e8121d2882cc97ff72554c09fcee685e + metadata.gz: 2e671cca56deb75c1c47ba9108155bec171ebe34d5ba740b3dd7ea3e848fc789291111e40b7c604835b3d90209873a4a3364ec72a5f4c0f062dea98e5b466a30 + data.tar.gz: f4c80ad6f3187823c18e1fff35306fc1e0a0ee4045a06b190f4742c92099b89d7ef5bafcb1c1dd68c8ae09b251a9a9b64bfd33179c2a7778f3122c90d636afa5
View file
_service:tar_scm:pry-0.13.1.gem/data/CHANGELOG.md -> _service:tar_scm:pry-0.14.2.gem/data/CHANGELOG.md
Changed
@@ -1,5 +1,68 @@ ### master +### v0.14.2v0.14.2 (January 9, 2023) + +#### Features + +* Configure `code` as a supported editor on Pry::Editor + (#2236(https://github.com/pry/pry/pull/2236)) +* Added support for Ruby 3.2 + (#2263(https://github.com/pry/pry/pull/2263)) +* Added support for Ruby 3.1 + (#2228(https://github.com/pry/pry/pull/2228)) + +#### Bug fixes + +* Short circuit eval regexes in finding module definition + (#2253(https://github.com/pry/pry/pull/2253)) +* Revert "Escape non-printing characters" + (#2235(https://github.com/pry/pry/pull/2235)) +* Fixed bug where WeirdMethodLocator would fail to find the source of a method breaking whereami + (#2244(https://github.com/pry/pry/pull/2244)) +* Fixed bug where pry would throw an FrozenError when dealing with incomplete tokens + (#2136(https://github.com/pry/pry/pull/2136)) +* Restore --no-history CLI flag functionality + (#2196(https://github.com/pry/pry/pull/2196)) +* Fixed bug where reading from the `_out_` sticky local variable could return + wrong results (#2201(https://github.com/pry/pry/pull/2201)) + +#### Breaking Changes + +* Remove support for Ruby 1.9 and JRuby < 9.0 + (#2239(https://github.com/pry/pry/pull/2239)) + +### v0.14.1v0.14.1 (April 12, 2021) + +#### Bug fixes + +* Fixed bad coloring of some RDoc-style docs + (#2182(https://github.com/pry/pry/pull/2182)) +* Fixed broken `--plugins` option. It shows a warning now + (#2180(https://github.com/pry/pry/pull/2180)) +* Fixed bad output on printing non-visible characters with color codes + (#2154(https://github.com/pry/pry/pull/2154)) +* Fixed bad output when colors are disabled and a string with color codes is + printed (#2158(https://github.com/pry/pry/pull/2158)) + +### v0.14.0v0.14.0 (February 8, 2021) + +#### Features + +* Made `?` an alias to `show-source -d` + (#2133(https://github.com/pry/pry/pull/2133)) +* Added support for Ruby 3.0 + +#### Breaking changes + +* Deleted support for plugin autoloading + (#2119(https://github.com/pry/pry/pull/2119)). In order to load a Pry plugin + you must `require` it from your `pryrc` or add it to your Gemfile. + + ```rb + # ~/.pryrc + require 'pryrc' + ``` + ### v0.13.1v0.13.1 (April 12, 2020) #### Bug fixes @@ -1074,3 +1137,5 @@ v0.12.2: https://github.com/pry/pry/releases/tag/v0.12.2 v0.13.0: https://github.com/pry/pry/releases/tag/v0.13.0 v0.13.1: https://github.com/pry/pry/releases/tag/v0.13.1 +v0.14.0: https://github.com/pry/pry/releases/tag/v0.14.0 +v0.14.1: https://github.com/pry/pry/releases/tag/v0.14.1
View file
_service:tar_scm:pry-0.13.1.gem/data/README.md -> _service:tar_scm:pry-0.14.2.gem/data/README.md
Changed
@@ -1,7 +1,7 @@ Pry === -!Circle Build Status(https://circleci.com/gh/pry/pry.svg?style=shield)(https://circleci.com/gh/pry/pry) +!Pry Build Status(https://github.com/pry/pry/workflows/pry/badge.svg)(https://github.com/pry/pry/actions) !Code Climate(https://codeclimate.com/github/pry/pry.svg)(https://codeclimate.com/github/pry/pry) !Gem Version(https://badge.fury.io/rb/pry.svg)(https://badge.fury.io/rb/pry) !Documentation Status(https://inch-ci.org/github/pry/pry.svg?branch=master)(https://inch-ci.org/github/pry/pry) @@ -21,7 +21,7 @@ **Links:** -* https://pryrepl.org/ +* https://pry.github.io/ * YARD API documentation(https://www.rubydoc.info/gems/pry) * Wiki(https://github.com/pry/pry/wiki) @@ -38,7 +38,6 @@ * Command Shell Integration(#command-shell-integration) * Code Browsing(#code-browsing) * Documentation Browsing(#documentation-browsing) - * Gist integration(#gist-integration) * Edit methods(#edit-methods) * Live Help System(#live-help-system) * Use Pry as your Rails Console(#use-pry-as-your-rails-console) @@ -82,7 +81,7 @@ ### Bundler ```ruby -gem 'pry', '~> 0.12.2' +gem 'pry', '~> 0.13.1' ``` ### Manual @@ -208,7 +207,7 @@ pry(main)> def a.goodbye pry(main)* puts "goodbye cruel world!" pry(main)* end -=> nil +=> :goodbye pry(main)> a.goodbye goodbye cruel world! => nil @@ -266,23 +265,26 @@ pass the `-l` option to `show-source` to include line numbers in the output. In the following example we will enter the `Pry` class, list the instance -methods beginning with 're' and display the source code for the `rep` method: +methods beginning with 'se' and display the source code for the `set_last_result` method: ```ruby pry(main)> cd Pry -pry(Pry):1> ls -M --grep re -Pry#methods: re readline refresh rep repl repl_epilogue repl_prologue retrieve_line -pry(Pry):1> show-source rep -l - -From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:143 +pry(Pry):1> ls -M --grep se +Pry#methods: raise_up raise_up! raise_up_common reset_eval_string select_prompt set_last_result +pry(Pry):1> show-source set_last_result -l + +From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:405: +Owner: Pry +Visibility: public +Signature: set_last_result(result, code=?) Number of lines: 6 -143: def rep(target=TOPLEVEL_BINDING) -144: target = Pry.binding_for(target) -145: result = re(target) -146: -147: show_result(result) if should_print? -148: end +405: def set_last_result(result, code = "") +406: @last_result_is_exception = false +407: @output_ring << result +408: +409: self.last_result = result unless code =~ /\A\s*\z/ +410: end ``` Note that we can also view C methods (from Ruby Core) using the @@ -317,7 +319,7 @@ One use-case for Pry is to explore a program at run-time by `cd`-ing in and out of objects and viewing and invoking methods. In the course of exploring it may be useful to read the documentation for a specific method that you come -across. Like `show-source` the `show-doc` command supports two syntaxes - the +across. `show-source` command supports two syntaxes - the normal `ri` syntax as well as accepting the name of any method that is currently in scope. @@ -339,14 +341,26 @@ ```ruby pry(main)> cd Gem -pry(Gem):1> show-doc try_activate +pry(Gem):1> show-source try_activate -d -From: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:201 -Number of lines: 3 +From: /Users/john/rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:194: +Owner: #<Class:Gem> +Visibility: public +Signature: try_activate(path) +Number of lines: 28 Try to activate a gem containing path. Returns true if activation succeeded or wasn't needed because it was already activated. Returns false if it can't find the path in a gem. + +def self.try_activate(path) + # finds the _latest_ version... regardless of loaded specs and their deps + # if another gem had a requirement that would mean we shouldn't + # activate the latest version, then either it would already be activated + # or if it was ambiguous (and thus unresolved) the code in our custom + # require will try to activate the more specific version. + + spec = Gem::Specification.find_by_path path pry(Gem):1> ``` @@ -427,8 +441,8 @@ Supported Rubies ---------------- -* CRuby >= 1.9.3 -* JRuby >= 1.7 +* CRuby >= 2.0.0 +* JRuby >= 9.0 Contact -------
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry.rb
Changed
@@ -13,7 +13,6 @@ require 'pry/basic_object' require 'pry/prompt' -require 'pry/plugins' require 'pry/code_object' require 'pry/exceptions' require 'pry/hooks'
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/basic_object.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/basic_object.rb
Changed
@@ -2,7 +2,7 @@ class Pry class BasicObject < BasicObject - :Kernel, :File, :Dir, :LoadError, :ENV, :Pry.each do |constant| + %iKernel File Dir LoadError ENV Pry.each do |constant| const_set constant, ::Object.const_get(constant) end include Kernel
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/cli.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/cli.rb
Changed
@@ -35,13 +35,6 @@ self end - # Bring in options defined in plugins - def add_plugin_options - Pry.plugins.values.each(&:load_cli_options) - - self - end - # Add a block responsible for processing parsed options. def add_option_processor(&block) self.option_processors ||= @@ -124,21 +117,12 @@ end end -# Bring in options defined by plugins -Pry::Slop.new do - on "no-plugins" do - Pry.config.should_load_plugins = false - end -end.parse(ARGV.dup) - -Pry::CLI.add_plugin_options if Pry.config.should_load_plugins - # The default Pry command line options (before plugin options are included) Pry::CLI.add_options do banner( "Usage: pry OPTIONS\n" \ "Start a Pry session.\n" \ - "See http://pryrepl.org/ for more information.\n" \ + "See http://pry.github.io/ for more information.\n" \ "Copyright (c) 2016 John Mair (banisterfiend)" \ ) @@ -154,7 +138,7 @@ end on "no-history", "Disable history loading" do - Pry.config.history.should_load = false + Pry.config.history_load = false end on "no-color", "Disable syntax highlighting for session" do @@ -166,25 +150,21 @@ Pry.config.should_load_local_rc = false end - on :s, "select-plugin=", "Only load specified plugin (and no others)." do |plugin_name| - Pry.config.should_load_plugins = false - Pry.pluginsplugin_name.activate! + on :s, "select-plugin=", "Only load specified plugin (and no others)." do |_plugin_name| + warn "The --select-plugin option is deprecated and has no effect" end - on :d, "disable-plugin=", "Disable a specific plugin." do |plugin_name| - Pry.pluginsplugin_name.disable! + on :d, "disable-plugin=", "Disable a specific plugin." do |_plugin_name| + warn "The --disable-plugin option is deprecated and has no effect" end on "no-plugins", "Suppress loading of plugins." do - Pry.config.should_load_plugins = false + warn "The --no-plugins option is deprecated and has no effect" end on "plugins", "List installed plugins." do - puts "Installed Plugins:" - puts "--" - Pry.locate_plugins.each do |plugin| - puts plugin.name.to_s.ljust(18) << plugin.spec.summary - end + warn "The --plugins option is deprecated and has no effect" + warn "Try using `gem list pry-`" Kernel.exit end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/code.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/code.rb
Changed
@@ -339,21 +339,13 @@ super end end - undef =~ + undef =~ if method_defined?(:=~) # Check whether String responds to missing methods. def respond_to_missing?(method_name, include_private = false) ''.respond_to?(method_name, include_private) || super end - if RUBY_VERSION.start_with?('1.9') - # @todo This is needed for Ruby 1.9 support where `lines` return an - # Enumerator. Newer Rubies return an Array - def lines - super.to_a - end - end - protected # An abstraction of the `dup.instance_eval` pattern used throughout this
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/commands/ls/constants.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/commands/ls/constants.rb
Changed
@@ -4,8 +4,8 @@ class Command class Ls < Pry::ClassCommand class Constants < Pry::Command::Ls::Formatter - DEPRECATED_CONSTANTS = - :Data, :Fixnum, :Bignum, :TimeoutError, :NIL, :FALSE, :TRUE + DEPRECATED_CONSTANTS = %i + Data Fixnum Bignum TimeoutError NIL FALSE TRUE .tap do |constants| constants << :JavaPackageModuleTemplate if Helpers::Platform.jruby? end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/commands/show_doc.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/commands/show_doc.rb
Changed
@@ -89,6 +89,5 @@ end Pry::Commands.add_command(Pry::Command::ShowDoc) - Pry::Commands.alias_command '?', 'show-doc' end end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/commands/show_source.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/commands/show_source.rb
Changed
@@ -113,5 +113,6 @@ Pry::Commands.add_command(Pry::Command::ShowSource) Pry::Commands.alias_command 'show-method', 'show-source' Pry::Commands.alias_command '$', 'show-source' + Pry::Commands.alias_command '?', 'show-source -d' end end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/commands/watch_expression.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/commands/watch_expression.rb
Changed
@@ -96,7 +96,7 @@ end def add_hook - hook = :after_eval, :watch_expression + hook = %iafter_eval watch_expression return if pry_instance.hooks.hook_exists?(*hook) pry_instance.hooks.add_hook(*hook) do |_, pry_instance|
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/config.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/config.rb
Changed
@@ -73,9 +73,6 @@ # @return Boolean whether the local ./.pryrc should be loaded attribute :should_load_local_rc - # @return Boolean - attribute :should_load_plugins - # @return Boolean whether to load files specified with the -r flag attribute :should_load_requires @@ -196,7 +193,6 @@ output_prefix: '=> ', requires: , should_load_requires: true, - should_load_plugins: true, windows_console_warning: true, control_d_handler: Pry::ControlDHandler.method(:default), memory_size: 100, @@ -305,17 +301,14 @@ end def default_rc_file - if (pryrc = Pry::Env'PRYRC') - pryrc - elsif (xdg_home = Pry::Env'XDG_CONFIG_HOME') - # See XDG Base Directory Specification at - # https://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html - xdg_home + '/pry/pryrc' - elsif File.exist?(File.expand_path('~/.pryrc')) - '~/.pryrc' - else - '~/.config/pry/pryrc' - end + Pry::Env'PRYRC', + # See XDG Base Directory Specification at + # https://specifications.freedesktop.org/basedir-spec/latest/ + "#{Pry::Env'XDG_CONFIG_HOME'}/pry/pryrc", + File.expand_path('~/.pryrc'), + File.expand_path('~/.config/pry/pryrc') + .compact + .find { |file| File.exist?(file) } end end end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/core_extensions.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/core_extensions.rb
Changed
@@ -78,7 +78,7 @@ # Module.new.class_eval("binding") has different behaviour than CRuby, # where this is not needed: class_eval("binding") vs class_eval{binding}. # Using a block works around the difference of behaviour on JRuby. - # The scope is clear of local variabless. Don't add any. + # The scope is clear of local variables. Don't add any. # # This fixes the following two spec failures, at https://travis-ci.org/pry/pry/jobs/274470002 # 1) ./spec/pry_spec.rb:360:in `block in (root)'
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/editor.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/editor.rb
Changed
@@ -105,7 +105,7 @@ '--nofork' if blocking when /^jedit/ '-wait' if blocking - when /^mate/, /^subl/, /^redcar/ + when /^mate/, /^subl/, /^redcar/, /^code/ '-w' if blocking end end @@ -121,6 +121,8 @@ "+#{line_number} #{file_name}" when /^mate/, /^geany/ "-l #{line_number} #{file_name}" + when /^code/ + "-g #{file_name}:#{line_number}" when /^subl/ "#{file_name}:#{line_number}" when /^uedit32/
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/helpers/documentation_helpers.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/helpers/documentation_helpers.rb
Changed
@@ -17,12 +17,13 @@ last_match_ruby = proc do SyntaxHighlighter.highlight(Regexp.last_match(1)) end + comment.gsub(%r{<code>(?:\s*\n)?(.*?)\s*</code>}m, &last_match_ruby) .gsub(%r{<em>(?:\s*\n)?(.*?)\s*</em>}m) { "\e1m#{Regexp.last_match(1)}\e0m" } .gsub(%r{<i>(?:\s*\n)?(.*?)\s*</i>}m) { "\e1m#{Regexp.last_match(1)}\e0m" } .gsub(%r{<tt>(?:\s*\n)?(.*?)\s*</tt>}m, &last_match_ruby) .gsub(/\B\+(\w+?)\+\B/) { "\e32m#{Regexp.last_match(1)}\e0m" } - .gsub(/((?:^ \t+.+(?:\n+|\Z))+)/, &last_match_ruby) + .gsub(/((?:^ \t+(?:(?!.+\e\)).+(?:\n+|\Z))+)/, &last_match_ruby) .gsub(/`(?:\s*\n)?(^\e*?)\s*`/) { "`#{last_match_ruby.call}`" } end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/helpers/platform.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/helpers/platform.rb
Changed
@@ -28,7 +28,7 @@ def self.windows_ansi? return false unless windows? - !!(defined?(Win32::Console) || Pry::Env'ANSICON' || mri_2?) + !!(defined?(Win32::Console) || Pry::Env'ANSICON' || mri?) end # @return Boolean @@ -47,11 +47,6 @@ end # @return Boolean - def self.mri_19? - mri? && RUBY_VERSION.start_with?('1.9') - end - - # @return Boolean def self.mri_2? mri? && RUBY_VERSION.start_with?('2') end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/helpers/text.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/helpers/text.rb
Changed
@@ -44,7 +44,7 @@ # @param String, #to_s text # @return String _text_ stripped of any color codes. def strip_color(text) - text.to_s.gsub(/(\001)?\e\.*?(\d)+m(\002)?/, '') + text.to_s.gsub(/(\001)?(\e\(\d;\d?)*m)(\002)?/, '') end # Returns _text_ as bold text for use on a terminal.
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/indent.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/indent.rb
Changed
@@ -57,8 +57,8 @@ # # :pre_constant and :preserved_constant are the CodeRay 0.9.8 and 1.0.0 # classifications of "true", "false", and "nil". - IGNORE_TOKENS = :space, :content, :string, :method, :ident, - :constant, :pre_constant, :predefined_constant.freeze + IGNORE_TOKENS = %ispace content string method ident + constant pre_constant predefined_constant.freeze # Tokens that indicate the end of a statement (i.e. that, if they appear # directly before an "if" indicates that that if applies to the same line, @@ -66,10 +66,10 @@ # # :reserved and :keywords are the CodeRay 0.9.8 and 1.0.0 respectively # classifications of "super", "next", "return", etc. - STATEMENT_END_TOKENS = IGNORE_TOKENS + :regexp, :integer, :float, - :keyword, :delimiter, :reserved, - :instance_variable, - :class_variable, :global_variable + STATEMENT_END_TOKENS = IGNORE_TOKENS + %iregexp integer float + keyword delimiter reserved + instance_variable + class_variable global_variable # Collection of tokens that should appear dedented even though they # don't affect the surrounding code. @@ -109,7 +109,7 @@ # reset internal state def reset @stack = - @indent_level = '' + @indent_level = String.new # rubocop:disable Style/EmptyLiteral @heredoc_queue = @close_heredocs = {} @string_start = nil
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/input_completer.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/input_completer.rb
Changed
@@ -270,7 +270,7 @@ end # FIXME: Add Pry here as well? - :IRB, :SLex, :RubyLex, :RubyToken.each do |module_name| + %iIRB SLex RubyLex RubyToken.each do |module_name| next unless Object.const_defined?(module_name) scanner.call(Object.const_get(module_name))
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/method.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/method.rb
Changed
@@ -530,8 +530,9 @@ else fail_msg = "Cannot locate this method: #{name}." if Helpers::Platform.mri? - fail_msg += " Invoke the 'gem-install pry-doc' Pry command to get " \ - "access to Ruby Core documentation.\n" + fail_msg += " Run `gem install pry-doc` to install" \ + " Ruby Core documentation," \ + " and `require 'pry-doc'` to load it.\n" end raise CommandError, fail_msg end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/method/weird_method_locator.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/method/weird_method_locator.rb
Changed
@@ -158,7 +158,7 @@ alias_name = all_methods_for(target_self).find do |v| location = target_self.method(v).source_location - expanded_source_location(location) == renamed_method_source_location + location && expanded_source_location(location) == renamed_method_source_location end alias_name && Pry::Method(target_self.method(alias_name))
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/pry_class.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/pry_class.rb
Changed
@@ -24,8 +24,6 @@ attr_accessor :last_internal_error attr_accessor :config - def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins - def_delegators( :@config, :input, :input=, :output, :output=, :commands, :commands=, :print, :print=, :exception_handler, :exception_handler=, @@ -87,7 +85,7 @@ # Load the local RC file (./.pryrc) def self.rc_files_to_load files = - files << Pry.config.rc_file if Pry.config.should_load_rc + files << Pry.config.rc_file if Pry.config.rc_file && Pry.config.should_load_rc files << LOCAL_RC_FILE if Pry.config.should_load_local_rc files.map { |file| real_path_to(file) }.compact.uniq end @@ -142,7 +140,6 @@ return if @session_finalized @session_finalized = true - load_plugins if Pry.config.should_load_plugins load_requires if Pry.config.should_load_requires load_history if Pry.config.history_load load_traps if Pry.config.should_trap_interrupts @@ -171,6 +168,12 @@ return end + unless mutex_available? + output.puts "ERROR: Unable to obtain mutex lock." + output.puts "This can happen if binding.pry is called from a signal handler" + return + end + options:target = Pry.binding_for(target || toplevel_binding) initial_session_setup final_session_setup @@ -333,9 +336,7 @@ # Basic initialization. def self.init - @plugin_manager ||= PluginManager.new reset_defaults - locate_plugins end # Return a `Binding` object for `target` or return `target` if it is @@ -383,6 +384,13 @@ ensure Thread.current:pry_critical_section -= 1 end + + def self.mutex_available? + Mutex.new.synchronize { true } + rescue ThreadError + false + end + private_class_method :mutex_available? end Pry.init
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/pry_instance.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/pry_instance.rb
Changed
@@ -20,7 +20,7 @@ # This will show a list of available commands and their usage. For more # information about Pry you can refer to the following resources: # -# * http://pryrepl.org/ +# * https://pry.github.io # * https://github.com/pry/pry # * the IRC channel, which is #pry on the Freenode network #
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/repl.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/repl.rb
Changed
@@ -141,8 +141,7 @@ retry # Handle <Ctrl+C> like Bash: empty the current input buffer, but don't - # quit. This is only for MRI 1.9; other versions of Ruby don't let you - # send Interrupt from within Readline. + # quit. rescue Interrupt return :control_c
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/ring.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/ring.rb
Changed
@@ -56,8 +56,8 @@ # exist def (index) @mutex.synchronize do - return @buffer(count + index) % max_size if index.is_a?(Integer) return @bufferindex if count <= max_size + return @buffer(count + index) % max_size if index.is_a?(Integer) transpose_buffer_tailindex end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/version.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/version.rb
Changed
@@ -1,5 +1,5 @@ # frozen_string_literal: true class Pry - VERSION = '0.13.1'.freeze + VERSION = '0.14.2'.freeze end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/warning.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/warning.rb
Changed
@@ -10,16 +10,9 @@ # @param String message # @return void def self.warn(message) - if Kernel.respond_to?(:caller_locations) - location = caller_locations(2..2).first - path = location.path - lineno = location.lineno - else - # Ruby 1.9.3 support. - frame = caller1.split(':') # rubocop:disable Performance/Caller - path = frame.first - lineno = frame1 - end + location = caller_locations(2..2).first + path = location.path + lineno = location.lineno Kernel.warn("#{path}:#{lineno}: warning: #{message}") end
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/wrapped_module.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/wrapped_module.rb
Changed
@@ -246,19 +246,14 @@ method_candidates.count end - # @note On JRuby 1.9 and higher, in certain conditions, this method chucks - # away its ability to be quick (when there are lots of monkey patches, - # like in Rails). However, it should be efficient enough on other rubies. - # @see https://github.com/jruby/jruby/issues/525 - # @return Enumerator, Array on JRuby 1.9 and higher returns Array, on - # other rubies returns Enumerator + # @return Array def candidates enum = Enumerator.new do |y| (0...number_of_candidates).each do |num| y.yield candidate(num) end end - Helpers::Platform.jruby_19? ? enum.to_a : enum + enum end # @return Boolean Whether YARD docs are available for this module.
View file
_service:tar_scm:pry-0.13.1.gem/data/lib/pry/wrapped_module/candidate.rb -> _service:tar_scm:pry-0.14.2.gem/data/lib/pry/wrapped_module/candidate.rb
Changed
@@ -20,9 +20,9 @@ # Methods to delegate to associated `Pry::WrappedModule # instance`. - private_delegates = :lines_for_file, :method_candidates, :yard_docs?, :name - public_delegates = :wrapped, :module?, :class?, :nonblank_name, - :number_of_candidates + private_delegates = %ilines_for_file method_candidates yard_docs? name + public_delegates = %iwrapped module? class? nonblank_name + number_of_candidates def_delegators :@wrapper, *public_delegates def_private_delegators :@wrapper, *private_delegates @@ -98,14 +98,15 @@ # line number is one-indexed. def first_line_of_module_definition(file, line) searchable_lines = lines_for_file(file)0..(line - 2) - searchable_lines.rindex { |v| class_regexes.any? { |r| r =~ v } } + 1 + searchable_lines.rindex { |v| module_definition_first_line?(v) } + 1 end - def class_regexes + def module_definition_first_line?(line) mod_type_string = wrapped.class.to_s.downcase - /(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped.name.split(/::/).last}/, - /^\s*(::)?#{wrapped.name.split(/::/).last}\s*?=\s*?#{wrapped.class}/, - /^\s*(::)?#{wrapped.name.split(/::/).last}\.(class|instance)_eval/ + wrapped_name_last = wrapped.name.split(/::/).last + /(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped_name_last}/ =~ line || + /^\s*(::)?#{wrapped_name_last}\s*?=\s*?#{wrapped.class}/ =~ line || + /^\s*(::)?#{wrapped_name_last}\.(class|instance)_eval/ =~ line end # This method is used by `Candidate#source_location` as a
View file
_service:tar_scm:pry-0.13.1.gem/metadata.gz -> _service:tar_scm:pry-0.14.2.gem/metadata.gz
Changed
@@ -1,17 +1,17 @@ --- !ruby/object:Gem::Specification name: pry version: !ruby/object:Gem::Version - version: 0.13.1 + version: 0.14.2 platform: ruby authors: - John Mair (banisterfiend) - Conrad Irwin - Ryan Fitzgerald - Kyrylo Silin -autorequire: +autorequire: bindir: bin cert_chain: -date: 2020-04-12 00:00:00.000000000 Z +date: 2023-01-09 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: coderay @@ -171,7 +171,6 @@ - lib/pry/object_path.rb - lib/pry/output.rb - lib/pry/pager.rb -- lib/pry/plugins.rb - lib/pry/prompt.rb - lib/pry/pry_class.rb - lib/pry/pry_instance.rb @@ -201,7 +200,7 @@ changelog_uri: https://github.com/pry/pry/blob/master/CHANGELOG.md source_code_uri: https://github.com/pry/pry bug_tracker_uri: https://github.com/pry/pry/issues -post_install_message: +post_install_message: rdoc_options: require_paths: - lib @@ -209,15 +208,15 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 1.9.3 + version: '2.0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: -rubygems_version: 3.1.2 -signing_key: +rubygems_version: 3.4.1 +signing_key: specification_version: 4 summary: A runtime developer console and IRB alternative with powerful introspection capabilities.
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci
Deleted
-(directory)
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci/config.yml
Deleted
@@ -1,209 +0,0 @@ -version: 2 -references: - repo_restore_cache: &repo_restore_cache - restore_cache: - keys: - - repo-{{ .Environment.CIRCLE_SHA1 }} - - repo_save_cache: &repo_save_cache - save_cache: - key: repo-{{ .Environment.CIRCLE_SHA1 }}-{{ epoch }} - paths: - - ~/pry - - bundle_install: &bundle_install - run: - name: Install Bundler dependencies - command: bundle install --path ~/pry/vendor/bundle --jobs 15 - - unit: &unit - run: - name: Run unit tests - command: bundle exec rake - environment: - # Make sure TERM is set so Pry can indent correctly inside tests. - TERM: screen-256color - - install_alpine_nano: &install_alpine_nano - run: - name: Install Nano text editor on Alpine Linux - command: apk add nano - - install_ubuntu_nano: &install_ubuntu_nano - run: - name: Install Nano text editor on Ubuntu - command: sudo apt-get install nano - -jobs: - rubocop_lint: - docker: - - image: circleci/ruby:2.6 - working_directory: ~/pry - steps: - - checkout - - <<: *repo_save_cache - - <<: *bundle_install - - run: - name: Run RuboCop linting - command: bundle exec rubocop --parallel - yard_lint: - docker: - - image: circleci/ruby:2.6 - working_directory: ~/pry - steps: - - checkout - - <<: *repo_save_cache - - <<: *bundle_install - - run: - name: Run YARD linting - command: bundle exec yardoc --fail-on-warning --no-progress - "ruby-1.9": - docker: - - image: kyrylo/ruby-1.9.3p551 - working_directory: /home/circleci/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_alpine_nano - - <<: *unit - "ruby-2.0": - docker: - - image: kyrylo/ruby-2.0.0p648 - working_directory: /home/circleci/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_alpine_nano - - <<: *unit - "ruby-2.1": - docker: - - image: circleci/ruby:2.1 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.2": - docker: - - image: circleci/ruby:2.2 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.3": - docker: - - image: circleci/ruby:2.3 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.4": - docker: - - image: circleci/ruby:2.4 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.5": - docker: - - image: circleci/ruby:2.5 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.6": - docker: - - image: circleci/ruby:2.6 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "ruby-2.7": - docker: - - image: circleci/ruby:2.7.0 - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "jruby-9.1-jdk": - docker: - - image: circleci/jruby:9.1-jdk - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - "jruby-9.2-jdk": - docker: - - image: circleci/jruby:9.2-jdk - working_directory: ~/pry - steps: - - <<: *repo_restore_cache - - <<: *bundle_install - - <<: *install_ubuntu_nano - - <<: *unit - -workflows: - version: 2 - build: - jobs: - - rubocop_lint - - yard_lint - - "ruby-1.9": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.0": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.1": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.2": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.3": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.4": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.5": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.6": - requires: - - rubocop_lint - - yard_lint - - "ruby-2.7": - requires: - - rubocop_lint - - yard_lint - - "jruby-9.1-jdk": - requires: - - rubocop_lint - - yard_lint - - "jruby-9.2-jdk": - requires: - - rubocop_lint - - yard_lint
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci/ruby-1.9.3p551
Deleted
-(directory)
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci/ruby-1.9.3p551/Dockerfile
Deleted
@@ -1,80 +0,0 @@ -FROM alpine - -RUN mkdir -p /usr/local/etc \ - && { \ - echo 'install: --no-document'; \ - echo 'update: --no-document'; \ - } >> /usr/local/etc/gemrc - -ENV RUBY_MAJOR 1.9 -ENV RUBY_VERSION 1.9.3-p551 -ENV RUBYGEMS_VERSION 1.8.23.2 -ENV BUNDLER_VERSION 1.16.6 - -RUN set -ex \ - && apk add --no-cache --virtual .ruby-builddeps \ - autoconf \ - bison \ - bzip2 \ - bzip2-dev \ - ca-certificates \ - coreutils \ - curl \ - gcc \ - gdbm-dev \ - glib-dev \ - libc-dev \ - libffi-dev \ - libxml2-dev \ - libxslt-dev \ - linux-headers \ - make \ - ncurses-dev \ - openssl-dev \ - procps \ - readline-dev \ - ruby \ - yaml-dev \ - zlib-dev \ - && curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \ - && mkdir -p /usr/src \ - && tar -xzf ruby.tar.gz -C /usr/src \ - && rm ruby.tar.gz \ - && cd /usr/src/ruby-$RUBY_VERSION \ - && { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \ - && { echo '#include <asm/ioctl.h>'; echo; cat io.c; } > io.c.new && mv io.c.new io.c \ - && autoconf \ - && ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --disable-install-doc \ - && make \ - && make install \ - && runDeps="$( \ - scanelf --needed --nobanner --recursive /usr/local \ - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u \ - | xargs -r apk info --installed \ - | sort -u \ - )" \ - && apk add --virtual .ruby-rundeps $runDeps \ - bzip2 \ - ca-certificates \ - curl \ - libffi-dev \ - openssl-dev \ - yaml-dev \ - procps \ - zlib-dev \ - && apk del .ruby-builddeps \ - && gem update --system $RUBYGEMS_VERSION \ - && rm -r /usr/src/ruby-$RUBY_VERSION - -RUN apk add --no-cache git nano build-base - -RUN gem update --system 2.7.9 - -RUN gem install bundler --version "$BUNDLER_VERSION" --force - -ENV GEM_HOME /usr/local/bundle -ENV BUNDLE_PATH="$GEM_HOME" BUNDLE_BIN="$GEM_HOME/bin" BUNDLE_SILENCE_ROOT_WARNING=1 BUNDLE_APP_CONFIG="$GEM_HOME" -ENV PATH $BUNDLE_BIN:$PATH -RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" -CMD "irb"
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci/ruby-2.0.0p648
Deleted
-(directory)
View file
_service:tar_scm:v0.13.1.tar.gz/.circleci/ruby-2.0.0p648/Dockerfile
Deleted
@@ -1,80 +0,0 @@ -FROM alpine - -RUN mkdir -p /usr/local/etc \ - && { \ - echo 'install: --no-document'; \ - echo 'update: --no-document'; \ - } >> /usr/local/etc/gemrc - -ENV RUBY_MAJOR 2.0 -ENV RUBY_VERSION 2.0.0-p648 -ENV RUBYGEMS_VERSION 1.8.23.2 -ENV BUNDLER_VERSION 1.16.6 - -RUN set -ex \ - && apk add --no-cache --virtual .ruby-builddeps \ - autoconf \ - bison \ - bzip2 \ - bzip2-dev \ - ca-certificates \ - coreutils \ - curl \ - gcc \ - gdbm-dev \ - glib-dev \ - libc-dev \ - libffi-dev \ - libxml2-dev \ - libxslt-dev \ - linux-headers \ - make \ - ncurses-dev \ - openssl-dev \ - procps \ - readline-dev \ - ruby \ - yaml-dev \ - zlib-dev \ - && curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \ - && mkdir -p /usr/src \ - && tar -xzf ruby.tar.gz -C /usr/src \ - && rm ruby.tar.gz \ - && cd /usr/src/ruby-$RUBY_VERSION \ - && { echo '#define ENABLE_PATH_CHECK 0'; echo; cat file.c; } > file.c.new && mv file.c.new file.c \ - && { echo '#include <asm/ioctl.h>'; echo; cat io.c; } > io.c.new && mv io.c.new io.c \ - && autoconf \ - && ac_cv_func_isnan=yes ac_cv_func_isinf=yes ./configure --disable-install-doc \ - && make \ - && make install \ - && runDeps="$( \ - scanelf --needed --nobanner --recursive /usr/local \ - | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ - | sort -u \ - | xargs -r apk info --installed \ - | sort -u \ - )" \ - && apk add --virtual .ruby-rundeps $runDeps \ - bzip2 \ - ca-certificates \ - curl \ - libffi-dev \ - openssl-dev \ - yaml-dev \ - procps \ - zlib-dev \ - && apk del .ruby-builddeps \ - && gem update --system $RUBYGEMS_VERSION \ - && rm -r /usr/src/ruby-$RUBY_VERSION - -RUN apk add --no-cache git nano build-base - -RUN gem update --system 2.7.9 - -RUN gem install bundler --version "$BUNDLER_VERSION" --force - -ENV GEM_HOME /usr/local/bundle -ENV BUNDLE_PATH="$GEM_HOME" BUNDLE_BIN="$GEM_HOME/bin" BUNDLE_SILENCE_ROOT_WARNING=1 BUNDLE_APP_CONFIG="$GEM_HOME" -ENV PATH $BUNDLE_BIN:$PATH -RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" && chmod 777 "$GEM_HOME" "$BUNDLE_BIN" -CMD "irb"
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/plugins.rb
Deleted
@@ -1,139 +0,0 @@ -# frozen_string_literal: true - -require 'ostruct' - -class Pry - class PluginManager - PRY_PLUGIN_PREFIX = /^pry-/.freeze - - # Placeholder when no associated gem found, displays warning - class NoPlugin - def initialize(name) - @name = name - end - - def method_missing(*) - warn "Warning: The plugin '#{@name}' was not found! (no gem found)" - super - end - - def respond_to_missing?(*) - false - end - end - - class Plugin - attr_accessor :name, :gem_name, :enabled, :spec, :active - - def initialize(name, gem_name, spec, enabled) - @name = name - @gem_name = gem_name - @enabled = enabled - @spec = spec - end - - # Disable a plugin. (prevents plugin from being loaded, cannot - # disable an already activated plugin) - def disable! - self.enabled = false - end - - # Enable a plugin. (does not load it immediately but puts on - # 'white list' to be loaded) - def enable! - self.enabled = true - end - - # Load the Command line options defined by this plugin (if they exist) - def load_cli_options - cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb") - return unless File.exist?(cli_options_file) - - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4") - cli_options_file = File.realpath(cli_options_file) - end - require cli_options_file - end - - # Activate the plugin (require the gem - enables/loads the - # plugin immediately at point of call, even if plugin is - # disabled) - # Does not reload plugin if it's already active. - def activate! - # Create the configuration object for the plugin. - Pry.config.send("#{gem_name.tr('-', '_')}=", OpenStruct.new) - - begin - require gem_name unless active? - rescue LoadError => e - warn "Found plugin #{gem_name}, but could not require '#{gem_name}'" - warn e - rescue StandardError => e - warn "require '#{gem_name}' # Failed, saying: #{e}" - end - - self.active = true - self.enabled = true - end - - alias active? active - alias enabled? enabled - - def supported? - pry_version = Gem::Version.new(VERSION) - spec.dependencies.each do |dependency| - if dependency.name == "pry" - return dependency.requirement.satisfied_by?(pry_version) - end - end - true - end - end - - def initialize - @plugins = - end - - # Find all installed Pry plugins and store them in an internal array. - def locate_plugins - gem_list.each do |gem| - next if gem.name !~ PRY_PLUGIN_PREFIX - - plugin_name = gem.name.split('-', 2).last - plugin = Plugin.new(plugin_name, gem.name, gem, false) - @plugins << plugin.tap(&:enable!) if plugin.supported? && !plugin_located?(plugin) - end - @plugins - end - - # @return Hash A hash with all plugin names (minus the 'pry-') as - # keys and Plugin objects as values. - def plugins - h = Hash.new { |_, key| NoPlugin.new(key) } - @plugins.each do |plugin| - hplugin.name = plugin - end - h - end - - # Require all enabled plugins, disabled plugins are skipped. - def load_plugins - @plugins.each do |plugin| - plugin.activate! if plugin.enabled? - end - end - - private - - def plugin_located?(plugin) - @plugins.any? { |existing| existing.gem_name == plugin.gem_name } - end - - def gem_list - Gem.refresh - return Gem::Specification if Gem::Specification.respond_to?(:each) - - Gem.source_index.find_name('') - end - end -end
View file
_service:tar_scm:v0.14.2.tar.gz/.github
Added
+(directory)
View file
_service:tar_scm:v0.14.2.tar.gz/.github/dependabot.yml
Added
@@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "09:00" + timezone: Europe/Kiev
View file
_service:tar_scm:v0.14.2.tar.gz/.github/workflows
Added
+(directory)
View file
_service:tar_scm:v0.14.2.tar.gz/.github/workflows/test.yml
Added
@@ -0,0 +1,87 @@ +name: pry + +on: push, pull_request + +jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2 + + - name: Install dependencies + run: bundle install + + - name: Rubocop lint + run: rubocop --parallel + + test: + strategy: + matrix: + os: ubuntu-latest, windows-latest + ruby: + - 2.0 + - 2.1 + - 2.2 + - 2.3 + - 2.4 + - 2.5 + - 2.6 + - 2.7 + # Due to https://github.com/actions/runner/issues/849, + # we have to use quotes for '3.0' + - '3.0' + - 3.1 + - 3.2 + - head + - jruby-9.3.3.0 + # - jruby-head + exclude: + - os: windows-latest + ruby: jruby-9.3.3.0 + - os: windows-latest + ruby: '2.0' + - os: windows-latest + ruby: '2.1' + - os: windows-latest + ruby: '2.2' + - os: windows-latest + ruby: '2.3' # Intermittent failing Expression: RBASIC_CLASS(ret) == rb_cString + - os: windows-latest + ruby: '3.1' + - os: windows-latest + ruby: '3.2' + - os: windows-latest + ruby: 'head' + + runs-on: ${{ matrix.os }} + continue-on-error: true + + steps: + - uses: actions/checkout@v3 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + # Run manually, don't cache deps due to a bug with Ruby 2.4 and Ruby 2.5 + # https://github.com/pry/pry/actions/runs/1016360216 + - name: Install dependencies + run: bundle install + + - name: YARD lint + run: | + touch README # Workaround for "incorrect" links in README.md + bundle exec yardoc --fail-on-warning --no-progress --readme=README + + - name: Display Ruby version + run: ruby -v + + - name: Test + run: bundle exec rake + env: + # Make sure TERM is set so Pry can indent correctly inside tests. + TERM: screen-256color
View file
_service:tar_scm:v0.13.1.tar.gz/.rubocop.yml -> _service:tar_scm:v0.14.2.tar.gz/.rubocop.yml
Changed
@@ -1,5 +1,10 @@ inherit_from: .rubocop_todo.yml +# Prevents Ruby 3.1 incompatibility error. You can enable this cop when Ruby 2.4 support is dropped. +# See https://github.com/rubocop/rubocop/issues/10258 +Layout/BlockAlignment: + Enabled: false + Style/NumericPredicate: Enabled: false @@ -28,12 +33,6 @@ Exclude: - 'spec/fixtures/example_nesting.rb' -# TODO: delete exclusions when we drop Ruby 1.9.3 support. -Style/ExpandPathArguments: - Exclude: - - 'lib/pry/commands.rb' - - 'pry.gemspec' - Style/Semicolon: Exclude: - 'spec/method_spec.rb' @@ -46,10 +45,6 @@ Style/StringLiterals: Enabled: false -# TODO: delete this rule when we drop Ruby 1.9.3 support. -Style/SymbolArray: - EnforcedStyle: brackets - Metrics/LineLength: Max: 90
View file
_service:tar_scm:v0.13.1.tar.gz/CHANGELOG.md -> _service:tar_scm:v0.14.2.tar.gz/CHANGELOG.md
Changed
@@ -1,5 +1,68 @@ ### master +### v0.14.2v0.14.2 (January 9, 2023) + +#### Features + +* Configure `code` as a supported editor on Pry::Editor + (#2236(https://github.com/pry/pry/pull/2236)) +* Added support for Ruby 3.2 + (#2263(https://github.com/pry/pry/pull/2263)) +* Added support for Ruby 3.1 + (#2228(https://github.com/pry/pry/pull/2228)) + +#### Bug fixes + +* Short circuit eval regexes in finding module definition + (#2253(https://github.com/pry/pry/pull/2253)) +* Revert "Escape non-printing characters" + (#2235(https://github.com/pry/pry/pull/2235)) +* Fixed bug where WeirdMethodLocator would fail to find the source of a method breaking whereami + (#2244(https://github.com/pry/pry/pull/2244)) +* Fixed bug where pry would throw an FrozenError when dealing with incomplete tokens + (#2136(https://github.com/pry/pry/pull/2136)) +* Restore --no-history CLI flag functionality + (#2196(https://github.com/pry/pry/pull/2196)) +* Fixed bug where reading from the `_out_` sticky local variable could return + wrong results (#2201(https://github.com/pry/pry/pull/2201)) + +#### Breaking Changes + +* Remove support for Ruby 1.9 and JRuby < 9.0 + (#2239(https://github.com/pry/pry/pull/2239)) + +### v0.14.1v0.14.1 (April 12, 2021) + +#### Bug fixes + +* Fixed bad coloring of some RDoc-style docs + (#2182(https://github.com/pry/pry/pull/2182)) +* Fixed broken `--plugins` option. It shows a warning now + (#2180(https://github.com/pry/pry/pull/2180)) +* Fixed bad output on printing non-visible characters with color codes + (#2154(https://github.com/pry/pry/pull/2154)) +* Fixed bad output when colors are disabled and a string with color codes is + printed (#2158(https://github.com/pry/pry/pull/2158)) + +### v0.14.0v0.14.0 (February 8, 2021) + +#### Features + +* Made `?` an alias to `show-source -d` + (#2133(https://github.com/pry/pry/pull/2133)) +* Added support for Ruby 3.0 + +#### Breaking changes + +* Deleted support for plugin autoloading + (#2119(https://github.com/pry/pry/pull/2119)). In order to load a Pry plugin + you must `require` it from your `pryrc` or add it to your Gemfile. + + ```rb + # ~/.pryrc + require 'pryrc' + ``` + ### v0.13.1v0.13.1 (April 12, 2020) #### Bug fixes @@ -1074,3 +1137,5 @@ v0.12.2: https://github.com/pry/pry/releases/tag/v0.12.2 v0.13.0: https://github.com/pry/pry/releases/tag/v0.13.0 v0.13.1: https://github.com/pry/pry/releases/tag/v0.13.1 +v0.14.0: https://github.com/pry/pry/releases/tag/v0.14.0 +v0.14.1: https://github.com/pry/pry/releases/tag/v0.14.1
View file
_service:tar_scm:v0.13.1.tar.gz/Dockerfile -> _service:tar_scm:v0.14.2.tar.gz/Dockerfile
Changed
@@ -7,7 +7,6 @@ RUN tar -xzvf ruby-install-0.4.3.tar.gz RUN cd ruby-install-0.4.3 && make install -RUN ruby-install ruby 1.9.3 RUN ruby-install ruby 2.1.1 RUN ruby-install ruby 2.1.2
View file
_service:tar_scm:v0.13.1.tar.gz/Gemfile -> _service:tar_scm:v0.14.2.tar.gz/Gemfile
Changed
@@ -5,13 +5,7 @@ gem 'rake' gem 'yard' -gem 'rspec', '~> 3.8.0' - -# TODO: unlock version when the bug is fixed: -# https://github.com/rspec/rspec-expectations/issues/1113 -gem 'rspec-expectations', '= 3.8.2' - -gem 'simplecov', '~> 0.16', require: false +gem 'rspec' # Rubocop supports only >=2.2.0 if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.2.0')
View file
_service:tar_scm:v0.13.1.tar.gz/README.md -> _service:tar_scm:v0.14.2.tar.gz/README.md
Changed
@@ -1,7 +1,7 @@ Pry === -!Circle Build Status(https://circleci.com/gh/pry/pry.svg?style=shield)(https://circleci.com/gh/pry/pry) +!Pry Build Status(https://github.com/pry/pry/workflows/pry/badge.svg)(https://github.com/pry/pry/actions) !Code Climate(https://codeclimate.com/github/pry/pry.svg)(https://codeclimate.com/github/pry/pry) !Gem Version(https://badge.fury.io/rb/pry.svg)(https://badge.fury.io/rb/pry) !Documentation Status(https://inch-ci.org/github/pry/pry.svg?branch=master)(https://inch-ci.org/github/pry/pry) @@ -21,7 +21,7 @@ **Links:** -* https://pryrepl.org/ +* https://pry.github.io/ * YARD API documentation(https://www.rubydoc.info/gems/pry) * Wiki(https://github.com/pry/pry/wiki) @@ -38,7 +38,6 @@ * Command Shell Integration(#command-shell-integration) * Code Browsing(#code-browsing) * Documentation Browsing(#documentation-browsing) - * Gist integration(#gist-integration) * Edit methods(#edit-methods) * Live Help System(#live-help-system) * Use Pry as your Rails Console(#use-pry-as-your-rails-console) @@ -82,7 +81,7 @@ ### Bundler ```ruby -gem 'pry', '~> 0.12.2' +gem 'pry', '~> 0.13.1' ``` ### Manual @@ -208,7 +207,7 @@ pry(main)> def a.goodbye pry(main)* puts "goodbye cruel world!" pry(main)* end -=> nil +=> :goodbye pry(main)> a.goodbye goodbye cruel world! => nil @@ -266,23 +265,26 @@ pass the `-l` option to `show-source` to include line numbers in the output. In the following example we will enter the `Pry` class, list the instance -methods beginning with 're' and display the source code for the `rep` method: +methods beginning with 'se' and display the source code for the `set_last_result` method: ```ruby pry(main)> cd Pry -pry(Pry):1> ls -M --grep re -Pry#methods: re readline refresh rep repl repl_epilogue repl_prologue retrieve_line -pry(Pry):1> show-source rep -l - -From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:143 +pry(Pry):1> ls -M --grep se +Pry#methods: raise_up raise_up! raise_up_common reset_eval_string select_prompt set_last_result +pry(Pry):1> show-source set_last_result -l + +From: /home/john/ruby/projects/pry/lib/pry/pry_instance.rb:405: +Owner: Pry +Visibility: public +Signature: set_last_result(result, code=?) Number of lines: 6 -143: def rep(target=TOPLEVEL_BINDING) -144: target = Pry.binding_for(target) -145: result = re(target) -146: -147: show_result(result) if should_print? -148: end +405: def set_last_result(result, code = "") +406: @last_result_is_exception = false +407: @output_ring << result +408: +409: self.last_result = result unless code =~ /\A\s*\z/ +410: end ``` Note that we can also view C methods (from Ruby Core) using the @@ -317,7 +319,7 @@ One use-case for Pry is to explore a program at run-time by `cd`-ing in and out of objects and viewing and invoking methods. In the course of exploring it may be useful to read the documentation for a specific method that you come -across. Like `show-source` the `show-doc` command supports two syntaxes - the +across. `show-source` command supports two syntaxes - the normal `ri` syntax as well as accepting the name of any method that is currently in scope. @@ -339,14 +341,26 @@ ```ruby pry(main)> cd Gem -pry(Gem):1> show-doc try_activate +pry(Gem):1> show-source try_activate -d -From: /Users/john/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:201 -Number of lines: 3 +From: /Users/john/rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:194: +Owner: #<Class:Gem> +Visibility: public +Signature: try_activate(path) +Number of lines: 28 Try to activate a gem containing path. Returns true if activation succeeded or wasn't needed because it was already activated. Returns false if it can't find the path in a gem. + +def self.try_activate(path) + # finds the _latest_ version... regardless of loaded specs and their deps + # if another gem had a requirement that would mean we shouldn't + # activate the latest version, then either it would already be activated + # or if it was ambiguous (and thus unresolved) the code in our custom + # require will try to activate the more specific version. + + spec = Gem::Specification.find_by_path path pry(Gem):1> ``` @@ -427,8 +441,8 @@ Supported Rubies ---------------- -* CRuby >= 1.9.3 -* JRuby >= 1.7 +* CRuby >= 2.0.0 +* JRuby >= 9.0 Contact -------
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry.rb
Changed
@@ -13,7 +13,6 @@ require 'pry/basic_object' require 'pry/prompt' -require 'pry/plugins' require 'pry/code_object' require 'pry/exceptions' require 'pry/hooks'
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/basic_object.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/basic_object.rb
Changed
@@ -2,7 +2,7 @@ class Pry class BasicObject < BasicObject - :Kernel, :File, :Dir, :LoadError, :ENV, :Pry.each do |constant| + %iKernel File Dir LoadError ENV Pry.each do |constant| const_set constant, ::Object.const_get(constant) end include Kernel
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/cli.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/cli.rb
Changed
@@ -35,13 +35,6 @@ self end - # Bring in options defined in plugins - def add_plugin_options - Pry.plugins.values.each(&:load_cli_options) - - self - end - # Add a block responsible for processing parsed options. def add_option_processor(&block) self.option_processors ||= @@ -124,21 +117,12 @@ end end -# Bring in options defined by plugins -Pry::Slop.new do - on "no-plugins" do - Pry.config.should_load_plugins = false - end -end.parse(ARGV.dup) - -Pry::CLI.add_plugin_options if Pry.config.should_load_plugins - # The default Pry command line options (before plugin options are included) Pry::CLI.add_options do banner( "Usage: pry OPTIONS\n" \ "Start a Pry session.\n" \ - "See http://pryrepl.org/ for more information.\n" \ + "See http://pry.github.io/ for more information.\n" \ "Copyright (c) 2016 John Mair (banisterfiend)" \ ) @@ -154,7 +138,7 @@ end on "no-history", "Disable history loading" do - Pry.config.history.should_load = false + Pry.config.history_load = false end on "no-color", "Disable syntax highlighting for session" do @@ -166,25 +150,21 @@ Pry.config.should_load_local_rc = false end - on :s, "select-plugin=", "Only load specified plugin (and no others)." do |plugin_name| - Pry.config.should_load_plugins = false - Pry.pluginsplugin_name.activate! + on :s, "select-plugin=", "Only load specified plugin (and no others)." do |_plugin_name| + warn "The --select-plugin option is deprecated and has no effect" end - on :d, "disable-plugin=", "Disable a specific plugin." do |plugin_name| - Pry.pluginsplugin_name.disable! + on :d, "disable-plugin=", "Disable a specific plugin." do |_plugin_name| + warn "The --disable-plugin option is deprecated and has no effect" end on "no-plugins", "Suppress loading of plugins." do - Pry.config.should_load_plugins = false + warn "The --no-plugins option is deprecated and has no effect" end on "plugins", "List installed plugins." do - puts "Installed Plugins:" - puts "--" - Pry.locate_plugins.each do |plugin| - puts plugin.name.to_s.ljust(18) << plugin.spec.summary - end + warn "The --plugins option is deprecated and has no effect" + warn "Try using `gem list pry-`" Kernel.exit end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/code.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/code.rb
Changed
@@ -339,21 +339,13 @@ super end end - undef =~ + undef =~ if method_defined?(:=~) # Check whether String responds to missing methods. def respond_to_missing?(method_name, include_private = false) ''.respond_to?(method_name, include_private) || super end - if RUBY_VERSION.start_with?('1.9') - # @todo This is needed for Ruby 1.9 support where `lines` return an - # Enumerator. Newer Rubies return an Array - def lines - super.to_a - end - end - protected # An abstraction of the `dup.instance_eval` pattern used throughout this
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/commands/ls/constants.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/commands/ls/constants.rb
Changed
@@ -4,8 +4,8 @@ class Command class Ls < Pry::ClassCommand class Constants < Pry::Command::Ls::Formatter - DEPRECATED_CONSTANTS = - :Data, :Fixnum, :Bignum, :TimeoutError, :NIL, :FALSE, :TRUE + DEPRECATED_CONSTANTS = %i + Data Fixnum Bignum TimeoutError NIL FALSE TRUE .tap do |constants| constants << :JavaPackageModuleTemplate if Helpers::Platform.jruby? end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/commands/show_doc.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/commands/show_doc.rb
Changed
@@ -89,6 +89,5 @@ end Pry::Commands.add_command(Pry::Command::ShowDoc) - Pry::Commands.alias_command '?', 'show-doc' end end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/commands/show_source.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/commands/show_source.rb
Changed
@@ -113,5 +113,6 @@ Pry::Commands.add_command(Pry::Command::ShowSource) Pry::Commands.alias_command 'show-method', 'show-source' Pry::Commands.alias_command '$', 'show-source' + Pry::Commands.alias_command '?', 'show-source -d' end end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/commands/watch_expression.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/commands/watch_expression.rb
Changed
@@ -96,7 +96,7 @@ end def add_hook - hook = :after_eval, :watch_expression + hook = %iafter_eval watch_expression return if pry_instance.hooks.hook_exists?(*hook) pry_instance.hooks.add_hook(*hook) do |_, pry_instance|
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/config.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/config.rb
Changed
@@ -73,9 +73,6 @@ # @return Boolean whether the local ./.pryrc should be loaded attribute :should_load_local_rc - # @return Boolean - attribute :should_load_plugins - # @return Boolean whether to load files specified with the -r flag attribute :should_load_requires @@ -196,7 +193,6 @@ output_prefix: '=> ', requires: , should_load_requires: true, - should_load_plugins: true, windows_console_warning: true, control_d_handler: Pry::ControlDHandler.method(:default), memory_size: 100, @@ -305,17 +301,14 @@ end def default_rc_file - if (pryrc = Pry::Env'PRYRC') - pryrc - elsif (xdg_home = Pry::Env'XDG_CONFIG_HOME') - # See XDG Base Directory Specification at - # https://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html - xdg_home + '/pry/pryrc' - elsif File.exist?(File.expand_path('~/.pryrc')) - '~/.pryrc' - else - '~/.config/pry/pryrc' - end + Pry::Env'PRYRC', + # See XDG Base Directory Specification at + # https://specifications.freedesktop.org/basedir-spec/latest/ + "#{Pry::Env'XDG_CONFIG_HOME'}/pry/pryrc", + File.expand_path('~/.pryrc'), + File.expand_path('~/.config/pry/pryrc') + .compact + .find { |file| File.exist?(file) } end end end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/core_extensions.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/core_extensions.rb
Changed
@@ -78,7 +78,7 @@ # Module.new.class_eval("binding") has different behaviour than CRuby, # where this is not needed: class_eval("binding") vs class_eval{binding}. # Using a block works around the difference of behaviour on JRuby. - # The scope is clear of local variabless. Don't add any. + # The scope is clear of local variables. Don't add any. # # This fixes the following two spec failures, at https://travis-ci.org/pry/pry/jobs/274470002 # 1) ./spec/pry_spec.rb:360:in `block in (root)'
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/editor.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/editor.rb
Changed
@@ -105,7 +105,7 @@ '--nofork' if blocking when /^jedit/ '-wait' if blocking - when /^mate/, /^subl/, /^redcar/ + when /^mate/, /^subl/, /^redcar/, /^code/ '-w' if blocking end end @@ -121,6 +121,8 @@ "+#{line_number} #{file_name}" when /^mate/, /^geany/ "-l #{line_number} #{file_name}" + when /^code/ + "-g #{file_name}:#{line_number}" when /^subl/ "#{file_name}:#{line_number}" when /^uedit32/
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/helpers/documentation_helpers.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/helpers/documentation_helpers.rb
Changed
@@ -17,12 +17,13 @@ last_match_ruby = proc do SyntaxHighlighter.highlight(Regexp.last_match(1)) end + comment.gsub(%r{<code>(?:\s*\n)?(.*?)\s*</code>}m, &last_match_ruby) .gsub(%r{<em>(?:\s*\n)?(.*?)\s*</em>}m) { "\e1m#{Regexp.last_match(1)}\e0m" } .gsub(%r{<i>(?:\s*\n)?(.*?)\s*</i>}m) { "\e1m#{Regexp.last_match(1)}\e0m" } .gsub(%r{<tt>(?:\s*\n)?(.*?)\s*</tt>}m, &last_match_ruby) .gsub(/\B\+(\w+?)\+\B/) { "\e32m#{Regexp.last_match(1)}\e0m" } - .gsub(/((?:^ \t+.+(?:\n+|\Z))+)/, &last_match_ruby) + .gsub(/((?:^ \t+(?:(?!.+\e\)).+(?:\n+|\Z))+)/, &last_match_ruby) .gsub(/`(?:\s*\n)?(^\e*?)\s*`/) { "`#{last_match_ruby.call}`" } end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/helpers/platform.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/helpers/platform.rb
Changed
@@ -28,7 +28,7 @@ def self.windows_ansi? return false unless windows? - !!(defined?(Win32::Console) || Pry::Env'ANSICON' || mri_2?) + !!(defined?(Win32::Console) || Pry::Env'ANSICON' || mri?) end # @return Boolean @@ -47,11 +47,6 @@ end # @return Boolean - def self.mri_19? - mri? && RUBY_VERSION.start_with?('1.9') - end - - # @return Boolean def self.mri_2? mri? && RUBY_VERSION.start_with?('2') end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/helpers/text.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/helpers/text.rb
Changed
@@ -44,7 +44,7 @@ # @param String, #to_s text # @return String _text_ stripped of any color codes. def strip_color(text) - text.to_s.gsub(/(\001)?\e\.*?(\d)+m(\002)?/, '') + text.to_s.gsub(/(\001)?(\e\(\d;\d?)*m)(\002)?/, '') end # Returns _text_ as bold text for use on a terminal.
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/indent.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/indent.rb
Changed
@@ -57,8 +57,8 @@ # # :pre_constant and :preserved_constant are the CodeRay 0.9.8 and 1.0.0 # classifications of "true", "false", and "nil". - IGNORE_TOKENS = :space, :content, :string, :method, :ident, - :constant, :pre_constant, :predefined_constant.freeze + IGNORE_TOKENS = %ispace content string method ident + constant pre_constant predefined_constant.freeze # Tokens that indicate the end of a statement (i.e. that, if they appear # directly before an "if" indicates that that if applies to the same line, @@ -66,10 +66,10 @@ # # :reserved and :keywords are the CodeRay 0.9.8 and 1.0.0 respectively # classifications of "super", "next", "return", etc. - STATEMENT_END_TOKENS = IGNORE_TOKENS + :regexp, :integer, :float, - :keyword, :delimiter, :reserved, - :instance_variable, - :class_variable, :global_variable + STATEMENT_END_TOKENS = IGNORE_TOKENS + %iregexp integer float + keyword delimiter reserved + instance_variable + class_variable global_variable # Collection of tokens that should appear dedented even though they # don't affect the surrounding code. @@ -109,7 +109,7 @@ # reset internal state def reset @stack = - @indent_level = '' + @indent_level = String.new # rubocop:disable Style/EmptyLiteral @heredoc_queue = @close_heredocs = {} @string_start = nil
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/input_completer.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/input_completer.rb
Changed
@@ -270,7 +270,7 @@ end # FIXME: Add Pry here as well? - :IRB, :SLex, :RubyLex, :RubyToken.each do |module_name| + %iIRB SLex RubyLex RubyToken.each do |module_name| next unless Object.const_defined?(module_name) scanner.call(Object.const_get(module_name))
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/method.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/method.rb
Changed
@@ -530,8 +530,9 @@ else fail_msg = "Cannot locate this method: #{name}." if Helpers::Platform.mri? - fail_msg += " Invoke the 'gem-install pry-doc' Pry command to get " \ - "access to Ruby Core documentation.\n" + fail_msg += " Run `gem install pry-doc` to install" \ + " Ruby Core documentation," \ + " and `require 'pry-doc'` to load it.\n" end raise CommandError, fail_msg end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/method/weird_method_locator.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/method/weird_method_locator.rb
Changed
@@ -158,7 +158,7 @@ alias_name = all_methods_for(target_self).find do |v| location = target_self.method(v).source_location - expanded_source_location(location) == renamed_method_source_location + location && expanded_source_location(location) == renamed_method_source_location end alias_name && Pry::Method(target_self.method(alias_name))
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/pry_class.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/pry_class.rb
Changed
@@ -24,8 +24,6 @@ attr_accessor :last_internal_error attr_accessor :config - def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins - def_delegators( :@config, :input, :input=, :output, :output=, :commands, :commands=, :print, :print=, :exception_handler, :exception_handler=, @@ -87,7 +85,7 @@ # Load the local RC file (./.pryrc) def self.rc_files_to_load files = - files << Pry.config.rc_file if Pry.config.should_load_rc + files << Pry.config.rc_file if Pry.config.rc_file && Pry.config.should_load_rc files << LOCAL_RC_FILE if Pry.config.should_load_local_rc files.map { |file| real_path_to(file) }.compact.uniq end @@ -142,7 +140,6 @@ return if @session_finalized @session_finalized = true - load_plugins if Pry.config.should_load_plugins load_requires if Pry.config.should_load_requires load_history if Pry.config.history_load load_traps if Pry.config.should_trap_interrupts @@ -171,6 +168,12 @@ return end + unless mutex_available? + output.puts "ERROR: Unable to obtain mutex lock." + output.puts "This can happen if binding.pry is called from a signal handler" + return + end + options:target = Pry.binding_for(target || toplevel_binding) initial_session_setup final_session_setup @@ -333,9 +336,7 @@ # Basic initialization. def self.init - @plugin_manager ||= PluginManager.new reset_defaults - locate_plugins end # Return a `Binding` object for `target` or return `target` if it is @@ -383,6 +384,13 @@ ensure Thread.current:pry_critical_section -= 1 end + + def self.mutex_available? + Mutex.new.synchronize { true } + rescue ThreadError + false + end + private_class_method :mutex_available? end Pry.init
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/pry_instance.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/pry_instance.rb
Changed
@@ -20,7 +20,7 @@ # This will show a list of available commands and their usage. For more # information about Pry you can refer to the following resources: # -# * http://pryrepl.org/ +# * https://pry.github.io # * https://github.com/pry/pry # * the IRC channel, which is #pry on the Freenode network #
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/repl.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/repl.rb
Changed
@@ -141,8 +141,7 @@ retry # Handle <Ctrl+C> like Bash: empty the current input buffer, but don't - # quit. This is only for MRI 1.9; other versions of Ruby don't let you - # send Interrupt from within Readline. + # quit. rescue Interrupt return :control_c
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/ring.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/ring.rb
Changed
@@ -56,8 +56,8 @@ # exist def (index) @mutex.synchronize do - return @buffer(count + index) % max_size if index.is_a?(Integer) return @bufferindex if count <= max_size + return @buffer(count + index) % max_size if index.is_a?(Integer) transpose_buffer_tailindex end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/version.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/version.rb
Changed
@@ -1,5 +1,5 @@ # frozen_string_literal: true class Pry - VERSION = '0.13.1'.freeze + VERSION = '0.14.2'.freeze end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/warning.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/warning.rb
Changed
@@ -10,16 +10,9 @@ # @param String message # @return void def self.warn(message) - if Kernel.respond_to?(:caller_locations) - location = caller_locations(2..2).first - path = location.path - lineno = location.lineno - else - # Ruby 1.9.3 support. - frame = caller1.split(':') # rubocop:disable Performance/Caller - path = frame.first - lineno = frame1 - end + location = caller_locations(2..2).first + path = location.path + lineno = location.lineno Kernel.warn("#{path}:#{lineno}: warning: #{message}") end
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/wrapped_module.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/wrapped_module.rb
Changed
@@ -246,19 +246,14 @@ method_candidates.count end - # @note On JRuby 1.9 and higher, in certain conditions, this method chucks - # away its ability to be quick (when there are lots of monkey patches, - # like in Rails). However, it should be efficient enough on other rubies. - # @see https://github.com/jruby/jruby/issues/525 - # @return Enumerator, Array on JRuby 1.9 and higher returns Array, on - # other rubies returns Enumerator + # @return Array def candidates enum = Enumerator.new do |y| (0...number_of_candidates).each do |num| y.yield candidate(num) end end - Helpers::Platform.jruby_19? ? enum.to_a : enum + enum end # @return Boolean Whether YARD docs are available for this module.
View file
_service:tar_scm:v0.13.1.tar.gz/lib/pry/wrapped_module/candidate.rb -> _service:tar_scm:v0.14.2.tar.gz/lib/pry/wrapped_module/candidate.rb
Changed
@@ -20,9 +20,9 @@ # Methods to delegate to associated `Pry::WrappedModule # instance`. - private_delegates = :lines_for_file, :method_candidates, :yard_docs?, :name - public_delegates = :wrapped, :module?, :class?, :nonblank_name, - :number_of_candidates + private_delegates = %ilines_for_file method_candidates yard_docs? name + public_delegates = %iwrapped module? class? nonblank_name + number_of_candidates def_delegators :@wrapper, *public_delegates def_private_delegators :@wrapper, *private_delegates @@ -98,14 +98,15 @@ # line number is one-indexed. def first_line_of_module_definition(file, line) searchable_lines = lines_for_file(file)0..(line - 2) - searchable_lines.rindex { |v| class_regexes.any? { |r| r =~ v } } + 1 + searchable_lines.rindex { |v| module_definition_first_line?(v) } + 1 end - def class_regexes + def module_definition_first_line?(line) mod_type_string = wrapped.class.to_s.downcase - /(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped.name.split(/::/).last}/, - /^\s*(::)?#{wrapped.name.split(/::/).last}\s*?=\s*?#{wrapped.class}/, - /^\s*(::)?#{wrapped.name.split(/::/).last}\.(class|instance)_eval/ + wrapped_name_last = wrapped.name.split(/::/).last + /(^|=)\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped_name_last}/ =~ line || + /^\s*(::)?#{wrapped_name_last}\s*?=\s*?#{wrapped.class}/ =~ line || + /^\s*(::)?#{wrapped_name_last}\.(class|instance)_eval/ =~ line end # This method is used by `Candidate#source_location` as a
View file
_service:tar_scm:v0.13.1.tar.gz/pry.gemspec -> _service:tar_scm:v0.14.2.tar.gz/pry.gemspec
Changed
@@ -1,12 +1,12 @@ # frozen_string_literal: true -require File.expand_path('../lib/pry/version', __FILE__) +require File.expand_path('lib/pry/version', __dir__) Gem::Specification.new do |s| s.name = "pry" s.version = Pry::VERSION - s.required_ruby_version = '>= 1.9.3' + s.required_ruby_version = '>= 2.0' s.authors = 'John Mair (banisterfiend)',
View file
_service:tar_scm:v0.13.1.tar.gz/spec/cli_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/cli_spec.rb
Changed
@@ -41,21 +41,6 @@ end end - describe ".add_plugin_options" do - it "returns self" do - expect(described_class.add_plugin_options).to eq(described_class) - end - - it "loads cli options of plugins" do - plugin_mock = double - expect(plugin_mock).to receive(:load_cli_options) - plugins = { 'pry-testplugin' => plugin_mock } - expect(Pry).to receive(:plugins).and_return(plugins) - - described_class.add_plugin_options - end - end - describe ".add_option_processor" do it "returns self" do expect(described_class.add_option_processor {}).to eq(described_class)
View file
_service:tar_scm:v0.13.1.tar.gz/spec/commands/edit_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/commands/edit_spec.rb
Changed
@@ -23,13 +23,7 @@ before do # OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's # something "Temp". - @tf_dir = - if Pry::Helpers::Platform.mri_19? - Pathname.new(Dir::Tmpname.tmpdir) - else - Pathname.new(Dir.tmpdir) - end - + @tf_dir = Pathname.new(Dir.tmpdir) @tf_path = File.expand_path(File.join(@tf_dir.to_s, 'bar.rb')) FileUtils.touch(@tf_path) end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/commands/hist_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/commands/hist_spec.rb
Changed
@@ -2,8 +2,7 @@ describe "hist" do before do - Pry.history.clear - @hist = Pry.history + @hist = Pry.history = Pry::History.new @str_output = StringIO.new @t = pry_tester history: @hist do
View file
_service:tar_scm:v0.13.1.tar.gz/spec/commands/show_source_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/commands/show_source_spec.rb
Changed
@@ -1151,7 +1151,7 @@ end after do - :BetaClass, :AlphaClass.each { |name| Object.remove_const(name) } + %iBetaClass AlphaClass.each { |name| Object.remove_const(name) } end it "shows docs for the nested classes" do @@ -1176,7 +1176,7 @@ end after do - :BetaClass, :AlphaClass.each { |name| Object.remove_const(name) } + %iBetaClass AlphaClass.each { |name| Object.remove_const(name) } end it "shows docs for the nested classes" do @@ -1386,7 +1386,7 @@ end after do - :Child, :Parent.each { |name| Object.remove_const(name) } + %iChild Parent.each { |name| Object.remove_const(name) } end it "shows the docs of the superclass" do @@ -1412,7 +1412,7 @@ end after do - :Grandparent, :Child, :Parent.each { |name| Object.remove_const(name) } + %iGrandparent Child Parent.each { |name| Object.remove_const(name) } end it "shows the docs of the superclass" do @@ -1437,7 +1437,7 @@ end after do - :Child, :Parent.each { |name| Object.remove_const(name) } + %iChild Parent.each { |name| Object.remove_const(name) } end it "raises Pry::CommandError" do @@ -1459,7 +1459,7 @@ end after do - :Beta, :Alpha.each { |name| Object.remove_const(name) } + %iBeta Alpha.each { |name| Object.remove_const(name) } end it "shows the included module's doc" do @@ -1486,7 +1486,7 @@ end after do - :Beta, :Alpha.each { |name| Object.remove_const(name) } + %iBeta Alpha.each { |name| Object.remove_const(name) } end it "raises Pry::CommandError" do @@ -1512,7 +1512,7 @@ end after do - :Gamma, :Beta, :Alpha.each { |name| Object.remove_const(name) } + %iGamma Beta Alpha.each { |name| Object.remove_const(name) } end it "shows nth level included module doc" do @@ -1550,7 +1550,7 @@ end after do - :Grandparent, :Parent, :Child.each { |name| Object.remove_const(name) } + %iGrandparent Parent Child.each { |name| Object.remove_const(name) } end context "and when it's passed once" do
View file
_service:tar_scm:v0.13.1.tar.gz/spec/config_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/config_spec.rb
Changed
@@ -28,7 +28,6 @@ specify { expect(subject.output_prefix).to be_a(String) } specify { expect(subject.requires).to be_an(Array) } specify { expect(subject.should_load_requires).to be(true).or be(false) } - specify { expect(subject.should_load_plugins).to be(true).or be(false) } specify { expect(subject.windows_console_warning).to be(true).or be(false) } specify { expect(subject.control_d_handler).to respond_to(:call) } specify { expect(subject.memory_size).to be_a(Numeric) } @@ -42,11 +41,14 @@ specify { expect(subject.history_load).to eq(true).or be(false) } specify { expect(subject.history_file).to be_a(String) } specify { expect(subject.exec_string).to be_a(String) } - specify { expect(subject.rc_file).to be_a(String) } + specify { expect(subject.rc_file).to be_a(String).or be(nil) } describe "#rc_file" do context "when $PRYRC env variable is set" do before do + allow(File).to receive(:exist?) + allow(File).to receive(:exist?) + .with('/foo/pryrc').and_return(true) allow(Pry::Env).to receive(:) allow(Pry::Env).to receive(:).with('PRYRC').and_return('/foo/pryrc') end @@ -68,7 +70,7 @@ end it "defaults to ~/.pryrc" do - expect(subject.rc_file).to eq('~/.pryrc') + expect(subject.rc_file).to eq(File.expand_path('~/.pryrc')) end end @@ -77,29 +79,58 @@ allow(Pry::Env).to receive(:) allow(Pry::Env).to receive(:) .with('XDG_CONFIG_HOME').and_return('/xdg_home') + end - allow(File).to receive(:exist?) + context "and when '/xdg_home/pry/pryrc' exists" do + before do + allow(File).to receive(:exist?) + allow(File).to receive(:exist?) + .with('/xdg_home/pry/pryrc').and_return(true) + end + + it "defaults to $XDG_CONFIG_HOME/pry/pryrc" do + expect(subject.rc_file).to eq('/xdg_home/pry/pryrc') + end end context "and when ~/.pryrc exists" do before do allow(File).to receive(:exist?) + allow(File).to receive(:exist?) .with(File.expand_path('~/.pryrc')).and_return(true) end - it "defaults to $XDG_CONFIG_HOME/pry/pryrc" do - expect(subject.rc_file).to eq('/xdg_home/pry/pryrc') + it "defaults to ~/.pryrc" do + expect(subject.rc_file).to eq(File.expand_path('~/.pryrc')) + end + + context "and when ~/.config/pry/pryrc exists" do + before do + allow(File).to receive(:exist?) + allow(File).to receive(:exist?) + .with(File.expand_path('~/.config/pry/pryrc')).and_return(true) + end + + it "defaults to ~/.config/pry/pryrc" do + expect(subject.rc_file).to eq(File.expand_path('~/.config/pry/pryrc')) + end end end - context "and when ~/.pryrc doesn't exist" do + context "and when no default rc file exists" do before do allow(File).to receive(:exist?) + allow(Pry::Env).to receive(:).with('PRYRC').and_return(nil) + allow(File).to receive(:exist?) + .with('/xdg_home/pry/pryrc').and_return(false) + allow(File).to receive(:exist?) .with(File.expand_path('~/.pryrc')).and_return(false) + allow(File).to receive(:exist?) + .with(File.expand_path('~/.config/pry/pryrc')).and_return(false) end - it "defaults to $XDG_CONFIG_HOME/pry/pryrc" do - expect(subject.rc_file).to eq('/xdg_home/pry/pryrc') + it "should return nil" do + expect(subject.rc_file).to eq(nil) end end end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/documentation_helper_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/documentation_helper_spec.rb
Changed
@@ -72,5 +72,9 @@ it "should not remove ++" do expect(@helper.process_rdoc("--\n comment in a bubble\n++")).to match(/\+\+/) end + + it "should not syntax highlight already highlighted code" do + expect(@helper.process_rdoc(" \e\31mFOO\e\0m")).to match(/ \e\31mFOO\e\0m/) + end end end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/editor_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/editor_spec.rb
Changed
@@ -6,13 +6,7 @@ before do # OS-specific tempdir name. For GNU/Linux it's "tmp", for Windows it's # something "Temp". - @tf_dir = - if Pry::Helpers::Platform.mri_19? - Pathname.new(Dir::Tmpname.tmpdir) - else - Pathname.new(Dir.tmpdir) - end - + @tf_dir = Pathname.new(Dir.tmpdir) @tf_path = File.join(@tf_dir.to_s, 'hello world.rb') @editor = Pry::Editor.new(Pry.new) @@ -59,6 +53,7 @@ before do allow(ENV).to receive(:key?).and_return(false) allow(Kernel).to receive(:system) + allow(Pry::Helpers::Platform).to receive(:windows?).and_return(false) end %weditor nano vi.each do |text_editor_name| @@ -71,7 +66,11 @@ end end - describe "build_editor_invocation_string", skip: !Pry::Helpers::Platform.windows? do + describe "build_editor_invocation_string" do + before do + allow(Pry::Helpers::Platform).to receive(:windows?).and_return(false) + end + it 'should shell-escape files' do invocation_str = @editor.build_editor_invocation_string(@tf_path, 5, true) expect(invocation_str).to match(/#{@tf_dir}.+hello\\ world\.rb/)
View file
_service:tar_scm:v0.13.1.tar.gz/spec/exception_handler_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/exception_handler_spec.rb
Changed
@@ -47,7 +47,7 @@ end before do - if RUBY_VERSION.start_with?('1.9', '2.0') + if RUBY_VERSION.start_with?('2.0') skip("Ruby #{RUBY_VERSION} doesn't support nested exceptions") end end
View file
_service:tar_scm:v0.14.2.tar.gz/spec/fixtures/test_task.rb
Added
@@ -0,0 +1,5 @@ +# frozen_string_literal: true + +task :test_task do + binding +end
View file
_service:tar_scm:v0.14.2.tar.gz/spec/helpers/text_spec.rb
Added
@@ -0,0 +1,18 @@ +# frozen_string_literal: true + +describe Pry::Helpers::Text do + describe "#strip_color" do + + "\e1A\e0G2 pry(main)> puts \e31m\e1;31m'\e0m\e31m"\ + "hello\e1;31m'\e0m\e31m\e0m\e1B\e0G", + "\e1A\e0G2 pry(main)> puts 'hello'\e1B\e0G", + "\e31m\e1;31m'\e0m\e31mhello\e1;31m'\e0m\e31m\e0m\e1B\e0G", + "'hello'\e1B\e0G", + %wstring string + .each do |(text, text_without_color)| + it "removes color code from text #{text.inspect}" do + expect(subject.strip_color(text)).to eql(text_without_color) + end + end + end +end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/history_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/history_spec.rb
Changed
@@ -4,8 +4,10 @@ require 'rbconfig' RSpec.describe Pry::History do + let(:history) { Pry::History.new } + before do - Pry.history.clear + Pry.history = history @saved_history = "1\n2\n3\ninvalid\0 line\n" @@ -49,14 +51,16 @@ end context "when $XDG_DATA_HOME is defined" do + let(:expected_file_path) { File.expand_path('/my/path/pry/pry_history') } + it "returns config location relative to $XDG_DATA_HOME" do stub_hist has_default: false, xdg_home: '/my/path' - expect(described_class.default_file).to eq('/my/path/pry/pry_history') + expect(described_class.default_file).to eq(expected_file_path) end it "returns config location relative to $XDG_DATA_HOME when ~/.pryrc exists" do stub_hist has_default: true, xdg_home: '/my/path' - expect(described_class.default_file).to eq('/my/path/pry/pry_history') + expect(described_class.default_file).to eq(expected_file_path) end end end @@ -189,8 +193,9 @@ history = Pry::History.new(file_path: '~/test_history') error = Class.new(RuntimeError) + expected_path = File.expand_path(File.join(ENV'HOME'.to_s, "/test_history")) expect(File).to receive(:open) - .with(File.join(ENV'HOME'.to_s, "/test_history"), 'a', 0o600) + .with(expected_path, 'a', 0o600) .and_raise(error) expect { history.push 'a line' }.to raise_error error @@ -198,21 +203,21 @@ end describe "file io errors" do - let(:history) { Pry::History.new(file_path: file_path) } + let(:custom_history) { Pry::History.new(file_path: file_path) } let(:file_path) { Tempfile.new("pry_history_spec").path } Errno::EACCES, Errno::ENOENT.each do |error_class| it "handles #{error_class} failure to read from history" do expect(File).to receive(:foreach).and_raise(error_class) - expect(history).to receive(:warn).with(/Unable to read history file:/) - expect { history.load }.to_not raise_error + expect(custom_history).to receive(:warn).with(/Unable to read history file:/) + expect { custom_history.load }.to_not raise_error end it "handles #{error_class} failure to write history" do Pry.config.history_save = true expect(File).to receive(:open).with(file_path, "a", 0o600).and_raise(error_class) - expect(history).to receive(:warn).with(/Unable to write history file:/) - expect { history.push("anything") }.to_not raise_error + expect(custom_history).to receive(:warn).with(/Unable to write history file:/) + expect { custom_history.push("anything") }.to_not raise_error end end end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/indent_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/indent_spec.rb
Changed
@@ -305,6 +305,14 @@ expect(@indent.indent(input)).to eq output end + it "should not raise error, if MIDWAY_TOKENS are used without indentation" do + expect { @indent.indent("when") }.not_to raise_error + expect { @indent.reset.indent("else") }.not_to raise_error + expect { @indent.reset.indent("elsif") }.not_to raise_error + expect { @indent.reset.indent("ensure") }.not_to raise_error + expect { @indent.reset.indent("rescue") }.not_to raise_error + end + describe "nesting" do test = File.read("spec/fixtures/example_nesting.rb")
View file
_service:tar_scm:v0.13.1.tar.gz/spec/integration/bundler_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/integration/bundler_spec.rb
Changed
@@ -9,8 +9,9 @@ context "when Pry requires Gemfile, which doesn't specify Pry as a dependency" do it "loads auto-completion correctly" do code = <<-RUBY - require "pry" + require "bundler" require "bundler/inline" + require "pry" # Silence the "The Gemfile specifies no dependencies" warning class Bundler::UI::Shell
View file
_service:tar_scm:v0.13.1.tar.gz/spec/integration/cli_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/integration/cli_spec.rb
Changed
@@ -3,38 +3,51 @@ require 'rbconfig' RSpec.describe 'The bin/pry CLI' do - let(:ruby) { RbConfig.ruby.shellescape } - let(:pry_dir) { File.expand_path(File.join(__FILE__, '../../../lib')).shellescape } - let(:clean_output) do - # Pry will emit silent garbage because of our auto indent feature. - # This lambda cleans the output of that garbage. - ->(out) { out.strip.sub("\e0G", "") } + let(:call_pry) do + lambda { |*args| + pry_dir = File.expand_path(File.join(__FILE__, '../../../lib')) + + # the :err option is equivalent to 2>&1 + out = IO.popen(RbConfig.ruby, + "-I", + pry_dir, + 'bin/pry', + *args, + err: %ichild out, &:read) + status = $CHILD_STATUS + + # Pry will emit silent garbage because of our auto indent feature. + # This lambda cleans the output of that garbage. + out = out.strip.sub(/^\e\0FG/, "") + + out, status + } end context "ARGV forwarding" do - let(:code) { "p(ARGV) and exit".shellescape } + let(:code) { "p(ARGV) and exit" } it "forwards ARGV as an empty array when - is passed without following arguments" do - out = clean_output.call(`#{ruby} -I#{pry_dir} bin/pry -e #{code} -`) + out, status = call_pry.call('-e', code, '-') + expect(status).to be_success expect(out).to eq(.inspect) end it "forwards ARGV as an empty array when -- is passed without following arguments" do - out = clean_output.call(`#{ruby} -I#{pry_dir} bin/pry -e #{code} --`) + out, status = call_pry.call('-e', code, '--') + expect(status).to be_success expect(out).to eq(.inspect) end it "forwards its remaining arguments as ARGV when - is passed" do - out = clean_output.call( - `#{ruby} -I#{pry_dir} bin/pry -e #{code} - 1 -foo --bar --baz daz` - ) + out, status = call_pry.call('-e', code, '-', '1', '-foo', '--bar', '--baz', 'daz') + expect(status).to be_success expect(out).to eq(%w1 -foo --bar --baz daz.inspect) end it "forwards its remaining arguments as ARGV when -- is passed" do - out = clean_output.call( - `#{ruby} -I#{pry_dir} bin/pry -e #{code} -- 1 -foo --bar --baz daz` - ) + out, status = call_pry.call('-e', code, '--', '1', '-foo', '--bar', '--baz', 'daz') + expect(status).to be_success expect(out).to eq(%w1 -foo --bar --baz daz.inspect) end end @@ -42,19 +55,17 @@ context '-I path' do it 'adds an additional path to $LOAD_PATH' do code = 'p($LOAD_PATH) and exit' - out = clean_output.call( - `#{ruby} -I#{pry_dir} bin/pry -I /added/at/cli -e '#{code}'` - ) + out, status = call_pry.call('-I', '/added/at/cli', '-e', code) + expect(status).to be_success expect(out).to include('/added/at/cli') end it 'adds multiple additional paths to $LOAD_PATH' do code = 'p($LOAD_PATH) and exit' - out = clean_output.call( - # rubocop:disable Metrics/LineLength - `#{ruby} -I#{pry_dir} bin/pry -I /added-1/at/cli -I /added/at/cli/also -e '#{code}'` - # rubocop:enable Metrics/LineLength - ) + out, status = call_pry.call('-I', '/added-1/at/cli', + '-I', '/added/at/cli/also', + '-e', code) + expect(status).to be_success expect(out).to include('/added-1/at/cli') expect(out).to include('/added/at/cli/also') end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/integration/hanami_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/integration/hanami_spec.rb
Changed
@@ -10,9 +10,6 @@ end it "does not enter an infinite loop (#1471, #1621)" do - if RUBY_VERSION.start_with? "1.9" - skip "prepend is not supported on this version of Ruby" - end code = <<-RUBY require "pry" require "timeout"
View file
_service:tar_scm:v0.13.1.tar.gz/spec/method_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/method_spec.rb
Changed
@@ -208,6 +208,44 @@ m = Pry::Method.from_binding(o.borscht) expect(m.source).to eq Pry::Method(o.method(:paella)).source end + + it 'should not find a wrong method by matching on nil source location' do + included_module = Module.new do + def self.included(base) + base.send :alias_method, "respond_to_without_variables?", "respond_to?" + base.send :alias_method, "respond_to?", "respond_to_with_variables?" + end + + def respond_to_with_variables?(sym, include_priv = false) + respond_to_without_variables?(sym, include_priv) + end + end + + o = Object.new + class << o + attr_reader :tasks + def task(name, &block) + @tasks ||= {} + @tasksname = block + end + + def load_task + path = File.expand_path("spec/fixtures/test_task.rb") + instance_eval File.read(path), path + end + end + + o.load_task + + o2 = Object.new + o2.singleton_class.send(:include, included_module) + + # Verify preconditions. + expect(o2.method(:respond_to_without_variables?).source_location).to be_nil + + b = o2.instance_eval(&o.tasks:test_task) + expect(Pry::Method.from_binding(b).name).to eq "load_task" + end end describe 'super' do
View file
_service:tar_scm:v0.13.1.tar.gz/spec/pry_repl_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/pry_repl_spec.rb
Changed
@@ -125,6 +125,7 @@ describe "autoindent" do it "should raise no exception when indented with a tab" do + skip if Pry::Helpers::Platform.windows? ReplTester.start(correct_indent: true, auto_indent: true) do output = @pry.config.output def output.tty? @@ -135,7 +136,7 @@ break #note the tab here end TAB - output("do\n break #note the tab here\nend\n\e1B\e0G=> nil") + output("do\n break #note the tab here\nend\n\e\\1B\e\\0G=> nil") end end end
View file
_service:tar_scm:v0.13.1.tar.gz/spec/pry_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/pry_spec.rb
Changed
@@ -184,6 +184,36 @@ .to raise_error SignalException end + describe "inside signal handler" do + before do + unless Signal.list.key?('USR1') + skip "Host OS #{RbConfig::CONFIG'host_os'} doesn't support signal USR1" + end + + if Pry::Helpers::Platform.jruby? + skip "jruby allows mutex usage in signal handlers" + end + + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0") + skip "pre-2.0 mri allows mutex usage in signal handlers" + end + + trap("USR1") { @str_output = mock_pry } + end + + after do + trap("USR1") do + # do nothing + end + end + + it "should return with error message" do + expect(mock_pry('1 + 1')).to eql("=> 2\n") + Process.kill("USR1", Process.pid) + expect(@str_output).to match(/Unable to obtain mutex lock/) + end + end + describe "multi-line input" do it "works" do expect(mock_pry('x = ', '1 + 4')).to match(/5/)
View file
_service:tar_scm:v0.13.1.tar.gz/spec/pryrc_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/pryrc_spec.rb
Changed
@@ -24,16 +24,13 @@ expect(TEST_RC).to eq 0 end - # Resolving symlinks doesn't work on jruby 1.9 jruby issue #538 - unless Pry::Helpers::Platform.jruby_19? - it "should not load the rc file twice if it's symlinked differently" do - Pry.config.rc_file = 'spec/fixtures/testrc' - stub_const('Pry::LOCAL_RC_FILE', 'spec/fixtures/testlinkrc') + it "should not load the rc file twice if it's symlinked differently" do + Pry.config.rc_file = 'spec/fixtures/testrc' + stub_const('Pry::LOCAL_RC_FILE', 'spec/fixtures/testlinkrc') - Pry.start(self, input: StringIO.new("exit-all\n"), output: StringIO.new) + Pry.start(self, input: StringIO.new("exit-all\n"), output: StringIO.new) - expect(TEST_RC).to eq 0 - end + expect(TEST_RC).to eq 0 end it "should not load the pryrc if pryrc's directory permissions do not allow this" do
View file
_service:tar_scm:v0.13.1.tar.gz/spec/ring_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/ring_spec.rb
Changed
@@ -1,7 +1,7 @@ # frozen_string_literal: true describe Pry::Ring do - let(:ring) { described_class.new(3) } + subject(:ring) { described_class.new(3) } describe "#<<" do it "adds elements as is when the ring is not full" do @@ -28,6 +28,8 @@ end context "when the ring is not full" do + subject(:ring) { described_class.new(100) } + before { ring << 1 << 2 << 3 } it "reads elements" do
View file
_service:tar_scm:v0.13.1.tar.gz/spec/spec_helper.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/spec_helper.rb
Changed
@@ -1,10 +1,5 @@ # frozen_string_literal: true -if ENV'COVERAGE' - require 'simplecov' - SimpleCov.start -end - require 'pry' require 'rspec'
View file
_service:tar_scm:v0.13.1.tar.gz/spec/syntax_checking_spec.rb -> _service:tar_scm:v0.14.2.tar.gz/spec/syntax_checking_spec.rb
Changed
@@ -36,7 +36,7 @@ "o = Object.new.tap{ def o.render;", "'MEH'", "}", # multiple syntax errors reported in one SyntaxException - "puts {'key'=>'val'}.to_json" + "puts {key: 'val'}.to_json" .compact.each do |foo| it "should raise an error on invalid syntax like #{foo.inspect}" do redirect_pry_io(InputTester.new(*foo), @str_output) do
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2