Permalink
Browse files

version 0.5.6, added better help messages and error messages. Refacto…

…red pry.rb to include all *.rb using Dir and each
  • Loading branch information...
1 parent b56a05e commit 5eea0501bc8fb7e7f6290a11cc0b054a9702dffd @banister committed Feb 19, 2011
Showing with 17 additions and 15 deletions.
  1. +5 −0 CHANGELOG
  2. +4 −13 lib/pry.rb
  3. +7 −1 lib/pry/commands.rb
  4. +1 −1 lib/pry/version.rb
View
5 CHANGELOG
@@ -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
17 lib/pry.rb
@@ -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
8 lib/pry/commands.rb
@@ -69,7 +69,7 @@ class Commands < CommandBase
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 @@ class Commands < CommandBase
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 @@ class Commands < CommandBase
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
2 lib/pry/version.rb
@@ -1,3 +1,3 @@
class Pry
- VERSION = "0.5.5"
+ VERSION = "0.5.6"
end

0 comments on commit 5eea050

Please sign in to comment.