pry 0.9.10pre1-i386-mingw32 → 0.9.11-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -1
- data/CHANGELOG +63 -2
- data/CONTRIBUTORS +43 -25
- data/Gemfile +7 -0
- data/Guardfile +62 -0
- data/README.markdown +4 -4
- data/Rakefile +34 -35
- data/lib/pry.rb +107 -54
- data/lib/pry/cli.rb +34 -11
- data/lib/pry/code.rb +165 -182
- data/lib/pry/code/code_range.rb +70 -0
- data/lib/pry/code/loc.rb +92 -0
- data/lib/pry/code_object.rb +153 -0
- data/lib/pry/command.rb +160 -22
- data/lib/pry/command_set.rb +37 -26
- data/lib/pry/commands.rb +4 -27
- data/lib/pry/commands/amend_line.rb +99 -0
- data/lib/pry/commands/bang.rb +20 -0
- data/lib/pry/commands/bang_pry.rb +17 -0
- data/lib/pry/commands/cat.rb +53 -0
- data/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/lib/pry/commands/cat/exception_formatter.rb +78 -0
- data/lib/pry/commands/cat/file_formatter.rb +84 -0
- data/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/lib/pry/commands/cd.rb +30 -0
- data/lib/pry/commands/code_collector.rb +165 -0
- data/lib/pry/commands/deprecated_commands.rb +2 -0
- data/lib/pry/commands/disable_pry.rb +27 -0
- data/lib/pry/commands/easter_eggs.rb +112 -0
- data/lib/pry/commands/edit.rb +206 -0
- data/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/lib/pry/commands/edit/file_and_line_locator.rb +38 -0
- data/lib/pry/commands/edit/method_patcher.rb +122 -0
- data/lib/pry/commands/exit.rb +42 -0
- data/lib/pry/commands/exit_all.rb +29 -0
- data/lib/pry/commands/exit_program.rb +24 -0
- data/lib/pry/commands/find_method.rb +199 -0
- data/lib/pry/commands/fix_indent.rb +19 -0
- data/lib/pry/commands/gem_cd.rb +26 -0
- data/lib/pry/commands/gem_install.rb +29 -0
- data/lib/pry/commands/gem_list.rb +33 -0
- data/lib/pry/commands/gem_open.rb +29 -0
- data/lib/pry/commands/gist.rb +95 -0
- data/lib/pry/commands/help.rb +164 -0
- data/lib/pry/commands/hist.rb +161 -0
- data/lib/pry/commands/import_set.rb +22 -0
- data/lib/pry/commands/install_command.rb +51 -0
- data/lib/pry/commands/jump_to.rb +29 -0
- data/lib/pry/commands/ls.rb +339 -0
- data/lib/pry/commands/nesting.rb +25 -0
- data/lib/pry/commands/play.rb +69 -0
- data/lib/pry/commands/pry_backtrace.rb +26 -0
- data/lib/pry/commands/pry_version.rb +17 -0
- data/lib/pry/commands/raise_up.rb +32 -0
- data/lib/pry/commands/reload_code.rb +39 -0
- data/lib/pry/commands/reset.rb +18 -0
- data/lib/pry/commands/ri.rb +56 -0
- data/lib/pry/commands/save_file.rb +61 -0
- data/lib/pry/commands/shell_command.rb +43 -0
- data/lib/pry/commands/shell_mode.rb +27 -0
- data/lib/pry/commands/show_doc.rb +78 -0
- data/lib/pry/commands/show_info.rb +139 -0
- data/lib/pry/commands/show_input.rb +17 -0
- data/lib/pry/commands/show_source.rb +37 -0
- data/lib/pry/commands/simple_prompt.rb +22 -0
- data/lib/pry/commands/stat.rb +40 -0
- data/lib/pry/commands/switch_to.rb +23 -0
- data/lib/pry/commands/toggle_color.rb +20 -0
- data/lib/pry/commands/whereami.rb +114 -0
- data/lib/pry/commands/wtf.rb +57 -0
- data/lib/pry/completion.rb +120 -46
- data/lib/pry/config.rb +11 -0
- data/lib/pry/core_extensions.rb +30 -19
- data/lib/pry/editor.rb +129 -0
- data/lib/pry/helpers.rb +1 -0
- data/lib/pry/helpers/base_helpers.rb +89 -119
- data/lib/pry/helpers/command_helpers.rb +7 -122
- data/lib/pry/helpers/table.rb +100 -0
- data/lib/pry/helpers/text.rb +4 -4
- data/lib/pry/history_array.rb +5 -0
- data/lib/pry/hooks.rb +1 -3
- data/lib/pry/indent.rb +104 -30
- data/lib/pry/method.rb +66 -22
- data/lib/pry/module_candidate.rb +26 -15
- data/lib/pry/pager.rb +70 -0
- data/lib/pry/plugins.rb +1 -2
- data/lib/pry/pry_class.rb +63 -22
- data/lib/pry/pry_instance.rb +58 -37
- data/lib/pry/rubygem.rb +74 -0
- data/lib/pry/terminal_info.rb +43 -0
- data/lib/pry/test/helper.rb +185 -0
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +58 -24
- data/pry.gemspec +21 -37
- data/{test/test_cli.rb → spec/cli_spec.rb} +0 -0
- data/spec/code_object_spec.rb +277 -0
- data/{test/test_code.rb → spec/code_spec.rb} +19 -1
- data/{test/test_command_helpers.rb → spec/command_helpers_spec.rb} +0 -0
- data/{test/test_command_integration.rb → spec/command_integration_spec.rb} +38 -46
- data/{test/test_command_set.rb → spec/command_set_spec.rb} +18 -1
- data/{test/test_command.rb → spec/command_spec.rb} +250 -149
- data/spec/commands/amend_line_spec.rb +247 -0
- data/spec/commands/bang_spec.rb +19 -0
- data/spec/commands/cat_spec.rb +164 -0
- data/spec/commands/cd_spec.rb +250 -0
- data/spec/commands/disable_pry_spec.rb +25 -0
- data/spec/commands/edit_spec.rb +727 -0
- data/spec/commands/exit_all_spec.rb +34 -0
- data/spec/commands/exit_program_spec.rb +19 -0
- data/spec/commands/exit_spec.rb +34 -0
- data/{test/test_default_commands/test_find_method.rb → spec/commands/find_method_spec.rb} +27 -7
- data/spec/commands/gem_list_spec.rb +26 -0
- data/spec/commands/gist_spec.rb +75 -0
- data/{test/test_default_commands/test_help.rb → spec/commands/help_spec.rb} +8 -9
- data/spec/commands/hist_spec.rb +181 -0
- data/spec/commands/jump_to_spec.rb +15 -0
- data/spec/commands/ls_spec.rb +177 -0
- data/spec/commands/play_spec.rb +140 -0
- data/spec/commands/raise_up_spec.rb +56 -0
- data/spec/commands/save_file_spec.rb +177 -0
- data/spec/commands/show_doc_spec.rb +378 -0
- data/spec/commands/show_input_spec.rb +17 -0
- data/spec/commands/show_source_spec.rb +597 -0
- data/spec/commands/whereami_spec.rb +154 -0
- data/spec/completion_spec.rb +233 -0
- data/spec/control_d_handler_spec.rb +58 -0
- data/spec/editor_spec.rb +79 -0
- data/{test/test_exception_whitelist.rb → spec/exception_whitelist_spec.rb} +0 -0
- data/{test → spec/fixtures}/candidate_helper1.rb +0 -0
- data/{test → spec/fixtures}/candidate_helper2.rb +0 -0
- data/{test/test_default_commands → spec/fixtures}/example.erb +0 -0
- data/spec/fixtures/example_nesting.rb +33 -0
- data/spec/fixtures/show_source_doc_examples.rb +15 -0
- data/{test → spec/fixtures}/testrc +0 -0
- data/{test → spec/fixtures}/testrcbad +0 -0
- data/spec/helper.rb +34 -0
- data/spec/helpers/bacon.rb +86 -0
- data/spec/helpers/mock_pry.rb +43 -0
- data/spec/helpers/table_spec.rb +83 -0
- data/{test/test_history_array.rb → spec/history_array_spec.rb} +21 -19
- data/{test/test_hooks.rb → spec/hooks_spec.rb} +0 -0
- data/{test/test_indent.rb → spec/indent_spec.rb} +24 -0
- data/{test/test_input_stack.rb → spec/input_stack_spec.rb} +4 -0
- data/{test/test_method.rb → spec/method_spec.rb} +65 -1
- data/{test/test_prompt.rb → spec/prompt_spec.rb} +0 -0
- data/{test/test_pry_defaults.rb → spec/pry_defaults_spec.rb} +14 -14
- data/{test/test_pry_history.rb → spec/pry_history_spec.rb} +15 -0
- data/spec/pry_output_spec.rb +95 -0
- data/{test/test_pry.rb → spec/pry_spec.rb} +74 -32
- data/{test/test_sticky_locals.rb → spec/sticky_locals_spec.rb} +27 -25
- data/{test/test_syntax_checking.rb → spec/syntax_checking_spec.rb} +17 -1
- data/{test/test_wrapped_module.rb → spec/wrapped_module_spec.rb} +92 -5
- metadata +239 -115
- data/examples/example_basic.rb +0 -15
- data/examples/example_command_override.rb +0 -32
- data/examples/example_commands.rb +0 -36
- data/examples/example_hooks.rb +0 -9
- data/examples/example_image_edit.rb +0 -67
- data/examples/example_input.rb +0 -7
- data/examples/example_input2.rb +0 -29
- data/examples/example_output.rb +0 -11
- data/examples/example_print.rb +0 -6
- data/examples/example_prompt.rb +0 -9
- data/examples/helper.rb +0 -6
- data/lib/pry/default_commands/cd.rb +0 -81
- data/lib/pry/default_commands/commands.rb +0 -62
- data/lib/pry/default_commands/context.rb +0 -98
- data/lib/pry/default_commands/easter_eggs.rb +0 -95
- data/lib/pry/default_commands/editing.rb +0 -420
- data/lib/pry/default_commands/find_method.rb +0 -169
- data/lib/pry/default_commands/gems.rb +0 -84
- data/lib/pry/default_commands/gist.rb +0 -187
- data/lib/pry/default_commands/help.rb +0 -127
- data/lib/pry/default_commands/hist.rb +0 -120
- data/lib/pry/default_commands/input_and_output.rb +0 -306
- data/lib/pry/default_commands/introspection.rb +0 -410
- data/lib/pry/default_commands/ls.rb +0 -272
- data/lib/pry/default_commands/misc.rb +0 -38
- data/lib/pry/default_commands/navigating_pry.rb +0 -110
- data/lib/pry/default_commands/whereami.rb +0 -92
- data/lib/pry/extended_commands/experimental.rb +0 -7
- data/test/helper.rb +0 -223
- data/test/test_completion.rb +0 -62
- data/test/test_control_d_handler.rb +0 -45
- data/test/test_default_commands/test_cd.rb +0 -321
- data/test/test_default_commands/test_context.rb +0 -288
- data/test/test_default_commands/test_documentation.rb +0 -315
- data/test/test_default_commands/test_gems.rb +0 -18
- data/test/test_default_commands/test_input.rb +0 -428
- data/test/test_default_commands/test_introspection.rb +0 -511
- data/test/test_default_commands/test_ls.rb +0 -151
- data/test/test_default_commands/test_shell.rb +0 -343
- data/test/test_default_commands/test_show_source.rb +0 -432
- data/test/test_pry_output.rb +0 -41
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,4 +1,64 @@
|
|
1
|
-
|
1
|
+
16/01/2013 version 0.9.11
|
2
|
+
dependency changes:
|
3
|
+
* upgrade the slop gem to version ~> 3.4
|
4
|
+
* new optional dependency: Bond (you'll need to perform `gem install bond`). It enables autocompletion if you use Readline. Does not support work for Editline (more info: https://github.com/pry/pry/wiki/FAQ#wiki-readline). Big thanks to cldwalker.
|
5
|
+
|
6
|
+
new features:
|
7
|
+
* #738 basic Ruby 2.0 support
|
8
|
+
* #732 JRuby 1.7.0+ support
|
9
|
+
* added bond tabcompletion, much more powerful than standard tab
|
10
|
+
completion. However, it requires a real 'readline' to work,
|
11
|
+
so will not work on standard osx setup (since it uses Editline)
|
12
|
+
* show-source can now extract source for classes, methods, procs,
|
13
|
+
pry commands, and arbitrary objects (it shows the source for the class of
|
14
|
+
the object). As a result, show-command is now deprecated
|
15
|
+
* gist/play/save-file now infer object type without requiring flags,
|
16
|
+
e.g play MyClass, play my_file.rb, play my_method
|
17
|
+
* edit command can now edit most things, including: files, methods,
|
18
|
+
classes, commands. As a result the 'edit-method' command is now
|
19
|
+
deprecatd.
|
20
|
+
e.g edit my_file.rb, edit my_method, edit MyClass
|
21
|
+
* removed "edit-method", now merged with 'edit'
|
22
|
+
* amend-line and play now properly indent code added to input buffer.
|
23
|
+
* #674 added support for require switches chaining (`pry -rubygems -r./a.rb`)
|
24
|
+
* #695 added ability to customize the name displayed in the prompt
|
25
|
+
* #716 added `--patch` switch for `edit --ex` command
|
26
|
+
* #736 respect the `$PAGER` environment variable
|
27
|
+
* #497 added `disable-pry` command
|
28
|
+
* removed "show-command" command; use "show-source" command instead
|
29
|
+
* exec switch chaining (`pry -e ':one' -e ':two'`)
|
30
|
+
* added two new hooks: "before_eval" and "after_eval"
|
31
|
+
* added tabcompletion for "show-source", "show-doc" commands and "Array#<tab>" cases
|
32
|
+
* immediately require gems after gem-install
|
33
|
+
* added `-l` switch for `ls` command (displays local variables)
|
34
|
+
* added "gem-open" command
|
35
|
+
* added "fix-indent" command
|
36
|
+
* added subcommands API
|
37
|
+
* exposed the test API for plugin writers (d1489a)
|
38
|
+
* tablifed ls output
|
39
|
+
* added `--no-line-numbers` switch for "whereami" command
|
40
|
+
* added `--lines` switch for "play" command
|
41
|
+
|
42
|
+
bug fixes:
|
43
|
+
* #652 find-method uses single escape instead of double
|
44
|
+
* #657 fixed blank string delimiters
|
45
|
+
* #622 fixed "unwanted 'binding_impl_method' local now exists in scratch bindings"
|
46
|
+
* #645 fixed "edit-method -p changes constant lookup"
|
47
|
+
* #682 fixed ".pryrc" loading twice when invoked from `$HOME` directory
|
48
|
+
* #675 fixed pry not remembering initial "pwd"
|
49
|
+
* #717 fixed multiline object coloring
|
50
|
+
* #719 fixed "show-method" not supporting `String::new` notation
|
51
|
+
* #754 fixed "whereami" command not showing correct line numbers
|
52
|
+
* #751 fixed buggy Cucumber AST output
|
53
|
+
* #787 fixed `while/until do` loops indentation
|
54
|
+
* #526 fixed buggy `--no-plugins` switch of pry
|
55
|
+
* #774 ensure all errors go to the error handler
|
56
|
+
* fixed ".pryrc" loading with wrong `__FILE__`
|
57
|
+
* fixed bug when pager doesn't work if "less" is not available on system
|
58
|
+
* fixed "Control-D" press in nested REPL
|
59
|
+
* many small improvements of unclear error messages and formatting of documentation
|
60
|
+
|
61
|
+
14/07/2012 version 0.9.10
|
2
62
|
dependency changes:
|
3
63
|
* #561 upgrade the slop gem to version 3
|
4
64
|
* #590 move to the jist gem from gist.
|
@@ -14,6 +74,7 @@ new features:
|
|
14
74
|
* allow running a file of pry input with pry <file>
|
15
75
|
* support colours in "ri" command
|
16
76
|
* add before_eval hook
|
77
|
+
* prompt now gets a lot more data when proc arity is 1
|
17
78
|
|
18
79
|
bug fixes &c.
|
19
80
|
* #554 removed the "req" command
|
@@ -29,6 +90,7 @@ bug fixes &c.
|
|
29
90
|
* #620 improve whereami command when not in a binding.pry
|
30
91
|
* #622 support embedded documents (=begin ... =end)
|
31
92
|
* #627 support editing files with spaces in the name
|
93
|
+
* changed __binding_impl__ to __pry__
|
32
94
|
* support for absolute paths in $EDITOR
|
33
95
|
* fix "cat" command on files with unknown extensions
|
34
96
|
* many many internal refactorings and tidyings
|
@@ -419,4 +481,3 @@ complete CHANGELOG:
|
|
419
481
|
* now rescuing SyntaxError as well as Racc::Parser error in valid_expression?
|
420
482
|
8/12/2010 version 0.1.0
|
421
483
|
* release!
|
422
|
-
|
data/CONTRIBUTORS
CHANGED
@@ -1,37 +1,55 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
1068 John Mair
|
2
|
+
372 Conrad Irwin
|
3
|
+
215 Ryan Fitzgerald
|
4
|
+
108 Kyrylo Silin
|
5
|
+
92 Rob Gleeson
|
6
|
+
54 Mon ouïe
|
7
|
+
51 Lee Jarvis
|
8
|
+
47 ☈king
|
9
|
+
40 Jordon Bedwell
|
10
|
+
28 Yorick Peterse
|
9
11
|
18 David Palm
|
12
|
+
18 Robert Gleeson
|
10
13
|
15 epitron
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
12 Andrew Vos
|
15
|
+
11 Reginald Tan
|
16
|
+
10 Matt Carey
|
17
|
+
8 Eero Saynatkari
|
18
|
+
8 Trey Lawrence
|
19
|
+
6 Jason Laster
|
16
20
|
3 misfo
|
17
|
-
|
18
|
-
|
21
|
+
3 fowlmouth
|
22
|
+
3 Darrick Wiebe
|
19
23
|
2 Kelsey Judson
|
24
|
+
2 Ben Langfeld
|
25
|
+
2 Bram Swenson
|
26
|
+
2 Erik Michaels-Ober
|
27
|
+
2 Ingrid
|
28
|
+
2 Vít Ondruch
|
20
29
|
2 Xavier Shay
|
21
|
-
2
|
22
|
-
2
|
23
|
-
|
24
|
-
1
|
30
|
+
2 Jonathan Soeder
|
31
|
+
2 Eric Christopherson
|
32
|
+
2 robgleeson
|
33
|
+
1 Ben Pickles
|
34
|
+
1 Zeh Rizzatti
|
35
|
+
1 shirmung
|
36
|
+
1 sonnym
|
37
|
+
1 Shawn Anderson
|
25
38
|
1 Joe Peduto
|
39
|
+
1 Greg Stearns
|
26
40
|
1 Jonathan Jackson
|
27
|
-
1 Jonathan Soeder
|
28
41
|
1 Jordan Running
|
42
|
+
1 Gosha Arinich
|
29
43
|
1 Josh Cheek
|
30
|
-
1
|
44
|
+
1 Kirill Lashuk
|
45
|
+
1 Gerbert Olivé
|
46
|
+
1 Larry Gilbert
|
31
47
|
1 Lars Haugseth
|
32
|
-
1
|
48
|
+
1 Loic Nageleisen
|
49
|
+
1 Matthew Carey
|
50
|
+
1 Michael Bensoussan
|
33
51
|
1 Renato Mascarenhas
|
34
|
-
1
|
52
|
+
1 Havenwood
|
35
53
|
1 Sherin C
|
36
|
-
1
|
37
|
-
1
|
54
|
+
1 Sonali Sridhar
|
55
|
+
1 Tim Pope
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'guard/guard'
|
2
|
+
|
3
|
+
module ::Guard
|
4
|
+
class Bacon < Guard
|
5
|
+
def run_all
|
6
|
+
system "rake spec"
|
7
|
+
puts
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
def run_on_changes(paths)
|
12
|
+
paths.delete('some_lib')
|
13
|
+
puts "Running: #{paths.join ' '}"
|
14
|
+
if paths.size.zero?
|
15
|
+
warn 'Running all tests'
|
16
|
+
system 'rake recspec'
|
17
|
+
else
|
18
|
+
paths.each do |path|
|
19
|
+
warn "Running #{path}"
|
20
|
+
system "rake spec run=#{path}" or return
|
21
|
+
warn "\e[32;1mNice!!\e[0m Now running all specs, just to be sure."
|
22
|
+
run_all
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
guard 'bacon' do
|
30
|
+
def deduce_spec_from(token)
|
31
|
+
%W(
|
32
|
+
spec/#{token}_spec.rb
|
33
|
+
spec/pry_#{token}_spec.rb
|
34
|
+
spec/commands/#{token}_spec.rb
|
35
|
+
).each do |e|
|
36
|
+
return e if File.exists? e
|
37
|
+
end
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
Dir['lib/pry/**/*.rb'].each do |rb|
|
42
|
+
rb[%r(lib/pry/(.+)\.rb$)]
|
43
|
+
spec_rb = deduce_spec_from($1)
|
44
|
+
if spec_rb
|
45
|
+
# run as 'bundle exec guard -d' to see these.
|
46
|
+
::Guard::UI.debug "'#{rb}' maps to '#{spec_rb}'"
|
47
|
+
else
|
48
|
+
::Guard::UI.debug "No map, so run all for: '#{rb}'"
|
49
|
+
end
|
50
|
+
next unless spec_rb
|
51
|
+
watch(rb) do |m| spec_rb end
|
52
|
+
end
|
53
|
+
|
54
|
+
watch(%r{^lib/.+\.rb$}) do |m|
|
55
|
+
return if deduce_spec_from(m[0])
|
56
|
+
'some_lib'
|
57
|
+
end
|
58
|
+
|
59
|
+
watch(%r{^spec/.+\.rb$}) do |m| m end
|
60
|
+
end
|
61
|
+
|
62
|
+
# vim:ft=ruby
|
data/README.markdown
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
[![Build Status](https://secure.travis-ci.org/pry/pry.png)](http://travis-ci.org/pry/pry)
|
2
2
|
|
3
3
|
<center>
|
4
|
-
![
|
5
|
-
|
6
|
-
(C) John Mair (banisterfiend) 2011<br>
|
4
|
+
![The Pry Logo](https://dl.dropbox.com/u/26521875/pry%20stuff/logo/pry_logo_350.png)
|
7
5
|
|
6
|
+
© John Mair (banisterfiend) 2012<br>
|
8
7
|
|
9
8
|
**Please** [DONATE](http://www.pledgie.com/campaigns/15899) to the Pry project - Pry was a **huge** amount of work and every donation received is encouraging and supports Pry's continued development!
|
10
9
|
|
@@ -13,6 +12,7 @@
|
|
13
12
|
[Atomic Object](http://www.atomicobject.com/)<br/>
|
14
13
|
[Bendyworks](http://bendyworks.com/)<br/>
|
15
14
|
[Intridea](http://intridea.com/)<br/>
|
15
|
+
[Gaslight](http://gaslight.co/home)<br/>
|
16
16
|
|
17
17
|
**Other Resources**
|
18
18
|
|
@@ -395,6 +395,6 @@ Problems or questions? file an issue at [github](https://github.com/pry/pry/issu
|
|
395
395
|
|
396
396
|
### Contributors
|
397
397
|
|
398
|
-
Pry is primarily the work of [John Mair (banisterfiend)](
|
398
|
+
Pry is primarily the work of [John Mair (banisterfiend)](http://github.com/banister), for full list
|
399
399
|
of contributors see the
|
400
400
|
[CONTRIBUTORS](https://github.com/pry/pry/blob/master/CONTRIBUTORS) file.
|
data/Rakefile
CHANGED
@@ -7,26 +7,6 @@ require 'pry/version'
|
|
7
7
|
CLOBBER.include('**/*~', '**/*#*', '**/*.log')
|
8
8
|
CLEAN.include('**/*#*', '**/*#*.*', '**/*_flymake*.*', '**/*_flymake', '**/*.rbc', '**/.#*.*')
|
9
9
|
|
10
|
-
def apply_spec_defaults(s)
|
11
|
-
s.name = 'pry'
|
12
|
-
s.summary = "An IRB alternative and runtime developer console"
|
13
|
-
s.version = Pry::VERSION
|
14
|
-
s.date = Time.now.strftime '%Y-%m-%d'
|
15
|
-
s.authors = ["John Mair (banisterfiend)", "Conrad Irwin"]
|
16
|
-
s.email = ['jrmair@gmail.com', 'conrad.irwin@gmail.com']
|
17
|
-
s.description = s.summary
|
18
|
-
s.homepage = 'http://pry.github.com'
|
19
|
-
s.executables = ['pry']
|
20
|
-
s.files = `git ls-files`.split("\n")
|
21
|
-
s.test_files = `git ls-files -- test/*`.split("\n")
|
22
|
-
s.add_dependency('coderay', '~> 1.0.5')
|
23
|
-
s.add_dependency('slop', ['~> 3.3.1'])
|
24
|
-
s.add_dependency('method_source','~> 0.8')
|
25
|
-
s.add_development_dependency('bacon', '~> 1.1')
|
26
|
-
s.add_development_dependency('open4', '~> 1.3')
|
27
|
-
s.add_development_dependency('rake', '~> 0.9')
|
28
|
-
end
|
29
|
-
|
30
10
|
def check_dependencies
|
31
11
|
require 'bundler'
|
32
12
|
Bundler.definition.missing_specs
|
@@ -41,10 +21,37 @@ end
|
|
41
21
|
desc "Set up and run tests"
|
42
22
|
task :default => [:test]
|
43
23
|
|
24
|
+
unless [].respond_to? :shuffle!
|
25
|
+
class Array
|
26
|
+
def shuffle!
|
27
|
+
# TODO: fill this in if anyone cares
|
28
|
+
self
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def run_specs paths
|
34
|
+
quiet = ENV['VERBOSE'] ? '' : '-q'
|
35
|
+
exec "bacon -Ispec -rubygems #{quiet} #{paths.join ' '}"
|
36
|
+
end
|
37
|
+
|
44
38
|
desc "Run tests"
|
45
39
|
task :test do
|
46
40
|
check_dependencies unless ENV['SKIP_DEP_CHECK']
|
47
|
-
|
41
|
+
paths =
|
42
|
+
if explicit_list = ENV['run']
|
43
|
+
explicit_list.split(',')
|
44
|
+
else
|
45
|
+
Dir['spec/**/*_spec.rb'].shuffle!
|
46
|
+
end
|
47
|
+
run_specs paths
|
48
|
+
end
|
49
|
+
task :spec => :test
|
50
|
+
|
51
|
+
task :recspec do
|
52
|
+
all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse
|
53
|
+
warn "Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc."
|
54
|
+
run_specs all
|
48
55
|
end
|
49
56
|
|
50
57
|
desc "Run pry"
|
@@ -65,12 +72,12 @@ task :profile do
|
|
65
72
|
Pry.start(TOPLEVEL_BINDING, :input => StringIO.new('exit'))
|
66
73
|
end
|
67
74
|
|
68
|
-
|
69
|
-
|
75
|
+
def modify_base_gemspec
|
76
|
+
eval(File.read('pry.gemspec')).tap { |s| yield s }
|
77
|
+
end
|
70
78
|
|
71
79
|
namespace :ruby do
|
72
|
-
spec =
|
73
|
-
apply_spec_defaults(s)
|
80
|
+
spec = modify_base_gemspec do |s|
|
74
81
|
s.platform = Gem::Platform::RUBY
|
75
82
|
end
|
76
83
|
|
@@ -78,17 +85,10 @@ namespace :ruby do
|
|
78
85
|
pkg.need_zip = false
|
79
86
|
pkg.need_tar = false
|
80
87
|
end
|
81
|
-
|
82
|
-
task :gemspec do
|
83
|
-
File.open("#{spec.name}.gemspec", "w") do |f|
|
84
|
-
f << spec.to_ruby
|
85
|
-
end
|
86
|
-
end
|
87
88
|
end
|
88
89
|
|
89
90
|
namespace :jruby do
|
90
|
-
spec =
|
91
|
-
apply_spec_defaults(s)
|
91
|
+
spec = modify_base_gemspec do |s|
|
92
92
|
s.add_dependency('spoon', '~> 0.0')
|
93
93
|
s.platform = 'java'
|
94
94
|
end
|
@@ -102,8 +102,7 @@ end
|
|
102
102
|
|
103
103
|
[:mingw32, :mswin32].each do |v|
|
104
104
|
namespace v do
|
105
|
-
spec =
|
106
|
-
apply_spec_defaults(s)
|
105
|
+
spec = modify_base_gemspec do |s|
|
107
106
|
s.add_dependency('win32console', '~> 1.3')
|
108
107
|
s.platform = "i386-#{v}"
|
109
108
|
end
|
data/lib/pry.rb
CHANGED
@@ -15,6 +15,10 @@ class Pry
|
|
15
15
|
|
16
16
|
# The default print
|
17
17
|
DEFAULT_PRINT = proc do |output, value|
|
18
|
+
output_with_default_format(output, value, :hashrocket => true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.output_with_default_format(output, value, options = {})
|
18
22
|
stringified = begin
|
19
23
|
value.pretty_inspect
|
20
24
|
rescue RescuableException
|
@@ -22,53 +26,65 @@ class Pry
|
|
22
26
|
end
|
23
27
|
|
24
28
|
unless String === stringified
|
25
|
-
# Read the class name off of the singleton class to provide a default
|
29
|
+
# Read the class name off of the singleton class to provide a default
|
30
|
+
# inspect.
|
26
31
|
klass = (class << value; self; end).ancestors.first
|
27
32
|
stringified = "#<#{klass}:0x#{value.__id__.to_s(16)}>"
|
28
33
|
end
|
29
34
|
|
30
35
|
nonce = rand(0x100000000).to_s(16) # whatever
|
31
36
|
|
32
|
-
|
37
|
+
stringified.gsub!(/#</, "%<#{nonce}")
|
38
|
+
# Don't recolorize output with color (for cucumber, looksee, etc.) [Issue #751]
|
39
|
+
colorized = if stringified =~ /\e\[/
|
40
|
+
stringified
|
41
|
+
else
|
42
|
+
Helpers::BaseHelpers.colorize_code(stringified)
|
43
|
+
end
|
33
44
|
|
34
45
|
# avoid colour-leak from CodeRay and any of the users' previous output
|
35
|
-
colorized = colorized.sub(/(\n*)
|
46
|
+
colorized = colorized.sub(/(\n*)\z/, "\e[0m\\1") if Pry.color
|
36
47
|
|
37
|
-
|
48
|
+
result = colorized.gsub(/%<(.*?)#{nonce}/, '#<\1')
|
49
|
+
result = "=> #{result}"if options[:hashrocket]
|
50
|
+
Helpers::BaseHelpers.stagger_output(result, output)
|
38
51
|
end
|
39
52
|
|
40
53
|
# may be convenient when working with enormous objects and
|
41
54
|
# pretty_print is too slow
|
42
55
|
SIMPLE_PRINT = proc do |output, value|
|
43
56
|
begin
|
44
|
-
output.puts
|
57
|
+
output.puts value.inspect
|
45
58
|
rescue RescuableException
|
46
|
-
output.puts "
|
59
|
+
output.puts "unknown"
|
47
60
|
end
|
48
61
|
end
|
49
62
|
|
50
63
|
# useful when playing with truly enormous objects
|
51
64
|
CLIPPED_PRINT = proc do |output, value|
|
52
|
-
output.puts
|
65
|
+
output.puts Pry.view_clip(value)
|
53
66
|
end
|
54
67
|
|
55
68
|
# Will only show the first line of the backtrace
|
56
69
|
DEFAULT_EXCEPTION_HANDLER = proc do |output, exception, _|
|
57
|
-
|
58
|
-
|
70
|
+
if UserError === exception && SyntaxError === exception
|
71
|
+
output.puts "SyntaxError: #{exception.message.sub(/.*syntax error, */m, '')}"
|
72
|
+
else
|
73
|
+
output.puts "#{exception.class}: #{exception.message}"
|
74
|
+
output.puts "from #{exception.backtrace.first}"
|
75
|
+
end
|
59
76
|
end
|
60
77
|
|
61
|
-
|
62
|
-
DEFAULT_EXCEPTION_WHITELIST = [SystemExit, SignalException]
|
78
|
+
DEFAULT_PROMPT_NAME = 'pry'
|
63
79
|
|
64
80
|
# The default prompt; includes the target and nesting level
|
65
81
|
DEFAULT_PROMPT = [
|
66
82
|
proc { |target_self, nest_level, pry|
|
67
|
-
"[#{pry.input_array.size}]
|
83
|
+
"[#{pry.input_array.size}] #{Pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}> "
|
68
84
|
},
|
69
85
|
|
70
86
|
proc { |target_self, nest_level, pry|
|
71
|
-
"[#{pry.input_array.size}]
|
87
|
+
"[#{pry.input_array.size}] #{Pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}* "
|
72
88
|
}
|
73
89
|
]
|
74
90
|
|
@@ -76,8 +92,8 @@ class Pry
|
|
76
92
|
SIMPLE_PROMPT = [proc { ">> " }, proc { " | " }]
|
77
93
|
|
78
94
|
SHELL_PROMPT = [
|
79
|
-
proc { |target_self, _, _| "
|
80
|
-
proc { |target_self, _, _| "
|
95
|
+
proc { |target_self, _, _| "#{Pry.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
|
96
|
+
proc { |target_self, _, _| "#{Pry.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
|
81
97
|
]
|
82
98
|
|
83
99
|
# A prompt that includes the full object path as well as
|
@@ -85,31 +101,30 @@ class Pry
|
|
85
101
|
NAV_PROMPT = [
|
86
102
|
proc do |conf|
|
87
103
|
tree = conf.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
|
88
|
-
"[#{conf.expr_number}] (
|
104
|
+
"[#{conf.expr_number}] (#{Pry.config.prompt_name}) #{tree}: #{conf.nesting_level}> "
|
89
105
|
end,
|
90
106
|
proc do |conf|
|
91
107
|
tree = conf.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
|
92
|
-
"[#{conf.expr_number}] (
|
108
|
+
"[#{conf.expr_number}] (#{ Pry.config.prompt_name}) #{tree}: #{conf.nesting_level}* "
|
93
109
|
end,
|
94
110
|
]
|
95
111
|
|
96
|
-
# Deal with the ^D key being pressed
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# 3) In a nested session - behave like `cd ..` (pop a binding)
|
112
|
+
# Deal with the ^D key being pressed. Different behaviour in different cases:
|
113
|
+
# 1. In an expression behave like `!` command.
|
114
|
+
# 2. At top-level session behave like `exit` command.
|
115
|
+
# 3. In a nested session behave like `cd ..`.
|
101
116
|
DEFAULT_CONTROL_D_HANDLER = proc do |eval_string, _pry_|
|
102
117
|
if !eval_string.empty?
|
103
|
-
# Clear input buffer.
|
104
|
-
eval_string.replace("")
|
118
|
+
eval_string.replace('') # Clear input buffer.
|
105
119
|
elsif _pry_.binding_stack.one?
|
106
|
-
# ^D at top-level breaks out of a REPL loop.
|
107
120
|
_pry_.binding_stack.clear
|
108
121
|
throw(:breakout)
|
109
122
|
else
|
110
|
-
#
|
111
|
-
|
112
|
-
|
123
|
+
# Store the entire binding stack before popping. Useful for `cd -`.
|
124
|
+
if _pry_.command_state['cd'].nil?
|
125
|
+
_pry_.command_state['cd'] = OpenStruct.new
|
126
|
+
end
|
127
|
+
_pry_.command_state['cd'].old_stack = _pry_.binding_stack.dup
|
113
128
|
_pry_.binding_stack.pop
|
114
129
|
end
|
115
130
|
end
|
@@ -120,6 +135,10 @@ class Pry
|
|
120
135
|
end
|
121
136
|
end
|
122
137
|
|
138
|
+
# Store the current working directory. This allows show-source etc. to work if
|
139
|
+
# your process has changed directory since boot. [Issue #675]
|
140
|
+
INITIAL_PWD = Dir.pwd
|
141
|
+
|
123
142
|
# As a REPL, we often want to catch any unexpected exceptions that may have
|
124
143
|
# been raised; however we don't want to go overboard and prevent the user
|
125
144
|
# from exiting Pry when they want to.
|
@@ -141,10 +160,34 @@ class Pry
|
|
141
160
|
end
|
142
161
|
end
|
143
162
|
|
163
|
+
# An Exception Tag (cf. Exceptional Ruby) that instructs Pry to show the error in
|
164
|
+
# a more user-friendly manner. This should be used when the exception happens within
|
165
|
+
# Pry itself as a direct consequence of the user typing something wrong.
|
166
|
+
#
|
167
|
+
# This allows us to distinguish between the user typing:
|
168
|
+
#
|
169
|
+
# pry(main)> def )
|
170
|
+
# SyntaxError: unexpected )
|
171
|
+
#
|
172
|
+
# pry(main)> method_that_evals("def )")
|
173
|
+
# SyntaxError: (eval):1: syntax error, unexpected ')'
|
174
|
+
# from ./a.rb:2 in `eval'
|
175
|
+
module UserError; end
|
176
|
+
|
177
|
+
# Catches SecurityErrors if $SAFE is set
|
178
|
+
module TooSafeException
|
179
|
+
def self.===(exception)
|
180
|
+
$SAFE > 0 && SecurityError === exception
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Don't catch these exceptions
|
185
|
+
DEFAULT_EXCEPTION_WHITELIST = [SystemExit, SignalException, Pry::TooSafeException]
|
186
|
+
|
144
187
|
# CommandErrors are caught by the REPL loop and displayed to the user. They
|
145
188
|
# indicate an exceptional condition that's fatal to the current command.
|
146
189
|
class CommandError < StandardError; end
|
147
|
-
class
|
190
|
+
class MethodNotFound < CommandError; end
|
148
191
|
|
149
192
|
# indicates obsolete API
|
150
193
|
class ObsoleteError < StandardError; end
|
@@ -162,13 +205,13 @@ if Pry::Helpers::BaseHelpers.mri_18?
|
|
162
205
|
end
|
163
206
|
end
|
164
207
|
|
165
|
-
require
|
208
|
+
require 'method_source'
|
166
209
|
require 'shellwords'
|
167
|
-
require
|
168
|
-
require
|
169
|
-
require
|
170
|
-
require
|
171
|
-
require
|
210
|
+
require 'stringio'
|
211
|
+
require 'coderay'
|
212
|
+
require 'slop'
|
213
|
+
require 'rbconfig'
|
214
|
+
require 'tempfile'
|
172
215
|
|
173
216
|
begin
|
174
217
|
require 'readline'
|
@@ -197,22 +240,32 @@ if Pry::Helpers::BaseHelpers.windows? && !Pry::Helpers::BaseHelpers.windows_ansi
|
|
197
240
|
end
|
198
241
|
end
|
199
242
|
|
200
|
-
|
201
|
-
require
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
require
|
206
|
-
require
|
207
|
-
require
|
208
|
-
require
|
209
|
-
require
|
210
|
-
require
|
211
|
-
require
|
212
|
-
require
|
213
|
-
require
|
214
|
-
require
|
215
|
-
require
|
216
|
-
require
|
217
|
-
require
|
218
|
-
require
|
243
|
+
begin
|
244
|
+
require 'bond'
|
245
|
+
rescue LoadError
|
246
|
+
end
|
247
|
+
|
248
|
+
require 'pry/version'
|
249
|
+
require 'pry/rbx_method'
|
250
|
+
require 'pry/rbx_path'
|
251
|
+
require 'pry/code'
|
252
|
+
require 'pry/history_array'
|
253
|
+
require 'pry/helpers'
|
254
|
+
require 'pry/code_object'
|
255
|
+
require 'pry/method'
|
256
|
+
require 'pry/wrapped_module'
|
257
|
+
require 'pry/history'
|
258
|
+
require 'pry/command'
|
259
|
+
require 'pry/command_set'
|
260
|
+
require 'pry/commands'
|
261
|
+
require 'pry/custom_completions'
|
262
|
+
require 'pry/completion'
|
263
|
+
require 'pry/plugins'
|
264
|
+
require 'pry/core_extensions'
|
265
|
+
require 'pry/pry_class'
|
266
|
+
require 'pry/pry_instance'
|
267
|
+
require 'pry/cli'
|
268
|
+
require 'pry/pager'
|
269
|
+
require 'pry/terminal_info'
|
270
|
+
require 'pry/editor'
|
271
|
+
require 'pry/rubygem'
|