Merge pull request #970 from DanielleSucher/fix-issue-956

Have show-doc suggest installing pry-doc in Ruby 2.0
This commit is contained in:
Robert 2013-09-06 06:31:53 -07:00
commit a67bf8b3b8
2 changed files with 9 additions and 5 deletions

View File

@ -88,22 +88,26 @@ class Pry
end end
def jruby_19? def jruby_19?
RbConfig::CONFIG['ruby_install_name'] == 'jruby' && jruby? && RbConfig::CONFIG['ruby_version'] == '1.9'
RbConfig::CONFIG['ruby_version'] == '1.9'
end end
def rbx? def rbx?
RbConfig::CONFIG['ruby_install_name'] == 'rbx' RbConfig::CONFIG['ruby_install_name'] == 'rbx'
end end
def mri?
RbConfig::CONFIG['ruby_install_name'] == 'ruby'
end
def mri_18? def mri_18?
RUBY_VERSION =~ /1.8/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' mri? && RUBY_VERSION =~ /1.8/
end end
def mri_19? def mri_19?
RUBY_VERSION =~ /1.9/ && RbConfig::CONFIG['ruby_install_name'] == 'ruby' mri? && RUBY_VERSION =~ /1.9/
end end
# Try to use `less` for paging, if it fails then use # Try to use `less` for paging, if it fails then use
# simple_pager. Also do not page if Pry.pager is falsey # simple_pager. Also do not page if Pry.pager is falsey
def stagger_output(text, out = nil) def stagger_output(text, out = nil)

View File

@ -473,7 +473,7 @@ class Pry
Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)" Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)"
else else
fail_msg = "Cannot locate this method: #{name}." fail_msg = "Cannot locate this method: #{name}."
if mri_18? || mri_19? if mri?
fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.' fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.'
end end
raise CommandError, fail_msg raise CommandError, fail_msg