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

23 commits

Author SHA1 Message Date
John Mair
3a4041cb24 Allow use of hash-based hooks, but show warning.
* Shows a deprecation warning when used with a link to the new `Pry::Hooks` documentation.
* When hash-based hooks are used they create anonymous hooks for the associated event.
i.e Pry.hooks = { :before_session => proc { puts 'hi' } }, the 'name' of that hook is `nil`.
* Anonymous hooks (nil-named) are different to ordinary hooks in that they dont raise an exception when user attempts to define another of the same name, they just silently overwrite previous one. This is to
mimic the old hash-based behaviour.
* Pry::Hooks[] and Pry::Hooks[]= are defined too, and they get and set the anonymous hook for the given event, i.e hooks[:before_session] = proc { "hi" } is equivalent to: hook.add_hook(:before_session, nil,
proc { "hi" })
* Proc::Hook#[] and Pry::Hooks#[]= also display deprecation warnings.
2012-01-24 21:44:21 +13:00
John Mair
7671aa6684 Wrapped config.hooks{=} to error on old API.
We no longer wish to support the (undocumented!!) hash-based hooks API. When a user attempts to use this API
Pry will raise a `Pry::ObsoleteError` exception with a message telling them to use `Pry::Hooks` instead.
2012-01-24 01:41:03 +13:00
Conrad Irwin
f3262e3270 Make exec_hook robust to exceptions
The rationale for this is simple: you add hooks to enhance the core
functionality with added niceness, so you don't want a buggy hook to
break core functionality.

If you call exec_hook via an instance of Pry, it will additionally print
a warning to output whenever such an exception occurs, giving useful
information on how to debug the problem.
2012-01-14 00:33:36 -08:00
Conrad Irwin
d2f5725537 Code Golf! 2012-01-11 22:35:16 -08:00
John Mair
2fdfbad039 added Pry::Hooks#dup/merge/merge! and tests 2012-01-12 16:56:41 +13:00
John Mair
3001b53dd9 added delete_hooks alias for Hooks#clear, also minor refactors 2012-01-06 22:24:28 +13:00
John Mair
c800c0f04f Hook system now executes hooks in order.
Also the return value of exec_hook() is now the value of the last executed hook.
Internally, hooks now use arrays (rather than hash). Also added a get_hooks() method.
Updated tests to reflect these changes.
2011-11-23 18:55:35 +13:00
John Mair
263d621625 Hooks now have names, also improved some terminology.
Naming hooks makes them easier to reshuffle and customize.
2011-11-16 02:49:11 +13:00
John Mair
e9244b433b target is now converted to binding inside Pry.start, Pry::Hooks#exec_hook now returns array of return values 2011-11-13 23:25:39 +13:00
John Mair
c02772af19 added basic skeleton for hooks system (yet to add many hook callsites) 2011-11-13 02:37:57 +13:00
John Mair
49153dfa2b hooks refactor 2011-10-18 15:27:54 +13:00
Lee Jarvis
37dcc6b85b merge hook/print/prompt constants into pry.rb and remove files 2011-05-20 15:50:55 +01:00
Lee Jarvis
3ff75dd20a whitespace cleanup in one hit 2011-04-18 22:31:39 +01:00
John Mair
50dbcb0d3b Added regular --grep option to ls. Also made it so '-e' option
used to invoke Pry from command line doesn't break the `whereami` command
2011-04-19 02:13:18 +12:00
John Mair
71c1820c1e passed parameter to whereami to stop 1.8 warning about lacking
arguments (need to fix this properly in 0.9.0 in Pry.run_command at
some point)
2011-04-12 00:50:30 +12:00
John Mair
3c271ff712 turned chomp! into an rstrip! in process_line(). Fixed 1.8.7 compat
for `read_between_lines` function commands.rb. Removed before/after
hook output text (too spammy). Fixed file-mode completion, so it works
straight away. CHanged 'pry' rake task to 'binding.pry' instead of
just 'pry' so that context is given.
2011-04-08 13:06:39 +12:00
John Mair
0fa6fdce5e version 0.7.7.2, fixed jruby support and improved cd command so it
can operate on arbitrary expressions
2011-04-01 18:29:04 +13:00
John Mair
f4d7e418af version 0.7.6, supercharged 'whereami' method, added AROUND parameter. Improved rubinius support 2011-03-26 22:08:12 +13:00
John Mair
439e4ccbf4 version 0.6.8.1 - fixed rubinius raising when command line pry was invoked
* added :__script__ test to hooks too
* raise was due to top-level rubinius __method__ returning :__script__
  and not simply returning nil (like MRI/JRUBY)
* Fix was to include :__script__ in the test.
* also slightly improved working in README.markdown
2011-03-06 20:35:16 +13:00
John Mair
4b9198d03c version 0.6.8, added whereami command, made .pryrc run at the start of each runtime session, put syntax highlighting on by default 2011-03-06 03:17:54 +13:00
John Mair
33780cc77d Version 0.4.9pre1. Added show_command, added -g option to ls and got it working in combination with -c, e.g ls -gc. Changed documentation for ! 2011-02-14 04:49:53 +13:00
John Mair
cb9df87779 more docs for hooks, print, and prompts 2011-01-19 21:40:43 +13:00
John Mair
571612f4cf * completely merged Output and Commands classes, reduced Output to just a simple puts() method, a la Input and read()
* Commands now completely manages 'help', so that 'help' returns full command list/doco and 'help cmd' returns doc for just that command
* Turned out.session_start() and out.session_end() into hook methods: Pry.hooks :before_session, and :after_session
* Refactored Pry#initialize, so no longer individually setting accessors and hash options, instead using ConfigOptions to iterate over accessors and set their default value to Pry.send(accessor_name)
* TO DO: rewrite tests in terms of new program structure, since they're all failing due to major change (not because functionality is lacking but due to assumptions tests were making about program structure)
2010-12-27 23:56:55 +13:00