From 415eae91b80bbea283876ee399b190d6be6825d6 Mon Sep 17 00:00:00 2001 From: Danielle Sucher Date: Thu, 5 Sep 2013 22:55:47 -0700 Subject: [PATCH 1/3] Have show-doc suggest installing pry-doc in Ruby 2.0 --- lib/pry/helpers/base_helpers.rb | 4 ++++ lib/pry/method.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pry/helpers/base_helpers.rb b/lib/pry/helpers/base_helpers.rb index 307910b1..c07d9e01 100644 --- a/lib/pry/helpers/base_helpers.rb +++ b/lib/pry/helpers/base_helpers.rb @@ -104,6 +104,10 @@ class Pry RUBY_VERSION =~ /1.9/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' end + def mri_20? + RUBY_VERSION =~ /2.0/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' + end + # Try to use `less` for paging, if it fails then use # simple_pager. Also do not page if Pry.pager is falsey def stagger_output(text, out = nil) diff --git a/lib/pry/method.rb b/lib/pry/method.rb index 5a94ea1e..5cf05ece 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -473,7 +473,7 @@ class Pry Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)" else fail_msg = "Cannot locate this method: #{name}." - if mri_18? || mri_19? + if mri_18? || mri_19? || mri_20? fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.' end raise CommandError, fail_msg From e129dc305174f898b678a076c9b5923fe3fe164b Mon Sep 17 00:00:00 2001 From: Danielle Sucher Date: Fri, 6 Sep 2013 06:22:34 -0700 Subject: [PATCH 2/3] Refactor BaseHelpers with #mri? --- lib/pry/helpers/base_helpers.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/pry/helpers/base_helpers.rb b/lib/pry/helpers/base_helpers.rb index c07d9e01..4756df6f 100644 --- a/lib/pry/helpers/base_helpers.rb +++ b/lib/pry/helpers/base_helpers.rb @@ -88,25 +88,25 @@ class Pry end def jruby_19? - RbConfig::CONFIG['ruby_install_name'] == 'jruby' && - RbConfig::CONFIG['ruby_version'] == '1.9' + jruby? && RbConfig::CONFIG['ruby_version'] == '1.9' end def rbx? RbConfig::CONFIG['ruby_install_name'] == 'rbx' end + def mri? + RbConfig::CONFIG['ruby_install_name'] == 'ruby' + end + def mri_18? - RUBY_VERSION =~ /1.8/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' + mri? && RUBY_VERSION =~ /1.8/ end def mri_19? - RUBY_VERSION =~ /1.9/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' + mri? && RUBY_VERSION =~ /1.9/ end - def mri_20? - RUBY_VERSION =~ /2.0/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' - end # Try to use `less` for paging, if it fails then use # simple_pager. Also do not page if Pry.pager is falsey From 031f08af1a946bf3f05f2bc9b855f8cec1c952f7 Mon Sep 17 00:00:00 2001 From: Danielle Sucher Date: Fri, 6 Sep 2013 06:27:29 -0700 Subject: [PATCH 3/3] Check for any mri version in Pry::Method#pry_doc_info --- lib/pry/method.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pry/method.rb b/lib/pry/method.rb index 5cf05ece..a96fe9ed 100644 --- a/lib/pry/method.rb +++ b/lib/pry/method.rb @@ -473,7 +473,7 @@ class Pry Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)" else fail_msg = "Cannot locate this method: #{name}." - if mri_18? || mri_19? || mri_20? + if mri? fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.' end raise CommandError, fail_msg