version 0.5.6, added better help messages and error messages. Refactored pry.rb to include all *.rb using Dir and each

This commit is contained in:
John Mair 2011-02-19 18:21:13 +13:00
parent b56a05e71c
commit 5eea0501bc
4 changed files with 17 additions and 15 deletions

View File

@ -1,3 +1,8 @@
19/2/2010 version 0.5.5
* Added Pry.run_command
* More useful error messages
* Easter eggs (game and cohen-poem)
17/2/2010 version 0.5.0
* Use clipped version of Pry.view() for large objects
* Exit Pry session on ^d

View File

@ -1,20 +1,11 @@
# (C) John Mair (banisterfiend) 2010
# (C) John Mair (banisterfiend) 2011
# MIT License
direc = File.dirname(__FILE__)
require "method_source"
require "readline"
require "#{direc}/pry/version"
require "#{direc}/pry/hooks"
require "#{direc}/pry/print"
require "#{direc}/pry/command_base"
require "#{direc}/pry/commands"
require "#{direc}/pry/prompts"
require "#{direc}/pry/completion"
require "#{direc}/pry/core_extensions"
require "#{direc}/pry/pry_class"
require "#{direc}/pry/pry_instance"
Dir["#{direc}/pry/*.rb"].each do |file|
require file
end

View File

@ -69,7 +69,7 @@ class Pry
end
command "version", "Show Pry version." do
output.puts "Pry version: #{Pry::VERSION}"
output.puts "Pry version: #{Pry::VERSION} on Ruby #{RUBY_VERSION}."
end
command "exit-all", "End all nested Pry sessions." do
@ -343,6 +343,7 @@ e.g show-doc hello_method
output.puts "--\nFrom #{file} @ line ~#{line}:\n--"
output.puts doc
doc
end
command "show-method", "Show the source for METH. Type `show-method --help` for more info." do |*args|
@ -384,6 +385,11 @@ e.g: show-method hello_method
meth = target.eval("method(:#{meth_name})")
end
rescue
target_self = target.eval('self')
if !options[:M]&& target_self.is_a?(Module) &&
target_self.method_defined?(meth_name)
output.puts "Did you mean: show-method -M #{meth_name} ?"
end
output.puts "Invalid method name: #{meth_name}. Type `show-method --help` for help"
next
end

View File

@ -1,3 +1,3 @@
class Pry
VERSION = "0.5.5"
VERSION = "0.5.6"
end