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

31 commits

Author SHA1 Message Date
Jonas Arvidsson
a987a8e7c2 Fix bug in edit regarding file names with path but no suffix
There was a bug in Command::Edit#probably_a_file? due to missing
parentheses in a method call followed by an operator.
2014-01-25 22:55:47 +01:00
Ryan Fitzgerald
46288ab002 Ignore -n and disable_auto_reload in tempfile cases 2013-07-26 16:52:15 -07:00
Conrad Irwin
9c1f814bf7 Remove broken require 2013-03-30 05:19:57 -07:00
Conrad Irwin
29397efb37 Modify methods using Pry::Method#redefine
I considered calling redefine source=, but Pry::Method objects are not
designed to be mutable.
2013-03-28 01:02:13 -07:00
Conrad Irwin
e43daac85c Allow Pry::Method::Patcher to work without _pry_ 2013-03-28 00:25:50 -07:00
Conrad Irwin
f2bdd33ef0 Rename Pry::Commands::Edit::MethodPatcher to Pry::Method::Patcher 2013-03-27 23:39:44 -07:00
Conrad Irwin
ef09e90af1 Use load instead of eval [Fixes #880] 2013-03-22 23:26:52 -07:00
John Mair
81b69e0d73 improve help for 'edit' command 2013-01-18 04:32:03 +01:00
John Mair
f649e283ae edit: ensure 'edit --ex' always edits the exception
There was a bug where if 'edit --ex' was invoked in a patched method context
it would instead to the equivalent of 'edit --method' (patching the current method
rather than the exception)
2013-01-15 20:06:44 +01:00
Kyrylo Silin
e66d2083c1 Edit: handle blanks in filenames correctly
Also, move path escaping to `Editor` class. The test is currently
failing (looks like a bug in `Editor`).
2013-01-14 16:44:09 +01:00
Kyrylo Silin
18e3877651 edit: Add example for --ex --patch combination
And make the two-column examples.
2013-01-12 19:34:13 +02:00
John Mair
503e6bb63f edit command: add --method option
* --method doesn't accept any parameters, it only edits the 'current' method associated
with the binding. It's equivalent to 'edit-method' (with no args).
* This option is necessary as 'edit' by itself edits the last expression.
* Note that --method doesn't just edit the current method, if no method exists (i.e binding.pry was not put
inside a method context) then it edits the current OBJECT instead.

TODO:
* explicitly restrict --method to *just* methods and not allow it to fall back to objects?
* allow --method to take a parameter that must be a method object? e.g --method Pry#repl works
but --method Pry would fail ?
2013-01-11 20:47:46 +01:00
John Mair
e171029de0 Improve Pry::Command::Edit
* put all file and line location logic into FileAndLineLocator module
* pass explicit parameters to ExceptionPatcher and MethodPatcher (rather than just 'self')
2013-01-10 00:07:59 +01:00
Kyrylo Silin
256f35422a Prettify command descriptions, switches and stuff
Wrap command descriptions to 80 characters. Convert some string options
to symbols (where possible). Align options in code. Remove dots in the
end of switch descriptions.

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2013-01-09 22:23:19 +02:00
John Mair
3669832d04 oops, forgot to remove context_locator require 2013-01-09 18:43:17 +01:00
John Mair
9cc95f9ec9 Try to simplify edit.rb
* Remove ContextLocator, inlining the class in edit.rb instead.
* Pass explicit parameters into MethodPatcher and ExceptionPatcher, rather than passing 'self'
  and using def_delegators

Hopefully this won't upset codeclimate too much!
2013-01-09 17:26:19 +01:00
John Mair
5302e3a154 Pry::Command::Edit: renamed some methods to improve grokkability 2013-01-03 01:46:11 +01:00
John Mair
03d3d99211 edit command: extracted out ContextLocator class 2012-12-31 21:52:06 +01:00
John Mair
1a6077a0f9 edit command: extract out ExceptionPatcher, and clean up some code 2012-12-31 19:13:25 +01:00
John Mair
b1353dff1c improve edit command's docs 2012-12-31 05:48:48 +01:00
John Mair
4cfb0dccae Merge remaining edit-method functionality into edit
edit now accepts the -p (runtime patch) switch, and can patch methods.
Coming soon: patching of classes and commands.

edit-method command has been left in codebase until 100% sure 'edit' is a full replacement.
2012-12-31 05:18:30 +01:00
John Mair
621e01e3f0 edit command now supports -p for methods 2012-12-31 05:18:30 +01:00
John Mair
b6bd28139f refactored the f*ck out of edit.rb (edit command) 2012-12-29 23:38:21 +01:00
Kyrylo Silin
ebccd57013 Convert all commands to classes
John "banister" Mair describes the following key features of commands
as classes:

  1. It enables people to extend them by either subclassing or
     monkeypatching.
  2. It enables them to provide their own API, so that for example, the
     Pry::Command::Edit class could have class methods for people to
     configure it.

Please, note that I didn't touch easter eggs commands. I also prettified
some strings (your source code reading experience should vastly improve!).

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-12-27 13:31:37 +02:00
John Mair
6148f62620 edit command: first stab at supporting ALL objects
try:
* edit Pry
* edit Pry#repl
* edit show-source
* ...etc
2012-12-22 22:59:03 +01:00
Kyrylo Silin
c4074b3bb3 Implement --patch flag for edit --ex command
Fix issue #716 (edit --ex -p)

Nothing interesting to describe :S

Implement the feature and add a test for it. Also, remove a couple of
extra characters from some lines (namely, quotation marks and nils).

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2012-10-22 03:00:51 +03:00
Ryan Fitzgerald
e934f2e7d0 Merge branch 'master' into refactor/direct_tests
Conflicts:
	test/test_default_commands/test_input.rb
	test/test_default_commands/test_show_source.rb
2012-08-30 00:21:11 -07:00
Conrad Irwin
246b88cf16 Bond completion includes commands 2012-08-20 23:57:51 -07:00
Ryan Fitzgerald
5ccd6cb2ee Directify tests for edit 2012-08-18 20:58:48 -07:00
Ryan Fitzgerald
1af4207c63 Restore groups, convert most commands to class syntax 2012-08-11 18:27:26 -07:00
Ryan Fitzgerald
8ce49ee081 Remove extended_commands, default_commands -> commands 2012-08-11 17:39:25 -07:00
Renamed from lib/pry/default_commands/edit.rb (Browse further)