1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

resolved conflict, brought in injekt's awesome changes, added changes to README and fixed but in lesspipe broken pipes

This commit is contained in:
John Mair 2011-04-19 22:37:10 +12:00
parent 59f0880d8b
commit 263e722c2a
4 changed files with 36 additions and 9 deletions

View file

@ -1,5 +1,4 @@
![Alt text](http://dl.dropbox.com/u/26521875/pry_logo2.png)
![Alt text](http://dl.dropbox.com/u/26521875/pry_logo_shade.png)
(C) John Mair (banisterfiend) 2011
_Get to the code_
@ -50,7 +49,7 @@ Example: Navigating around state
---------------------------------------
Pry allows us to pop in and out of different scopes (objects) using
the `cd` command. To view what variables and methods are available
the `cd` command. To view which variables and methods are available
within a particular scope we use the versatile `ls` command.
Here we will begin Pry at top-level, then pry on a class and then on
@ -100,7 +99,7 @@ point available. When the session ends the program continues with any
modifications you made to it.
This functionality can be used for such things as: debugging,
implementing developer consoles, and applying hot patches.
implementing developer consoles and applying hot patches.
code:
@ -134,7 +133,32 @@ Pry session:
pry(main)> exit
program resumes here.
Command Shell Integration
--------------------------
A line of input that begins with a '.' will be forwarded to the
command shell. This enables us to navigate the file system, spawn
an editor, and run git and rake directly from within Pry.
Further, we can use the `shell-mode` command to incorporate the
present working directory into the Pry prompt and bring in (very
limited at this stage, sorry) file name completion.
We can also interpolate Ruby code directly into the shell by
using the normal `#{}` string interpolation syntax.
In the code below we're going to switch to `shell-mode` and use the
`gem-cd` command to enter the home directory for a gem and examine
some of the files there, we will also show off some interpolation.
Features and limitations
------------------------

View file

@ -4,7 +4,7 @@ class Pry
private
def gem_installed?(gem_name)
def gem_installed?(gem_name)
require 'rubygems'
!!Gem.source_index.find_name(gem_name).first
end
@ -94,8 +94,9 @@ class Pry
return
end
lesspipe { |less| less.puts text }
rescue Exception
rescue Errno::ENOENT
simple_pager(text)
rescue Errno::EPIPE
end
#

View file

@ -71,7 +71,7 @@ class Pry
@@cd_history << Dir.pwd
Dir.chdir(dest)
output.puts "=> #{dest.inspect}"
output.puts "=> #{dest}"
rescue Errno::ENOENT
output.puts "No such directory: #{dest}"
end

View file

@ -1,7 +1,9 @@
require "awesome_print"
class Pry
DEFAULT_PRINT = proc do |output, value|
if Pry.color
output.puts "=> #{CodeRay.scan(Pry.view(value), :ruby).term}"
output.puts "=> #{value.ai}"#"#{CodeRay.scan(Pry.view(value), :ruby).term}"
else
output.puts "=> #{Pry.view(value)}"
end