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:
parent
59f0880d8b
commit
263e722c2a
4 changed files with 36 additions and 9 deletions
|
@ -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:
|
||||
|
||||
|
@ -135,6 +134,31 @@ Pry session:
|
|||
|
||||
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
|
||||
------------------------
|
||||
|
|
|
@ -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
|
||||
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue