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

35 commits

Author SHA1 Message Date
John Mair
47d30a139c free show-source from the horror of module_introspection_helpers.rb and method_options.rb
show-doc and edit and a variety of other commands can also be updated to use the new Pry::CodeObject API
2012-12-20 20:15:00 +01:00
John Mair
81554dda0a migrating show-source over to new Pry::CodeObject API 2012-12-20 18:05:42 +01:00
John Mair
405aacf76d added ability to extract an implicit object from binding when no string is given 2012-12-20 18:05:42 +01:00
John Mair
bbd4df87d4 started code_object stuff 2012-12-20 18:05:42 +01:00
John Mair
3663559291 fix tests on ruby 2.0 2012-12-19 12:28:29 +01:00
John Mair
f1f54d2ecb Allow Pry::WrappedModule.from_str() to look up modules from locals/ivars
No longer restricted to just constants.
2012-12-19 12:03:59 +01:00
Kyrylo Silin
c7b28efc24 Fix ^D press in nested REPLs
The interesting moment is that `cd -` is still a bit dorky.

  [1] pry(main)> _pry_.repl :a
  [2] pry(:a):1> _pry_.repl :b
  [3] pry(:b):2> cd -
  [4] pry(:b):2> cd -
  [5] pry(:b):2>

The problem is that `_pry_.repl` pushes a new binding onto
`binding_stack`, however, it knows nothing about `old_stack`.

Well, there is a workaround for this.

  [1] pry(main)> _pry_.repl :a
  [2] pry(:a):1> ^D
  [3] pry(main)> cd -
  [4] pry(:a):1> cd -
  [5] pry(main)>

Fix "undefined method `old_stack=' for nil:NilClass" error in this
commit, when you press ^D in a nested REPL. Add a test case for this.
Rewrite some comments and old Control-D units tests (so they use newer
test API).

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-15 03:23:24 +02:00
John Mair
f2d6a926f9 add Pry::WrappedModule#super
It's useful having Pry::WrappedModule and Pry::Method share as much interface as possible so that
methods can be indifferent to which one they get (a la show-source / edit)
2012-12-12 02:48:30 +01:00
Conrad Irwin
e59cd57ebf Fix ls formatting spec error 2012-12-09 22:11:09 -08:00
☈king
9b38f33b79 Progress on gist + jruby crash 2012-12-09 23:21:18 -06:00
☈king
2104655a67 Replace gist spec globals with Pad 2012-12-09 19:19:38 -07:00
Ryan Fitzgerald
cbf19cc7a4 Move all fixtures into fixtures/ 2012-12-09 11:42:41 -08:00
Ryan Fitzgerald
e0bebb831d Move version output into private test helper 2012-12-08 17:14:25 -08:00
Ryan Fitzgerald
038bdf8a91 Move some testing code into spec/helpers/ 2012-12-08 17:14:25 -08:00
Ryan Fitzgerald
f0c61ac418 Add Mocha for mocking 2012-12-08 17:02:37 -08:00
John Mair
e9e2bb0360 move mock_pry to local spec/helper.rb 2012-12-09 00:05:39 +01:00
John Mair
4bf42ca006 move Pad to local helpers, and move more methods in PryTestHelpers 2012-12-09 00:01:18 +01:00
John Mair
9a279461c1 PryTestHelpers methods are now module_functions, included into Bacon::Context by default 2012-12-07 23:08:49 +01:00
John Mair
31a9578228 cleaned up lib/pry/test/helper.rb
* removed most historicla junk from lib/pry/test/helper.rb
* relocated recalcitrant junk to the local spec/helper.rb (this isn't exposed to 3rd parties)
2012-12-07 21:41:05 +01:00
☈king
8f92f5a855 Use Jist.copy, not a Helper; fix @filename 2012-12-07 08:35:25 -06:00
☈king
c51f75a9fc DRY gist command's docs vs tests 2012-12-06 23:14:04 -06:00
☈king
27bbc4383a gist: fix filenames from REPL + refactor + test
I glommed together too much on this commit. ☹
2012-12-06 22:46:01 -06:00
Kyrylo Silin
9b85398d29 Remove some repetitive bits from play_spec.rb
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-01 05:49:27 +02:00
Kyrylo Silin
de50544759 Add support for play 69 syntax
`play 69` is a shortcut for `play --file #{_file_} --lines 69`. It plays
lines from the current file. Example (I omitted some useless
information):

  pry(main)> show-source hello
    def hello
      binding.pry
      true
      puts "hi"
      69
    end
  pry(main)> hello
    1: def hello
 => 2:   binding.pry
    3:   true
    4:   puts "hi"
    5:   69
    6: end
  pry(main)> play 5
  => 69
  pry(main)> play 3..4
  hi
  => nil
  pry(main)>

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-01 05:22:16 +02:00
Andrew Vos
cd5f0ae3be Reading the output of ls is hard, tablify it
ls now shows items more like how the unix ls works
2012-11-29 10:51:08 +00:00
Conrad Irwin
83d3ceeb5f Don't recolorize output with ANSI escapes [Fixes #751] 2012-11-28 15:21:14 -08:00
John Mair
d1489a59a3 moved test helper.rb to lib/pry/test/helper.rb, so plugins can use our test helpers 2012-11-28 02:05:30 +01:00
Kyrylo Silin
8a39813708 Fix subcommands
A few things were missing. I had to add a new method and slightly adjust
ClassCommand#slop method. Without these changes subcommands doesn't work
properly.

Add some unit tests for subcommands.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-26 18:07:32 +02:00
Kyrylo Silin
30ec15ab1c Rename "sub_command" to "subcommand"
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:56:58 +02:00
Kyrylo Silin
cf786881bb Extend ClassCommand so it can define sub commands
Create `ClassCommand::Options` class, which ties up sub commands and
default options together.

Let's consider the command `food make --tea`. `food` is a command,
`make` is a sub command and `--tea` is an option of `make` sub command.
We can access `--tea` via `opts[:make][:tea].

Also, we can check the freshness of our food like so: `food --freshness`.
`--freshness` is a default option. We can access it like so:
`opts.freshness?` or `opts[:freshness]`.

Add unit tests for `ClassCommand::Option` and some other tests that
reflect the additions.

Finally, document everything and fix different typos in the existing
documentation.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-11-23 13:41:44 +02:00
Conrad Irwin
a6c4c6950d Revert "Make whereami more consistent (and less cheeky) [Fixes #383]"
This reverts commit f937bb6097.
2012-11-18 16:42:29 -08:00
Conrad Irwin
f937bb6097 Make whereami more consistent (and less cheeky) [Fixes #383] 2012-11-18 16:29:48 -08:00
Conrad Irwin
fae1417e5c Fix specs on jruby-19mode on travis
This is working around (another) brokenness in jruby 1.6.8s splat
handling in ruby 1.9 mode; but I figure that now jruby 1.7 is out,
we can not bother fixing it.
2012-11-18 01:42:22 -08:00
Conrad Irwin
71bd613f13 More spec fixtures around 2012-11-18 01:33:32 -08:00
☈king
848b6bdbeb Rename for tabcompletion-friendliness. 2012-11-15 18:59:51 -06:00