pry 0.11.3 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +139 -1
  3. data/LICENSE +1 -1
  4. data/README.md +13 -30
  5. data/bin/pry +0 -4
  6. data/lib/pry.rb +17 -47
  7. data/lib/pry/cli.rb +17 -24
  8. data/lib/pry/code.rb +6 -6
  9. data/lib/pry/code/code_file.rb +5 -4
  10. data/lib/pry/code/code_range.rb +3 -3
  11. data/lib/pry/code/loc.rb +14 -8
  12. data/lib/pry/code_object.rb +4 -4
  13. data/lib/pry/color_printer.rb +1 -0
  14. data/lib/pry/command.rb +36 -29
  15. data/lib/pry/command_set.rb +17 -52
  16. data/lib/pry/commands/amend_line.rb +3 -4
  17. data/lib/pry/commands/bang.rb +1 -1
  18. data/lib/pry/commands/cat.rb +7 -6
  19. data/lib/pry/commands/cat/exception_formatter.rb +9 -8
  20. data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
  21. data/lib/pry/commands/change_prompt.rb +29 -9
  22. data/lib/pry/commands/clear_screen.rb +14 -0
  23. data/lib/pry/commands/code_collector.rb +9 -9
  24. data/lib/pry/commands/easter_eggs.rb +3 -3
  25. data/lib/pry/commands/edit.rb +8 -7
  26. data/lib/pry/commands/exit.rb +2 -1
  27. data/lib/pry/commands/find_method.rb +11 -13
  28. data/lib/pry/commands/gem_cd.rb +1 -1
  29. data/lib/pry/commands/gem_install.rb +2 -2
  30. data/lib/pry/commands/gem_list.rb +2 -2
  31. data/lib/pry/commands/gem_open.rb +1 -1
  32. data/lib/pry/commands/gem_search.rb +2 -2
  33. data/lib/pry/commands/gem_stats.rb +83 -0
  34. data/lib/pry/commands/gist.rb +7 -6
  35. data/lib/pry/commands/help.rb +3 -3
  36. data/lib/pry/commands/hist.rb +9 -8
  37. data/lib/pry/commands/import_set.rb +2 -1
  38. data/lib/pry/commands/install_command.rb +7 -6
  39. data/lib/pry/commands/list_inspectors.rb +2 -2
  40. data/lib/pry/commands/ls.rb +27 -30
  41. data/lib/pry/commands/ls/constants.rb +4 -4
  42. data/lib/pry/commands/ls/formatter.rb +3 -2
  43. data/lib/pry/commands/ls/globals.rb +0 -2
  44. data/lib/pry/commands/ls/grep.rb +0 -2
  45. data/lib/pry/commands/ls/instance_vars.rb +0 -1
  46. data/lib/pry/commands/ls/local_names.rb +0 -2
  47. data/lib/pry/commands/ls/local_vars.rb +0 -2
  48. data/lib/pry/commands/ls/ls_entity.rb +0 -1
  49. data/lib/pry/commands/ls/methods.rb +0 -3
  50. data/lib/pry/commands/ls/methods_helper.rb +1 -1
  51. data/lib/pry/commands/ls/self_methods.rb +0 -1
  52. data/lib/pry/commands/play.rb +1 -2
  53. data/lib/pry/commands/pry_backtrace.rb +1 -1
  54. data/lib/pry/commands/raise_up.rb +2 -1
  55. data/lib/pry/commands/ri.rb +5 -4
  56. data/lib/pry/commands/shell_command.rb +3 -2
  57. data/lib/pry/commands/shell_mode.rb +6 -6
  58. data/lib/pry/commands/show_doc.rb +5 -7
  59. data/lib/pry/commands/show_info.rb +25 -18
  60. data/lib/pry/commands/show_source.rb +5 -2
  61. data/lib/pry/commands/stat.rb +1 -1
  62. data/lib/pry/commands/watch_expression.rb +9 -7
  63. data/lib/pry/commands/whereami.rb +4 -4
  64. data/lib/pry/commands/wtf.rb +15 -2
  65. data/lib/pry/config.rb +33 -9
  66. data/lib/pry/config/behavior.rb +229 -205
  67. data/lib/pry/config/convenience.rb +24 -21
  68. data/lib/pry/config/default.rb +153 -143
  69. data/lib/pry/config/memoization.rb +41 -37
  70. data/lib/pry/core_extensions.rb +4 -3
  71. data/lib/pry/editor.rb +5 -12
  72. data/lib/pry/exceptions.rb +0 -2
  73. data/lib/pry/helpers.rb +1 -0
  74. data/lib/pry/helpers/base_helpers.rb +133 -4
  75. data/lib/pry/helpers/command_helpers.rb +5 -4
  76. data/lib/pry/helpers/documentation_helpers.rb +2 -2
  77. data/lib/pry/helpers/options_helpers.rb +5 -5
  78. data/lib/pry/helpers/platform.rb +58 -0
  79. data/lib/pry/helpers/table.rb +20 -15
  80. data/lib/pry/helpers/text.rb +3 -4
  81. data/lib/pry/history.rb +21 -8
  82. data/lib/pry/hooks.rb +3 -3
  83. data/lib/pry/indent.rb +15 -17
  84. data/lib/pry/input_completer.rb +12 -7
  85. data/lib/pry/input_lock.rb +0 -2
  86. data/lib/pry/last_exception.rb +1 -1
  87. data/lib/pry/method.rb +37 -31
  88. data/lib/pry/method/disowned.rb +2 -1
  89. data/lib/pry/method/patcher.rb +2 -2
  90. data/lib/pry/method/weird_method_locator.rb +7 -8
  91. data/lib/pry/object_path.rb +5 -4
  92. data/lib/pry/output.rb +3 -2
  93. data/lib/pry/pager.rb +4 -3
  94. data/lib/pry/platform.rb +79 -81
  95. data/lib/pry/plugins.rb +7 -3
  96. data/lib/pry/prompt.rb +144 -25
  97. data/lib/pry/pry_class.rb +53 -29
  98. data/lib/pry/pry_instance.rb +88 -55
  99. data/lib/pry/repl.rb +33 -4
  100. data/lib/pry/repl_file_loader.rb +1 -2
  101. data/lib/pry/ring.rb +84 -0
  102. data/lib/pry/rubygem.rb +6 -6
  103. data/lib/pry/slop.rb +17 -17
  104. data/lib/pry/slop/commands.rb +3 -4
  105. data/lib/pry/slop/option.rb +19 -21
  106. data/lib/pry/terminal.rb +2 -1
  107. data/lib/pry/testable/mockable.rb +2 -2
  108. data/lib/pry/testable/pry_tester.rb +1 -1
  109. data/lib/pry/testable/utility.rb +2 -2
  110. data/lib/pry/testable/variables.rb +1 -1
  111. data/lib/pry/version.rb +1 -1
  112. data/lib/pry/wrapped_module.rb +15 -15
  113. data/lib/pry/wrapped_module/candidate.rb +2 -2
  114. metadata +17 -29
  115. data/lib/pry/commands/list_prompts.rb +0 -35
  116. data/lib/pry/commands/simple_prompt.rb +0 -22
  117. data/lib/pry/history_array.rb +0 -121
  118. data/lib/pry/rbx_path.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2b64fffecceb1735b3224542dddf8210a4eea3ea
4
- data.tar.gz: 00453f4390dc9d7d31a5a0215823f2f57929b097
2
+ SHA256:
3
+ metadata.gz: d07ef96499f7a86674cffc2a3716d4d922c33046c0134585292915b27af11f70
4
+ data.tar.gz: 544a3c577b01fc131ee3ab5c6a85dd89594675de8a4019a536a98afd29ee71a8
5
5
  SHA512:
6
- metadata.gz: 9fa428d4b7e63c0260dfd1082de23e978adc52461fb1123e415baed4101171a664ba7928511acbfe17d9aa034002f0e5f61645de6fa7cba036be1b87fd05525b
7
- data.tar.gz: 91ca93bd5bd1948952ddb11bccc0ab03e1f792e7025f3ff77461c89801993f5141c1e5fbe85e123308b2d19c8ec86daf662c4e419b3bfef571d54f044e729758
6
+ metadata.gz: 0510a99ee011dd860352f7fdc7c7c5cd721fa44b2b72d7f2c354fc90af53a481ec53e1a6fc29a01fdf81f8130b756977c7d3dd885cc34418416d81f4ae7244e8
7
+ data.tar.gz: a8622184f84e20196899c1629c4f45733ed57416d2cb104345099fb64842d92eb105de264627f203b047816328e1201d94b6dd876719d3dc82ab49eba5f22e5b
@@ -1,5 +1,140 @@
1
1
  ### HEAD
2
2
 
3
+ ### [v0.12.0][v0.12.0] (November 5, 2018)
4
+
5
+ #### Major changes
6
+
7
+ * Dropped support for Rubinius ([#1785](https://github.com/pry/pry/pull/1785))
8
+
9
+ #### Features
10
+
11
+ * Added a new command, `clear-screen`, that clears the content of the screen Pry
12
+ is running in regardless of platform (Windows or UNIX-like)
13
+ ([#1723](https://github.com/pry/pry/pull/1723))
14
+ * Added a new command, `gem-stat`, that prints gem statistics such as gem
15
+ dependencies and downloads ([#1707](https://github.com/pry/pry/pull/1707))
16
+ * Added support for nested exceptions for the `wtf` command
17
+ ([#1791](https://github.com/pry/pry/pull/1791))
18
+ * Added support for dynamic prompt names
19
+ ([#1833](https://github.com/pry/pry/pull/1833))
20
+
21
+ ```rb
22
+ # pryrc
23
+ Pry.config.prompt_name = Pry.lazy { rand(100) }
24
+
25
+ # Session
26
+ [1] 80(main)>
27
+ [2] 87(main)>
28
+ [3] 30(main)>
29
+ ```
30
+ * Added support for XDG Base Directory Specification
31
+ ([#1609](https://github.com/pry/pry/pull/1609),
32
+ [#1844](https://github.com/pry/pry/pull/1844),
33
+ ([#1848](https://github.com/pry/pry/pull/1848)))
34
+ * Removed the `simple-prompt`. Use `change-prompt simple` instead. The
35
+ `list-prompt` command was removed and embedded as `change-prompt --list`
36
+ ([#1849](https://github.com/pry/pry/pull/1849))
37
+
38
+ #### API changes
39
+
40
+ * The following methods started accepting the new optional `config` parameter
41
+ ([#1809](https://github.com/pry/pry/pull/1809)):
42
+ * `Pry::Helpers.tablify(things, line_length, config = Pry.config)`
43
+ * `Pry::Helpers.tablify_or_one_line(heading, things, config = Pry.config)`
44
+ * `Pry::Helpers.tablify_to_screen_width(things, options, config = Pry.config)`
45
+ * `Pry::Helpers::Table.new(items, args, config = Pry.config)`
46
+
47
+ You are expected to pass a session-local `_pry_.config` instead of the global
48
+ one.
49
+
50
+ * Added new method `Pry::Config.assign`, for creating a Config non-recursively
51
+ ([#1725](https://github.com/pry/pry/issues/1725))
52
+ * Added `Pry.lazy`, which is a helper method for values that need to be
53
+ calculated dynamically. Currently, only `config.prompt_name` supports it
54
+ ([#1833](https://github.com/pry/pry/pull/1833))
55
+ * `Pry::Prompt` responds to `.[]`, `.all` & `.add` now. The `Pry::Prompt.add`
56
+ method must be used for implementing custom prompts. See the API in the
57
+ documentation for the class ([#1846](https://github.com/pry/pry/pull/1846))
58
+
59
+ #### Breaking changes
60
+
61
+ * Deleted the `Pry::Helpers::Text.bright_default` alias for
62
+ `Pry::Helpers::Text.bold` ([#1795](https://github.com/pry/pry/pull/1795))
63
+ * `Pry::Helpers.tablify_to_screen_width(things, options, config = Pry.config)`
64
+ requires `options` or `nil` in place of them.
65
+ * `Pry::Helpers::Table.new(items, args, config = Pry.config)` requires `args`
66
+ or `nil` in place of them.
67
+ * Completely revamped `Pry::HistoryArray`
68
+ ([#1818](https://github.com/pry/pry/pull/1818)).
69
+ * It's been renamed to `Pry::Ring`
70
+ ([#1817](https://github.com/pry/pry/pull/1817))
71
+ * The implementation has changed and as result, the following methods were
72
+ removed:
73
+ * `Pry::Ring#length` (use `Pry::Ring#count` instead)
74
+ * `#empty?`, `#each`, `#inspect`, `#pop!`, `#to_h`
75
+ * To access old Enumerable methods convert the ring to Array with `#to_a`
76
+ * Fixed indexing for elements (e.g. `_pry_.input_ring[0]` always return some
77
+ element and not `nil`)
78
+ * Renamed `Pry.config.prompt_safe_objects` to `Pry.config.prompt_safe_contexts`
79
+ * Removed deprecated `Pry::CommandSet#before_command` &
80
+ `Pry::CommandSet#after_command` ([#1838](https://github.com/pry/pry/pull/1838))
81
+
82
+ #### Deprecations
83
+
84
+ * Deprecated `_pry_.input_array` & `_pry_.output_array` in favour of
85
+ `_pry_.input_ring` & `_pry_.output_ring` respectively
86
+ ([#1814](https://github.com/pry/pry/pull/1814))
87
+ * Deprecated `Pry::Command#text`. Please use `#black`, `#white`, etc. directly
88
+ instead (as you would with helper functions from `BaseHelpers` and
89
+ `CommandHelpers`) ([#1701](https://github.com/pry/pry/pull/1701))
90
+ * Deprecated `_pry_.input_array` & `_pry_.output_array` in favour of
91
+ `_pry_.input_ring` and `_pry_.output_ring` respectively
92
+ ([#1817](https://github.com/pry/pry/pull/1817))
93
+ * Deprecated `Pry::Platform`. Use `Pry::Helpers::Platform` instead. Note that
94
+ `Pry::Helpers::BaseHelpers` still includes the `Platform` methods but emits a
95
+ warning. You must switch to `Pry::Helpers::Platform` in your code
96
+ ([#1838](https://github.com/pry/pry/pull/1838),
97
+ ([#1845](https://github.com/pry/pry/pull/1845)))
98
+ * Deprecated `Pry::Prompt::MAP`. You should use `Pry::Prompt.all` instead to
99
+ access the same map ([#1846](https://github.com/pry/pry/pull/1846))
100
+
101
+ #### Bug fixes
102
+
103
+ * Fixed a bug where `cd Hash.new` reported `self` as an instance of Pry::Config
104
+ in the prompt ([#1725](https://github.com/pry/pry/pull/1725))
105
+ * Silenced the `Could not find files for the given pattern(s)` error message
106
+ coming from `where` on Windows, when `less` or another pager is not installed
107
+ ([#1767](https://github.com/pry/pry/pull/1767))
108
+ * Fixed possible double loading of Pry plugins' `cli.rb` on Ruby (>= 2.4) due to
109
+ [the `realpath` changes while invoking
110
+ `require`](https://bugs.ruby-lang.org/issues/10222)
111
+ ([#1762](https://github.com/pry/pry/pull/1762),
112
+ [#1774](https://github.com/pry/pry/pull/1762))
113
+ * Fixed `NoMethodError` on code objects that have a comment but no source when
114
+ invoking `show-source` ([#1779](https://github.com/pry/pry/pull/1779))
115
+ * Fixed `negative argument (ArgumentError)` upon pasting code with tabs, which
116
+ used to confuse automatic indentation
117
+ ([#1771](https://github.com/pry/pry/pull/1771))
118
+ * Fixed Pry not being able to load history on Ruby 2.4.4+ when it contains the
119
+ null character ([#1789](https://github.com/pry/pry/pull/1789))
120
+ * Fixed Pry raising errors on `cd`'ing into some objects that redefine
121
+ `method_missing` and `respond_to?`
122
+ ([#1811](https://github.com/pry/pry/pull/1811))
123
+ * Fixed bug when indentation leaves parts of input after pressing enter when
124
+ Readline is enabled with mode indicators for vi mode
125
+ ([#1813](https://github.com/pry/pry/pull/1813),
126
+ [#1820](https://github.com/pry/pry/pull/1820),
127
+ [#1825](https://github.com/pry/pry/pull/1825))
128
+ * Fixed `edit` not writing to history
129
+ ([#1749](https://github.com/pry/pry/issues/1749))
130
+
131
+ #### Other changes
132
+
133
+ * Deprecated the `Data` constant to match Ruby 2.5 in the `ls` command
134
+ ([#1731](https://github.com/pry/pry/pull/1731))
135
+
136
+ ### 0.11.3
137
+
3
138
  #### Features
4
139
 
5
140
  * Add Pry::Testable, an improved modular replacement for PryTestHelpers.
@@ -25,7 +160,7 @@ See pull request [#1673](https://github.com/pry/pry/pull/1673).
25
160
  that users of the [Hanami](http://hanamirb.org/) web framework experienced and
26
161
  reported since 2015.
27
162
 
28
- See pull request [#1639](https://github.com/pry/pry/pull/1689).
163
+ See pull request [#1689](https://github.com/pry/pry/pull/1689).
29
164
 
30
165
  * Fix a bug where Method objects were not returned for setters inherited
31
166
  from a default (Pry::Config::Default). Eg, this is no longer an error:
@@ -44,6 +179,7 @@ See pull request [#1691](https://github.com/pry/pry/pull/1691).
44
179
 
45
180
  See pull request [#1674](https://github.com/pry/pry/pull/1674).
46
181
 
182
+
47
183
  ### 0.11.0
48
184
 
49
185
  * Add alias 'whereami[?!]+' for 'whereami' command. ([#1597](https://github.com/pry/pry/pull/1597))
@@ -795,3 +931,5 @@ complete CHANGELOG:
795
931
 
796
932
  ### 0.1.0 (2010/12/8)
797
933
  * release!
934
+
935
+ [v0.12.0]: https://github.com/pry/pry/releases/tag/v0.12.0
data/LICENSE CHANGED
@@ -3,7 +3,7 @@ License
3
3
 
4
4
  (The MIT License)
5
5
 
6
- Copyright (c) 2016 John Mair (banisterfiend)
6
+ Copyright (c) 2018 The Pry Team
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining
9
9
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,20 +1,10 @@
1
- [![Build Status](https://img.shields.io/travis/pry/pry.svg)](https://travis-ci.org/pry/pry)
2
- [![Code Climate](https://img.shields.io/codeclimate/github/pry/pry.svg)](https://codeclimate.com/github/pry/pry)
3
- [![Inline docs](http://inch-ci.org/github/pry/pry.svg?style=shields)](http://inch-ci.org/github/pry/pry)
1
+ [![Circle Build Status](https://circleci.com/gh/pry/pry.svg?style=shield)](https://circleci.com/gh/pry/pry)
2
+ [![Code Climate](https://codeclimate.com/github/pry/pry.svg)](https://codeclimate.com/github/pry/pry)
3
+ [![Gem Version](https://badge.fury.io/rb/pry.svg)](http://badge.fury.io/rb/pry)
4
+ [![Documentation Status](http://inch-ci.org/github/pry/pry.svg?branch=master)](http://inch-ci.org/github/pry/pry)
5
+ [![Downloads](https://img.shields.io/gem/dt/pry.svg?style=flat)](https://rubygems.org/gems/pry)
4
6
  <br><br>
5
- ![logo for Pry](https://dl.dropbox.com/u/26521875/pry%20stuff/logo/pry_logo_350.png)
6
-
7
- © John Mair ([banisterfiend](https://twitter.com/banisterfiend)) 2016<br>
8
-
9
- **Please** [DONATE](http://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
-
11
- **Sponsors**
12
-
13
- [Launch School](https://launchschool.com)<br/>
14
- [Atomic Object](https://atomicobject.com/)<br/>
15
- [Hashrocket](https://hashrocket.com/)<br/>
16
- [Intridea](http://www.intridea.com)<br/>
17
- [Gaslight](https://teamgaslight.com)<br/>
7
+ ![logo for Pry](https://www.dropbox.com/s/zp8o63kquby2rln/pry_logo_350.png?raw=1)
18
8
 
19
9
  **Other Resources**
20
10
 
@@ -52,10 +42,10 @@ is trivial to set it to read from any object that has a `readline` method and wr
52
42
  `puts` method - many other aspects of Pry are also configurable making
53
43
  it a good choice for implementing custom shells.
54
44
 
55
- Pry comes with an executable so it can be invoked at the command line.
56
- Just enter `pry` to start. A `.pryrc` file in the user's home directory will
57
- be loaded if it exists. Type `pry --help` at the command line for more
58
- information.
45
+ Pry comes with an executable so it can be invoked at the command line. Just
46
+ enter `pry` to start. A `pryrc` file in `$XDG_CONFIG_HOME/pry/` or the user's
47
+ home directory will be loaded if it exists. Type `pry --help` at the command
48
+ line for more information.
59
49
 
60
50
  Try `gem install pry-doc` for additional documentation on Ruby Core
61
51
  methods. The additional docs are accessed through the `show-doc` and
@@ -180,9 +170,8 @@ present working directory into the Pry prompt and bring in (limited at this stag
180
170
  We can also interpolate Ruby code directly into the shell by
181
171
  using the normal `#{}` string interpolation syntax.
182
172
 
183
- In the code below we're going to switch to `shell-mode` and edit the
184
- `.pryrc` file in the home directory. We'll then cat its contents and
185
- reload the file.
173
+ In the code below we're going to switch to `shell-mode` and edit the `pryrc`
174
+ file. We'll then cat its contents and reload the file.
186
175
 
187
176
  pry(main)> shell-mode
188
177
  pry main:/home/john/ruby/projects/pry $ .cd ~
@@ -383,7 +372,7 @@ gem.
383
372
 
384
373
  You can toggle the syntax highlighting on and off in a session by
385
374
  using the `toggle-color` command. Alternatively, you can turn it off
386
- permanently by putting the line `Pry.color = false` in your `~/.pryrc`
375
+ permanently by putting the line `Pry.color = false` in your `pryrc`
387
376
  file.
388
377
 
389
378
  ### Future Directions
@@ -399,9 +388,3 @@ between commands and running commands in background
399
388
  ### Contact
400
389
 
401
390
  Problems or questions? File an issue at [GitHub](https://github.com/pry/pry/issues).
402
-
403
- ### Contributors
404
-
405
- Pry is primarily the work of [John Mair (banisterfiend)](https://github.com/banister), for full list
406
- of contributors see the
407
- [CONTRIBUTORS](https://github.com/pry/pry/blob/master/CONTRIBUTORS) file.
data/bin/pry CHANGED
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- # (C) John Mair (banisterfiend)
4
- # MIT license
5
-
6
2
  $0 = 'pry'
7
3
 
8
4
  require 'pry'
data/lib/pry.rb CHANGED
@@ -1,6 +1,3 @@
1
- # (C) John Mair (banisterfiend) 2016
2
- # MIT License
3
- #
4
1
  require 'pp'
5
2
  require 'pry/forwardable'
6
3
  require 'pry/input_lock'
@@ -13,6 +10,7 @@ class Pry
13
10
  # The default hooks - display messages when beginning and ending Pry sessions.
14
11
  DEFAULT_HOOKS = Pry::Hooks.new.add_hook(:before_session, :default) do |out, target, _pry_|
15
12
  next if _pry_.quiet?
13
+
16
14
  _pry_.run_command("whereami --quiet")
17
15
  end
18
16
 
@@ -46,47 +44,18 @@ class Pry
46
44
  else
47
45
  output.puts "#{exception.class}: #{exception.message}"
48
46
  output.puts "from #{exception.backtrace.first}"
47
+
48
+ if exception.respond_to? :cause
49
+ cause = exception.cause
50
+ while cause
51
+ output.puts "Caused by #{cause.class}: #{cause}\n"
52
+ output.puts "from #{cause.backtrace.first}"
53
+ cause = cause.cause
54
+ end
55
+ end
49
56
  end
50
57
  end
51
58
 
52
- DEFAULT_PROMPT_NAME = 'pry'
53
-
54
- # The default prompt; includes the target and nesting level
55
- DEFAULT_PROMPT = [
56
- proc { |target_self, nest_level, pry|
57
- "[#{pry.input_array.size}] #{pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}> "
58
- },
59
-
60
- proc { |target_self, nest_level, pry|
61
- "[#{pry.input_array.size}] #{pry.config.prompt_name}(#{Pry.view_clip(target_self)})#{":#{nest_level}" unless nest_level.zero?}* "
62
- }
63
- ]
64
-
65
- DEFAULT_PROMPT_SAFE_OBJECTS = [String, Numeric, Symbol, nil, true, false]
66
-
67
- # A simple prompt - doesn't display target or nesting level
68
- SIMPLE_PROMPT = [proc { ">> " }, proc { " | " }]
69
-
70
- NO_PROMPT = [proc { '' }, proc { '' }]
71
-
72
- SHELL_PROMPT = [
73
- proc { |target_self, _, _pry_| "#{_pry_.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
74
- proc { |target_self, _, _pry_| "#{_pry_.config.prompt_name} #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
75
- ]
76
-
77
- # A prompt that includes the full object path as well as
78
- # input/output (_in_ and _out_) information. Good for navigation.
79
- NAV_PROMPT = [
80
- proc do |_, _, _pry_|
81
- tree = _pry_.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
82
- "[#{_pry_.input_array.count}] (#{_pry_.config.prompt_name}) #{tree}: #{_pry_.binding_stack.size - 1}> "
83
- end,
84
- proc do |_, _, _pry_|
85
- tree = _pry_.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
86
- "[#{_pry_.input_array.count}] (#{ _pry_.config.prompt_name}) #{tree}: #{_pry_.binding_stack.size - 1}* "
87
- end,
88
- ]
89
-
90
59
  # Deal with the ^D key being pressed. Different behaviour in different cases:
91
60
  # 1. In an expression behave like `!` command.
92
61
  # 2. At top-level session behave like `exit` command.
@@ -112,10 +81,6 @@ class Pry
112
81
  end
113
82
  end
114
83
 
115
- # Store the current working directory. This allows show-source etc. to work if
116
- # your process has changed directory since boot. [Issue #675]
117
- INITIAL_PWD = Dir.pwd
118
-
119
84
  # This is to keep from breaking under Rails 3.2 for people who are doing that
120
85
  # IRB = Pry thing.
121
86
  module ExtendCommandBundle; end
@@ -133,9 +98,8 @@ require 'pathname'
133
98
 
134
99
  require 'pry/version'
135
100
  require 'pry/repl'
136
- require 'pry/rbx_path'
137
101
  require 'pry/code'
138
- require 'pry/history_array'
102
+ require 'pry/ring'
139
103
  require 'pry/helpers'
140
104
  require 'pry/code_object'
141
105
  require 'pry/method'
@@ -146,6 +110,12 @@ require 'pry/command_set'
146
110
  require 'pry/commands'
147
111
  require 'pry/plugins'
148
112
  require 'pry/core_extensions'
113
+ require 'pry/basic_object'
114
+ require 'pry/config/behavior'
115
+ require 'pry/config/memoization'
116
+ require 'pry/config/default'
117
+ require 'pry/config/convenience'
118
+ require 'pry/config'
149
119
  require 'pry/pry_class'
150
120
  require 'pry/pry_instance'
151
121
  require 'pry/cli'
@@ -1,12 +1,9 @@
1
1
  class Pry
2
-
3
2
  # Manage the processing of command line options
4
3
  class CLI
5
-
6
4
  NoOptionsError = Class.new(StandardError)
7
5
 
8
6
  class << self
9
-
10
7
  # @return [Proc] The Proc defining the valid command line options.
11
8
  attr_accessor :options
12
9
 
@@ -57,22 +54,19 @@ class Pry
57
54
  self.option_processors = nil
58
55
  end
59
56
 
60
- def parse_options(args=ARGV)
57
+ def parse_options(args = ARGV)
61
58
  unless options
62
59
  raise NoOptionsError, "No command line options defined! Use Pry::CLI.add_options to add command line options."
63
60
  end
64
61
 
65
- # Load config files etc first, ensuring that cli options will take precedence.
66
- Pry.initial_session_setup
67
-
68
62
  self.input_args = args
69
63
 
70
64
  begin
71
65
  opts = Pry::Slop.parse!(
72
66
  args,
73
- :help => true,
74
- :multiple_switches => false,
75
- :strict => true,
67
+ help: true,
68
+ multiple_switches: false,
69
+ strict: true,
76
70
  &options
77
71
  )
78
72
  rescue Pry::Slop::InvalidOptionError
@@ -81,6 +75,7 @@ class Pry
81
75
  exit
82
76
  end
83
77
 
78
+ Pry.initial_session_setup
84
79
  Pry.final_session_setup
85
80
 
86
81
  # Option processors are optional.
@@ -113,16 +108,14 @@ class Pry
113
108
  end
114
109
 
115
110
  # Start the session (running any code passed with -e, if there is any)
116
- Pry.start(context, :input => StringIO.new(Pry.config.exec_string))
111
+ Pry.start(context, input: StringIO.new(Pry.config.exec_string))
117
112
  end
118
-
119
113
  end
120
114
 
121
115
  reset
122
116
  end
123
117
  end
124
118
 
125
-
126
119
  # Bring in options defined by plugins
127
120
  Pry::Slop.new do
128
121
  on "no-plugins" do
@@ -136,12 +129,12 @@ end
136
129
 
137
130
  # The default Pry command line options (before plugin options are included)
138
131
  Pry::CLI.add_options do
139
- banner %{Usage: pry [OPTIONS]
140
- Start a Pry session.
141
- See http://pryrepl.org/ for more information.
142
- Copyright (c) 2016 John Mair (banisterfiend)
143
- --
144
- }
132
+ banner(
133
+ "Usage: pry [OPTIONS]\n" \
134
+ "Start a Pry session.\n" \
135
+ "See http://pryrepl.org/ for more information.\n"
136
+ )
137
+
145
138
  on :e, :exec=, "A line of code to execute in context before the session starts" do |input|
146
139
  Pry.config.exec_string += "\n" if Pry.config.exec_string.length > 0
147
140
  Pry.config.exec_string += input
@@ -159,7 +152,7 @@ Copyright (c) 2016 John Mair (banisterfiend)
159
152
  Pry.config.color = false
160
153
  end
161
154
 
162
- on :f, "Suppress loading of ~/.pryrc and ./.pryrc" do
155
+ on :f, "Suppress loading of pryrc" do
163
156
  Pry.config.should_load_rc = false
164
157
  Pry.config.should_load_local_rc = false
165
158
  end
@@ -187,18 +180,18 @@ Copyright (c) 2016 John Mair (banisterfiend)
187
180
  end
188
181
 
189
182
  on "simple-prompt", "Enable simple prompt mode" do
190
- Pry.config.prompt = Pry::SIMPLE_PROMPT
183
+ Pry.config.prompt = Pry::Prompt[:simple][:value]
191
184
  end
192
185
 
193
186
  on "noprompt", "No prompt mode" do
194
- Pry.config.prompt = Pry::NO_PROMPT
187
+ Pry.config.prompt = Pry::Prompt[:none][:value]
195
188
  end
196
189
 
197
190
  on :r, :require=, "`require` a Ruby script at startup" do |file|
198
191
  Pry.config.requires << file
199
192
  end
200
193
 
201
- on :I=, "Add a path to the $LOAD_PATH", :as => Array, :delimiter => ":" do |load_path|
194
+ on :I=, "Add a path to the $LOAD_PATH", as: Array, delimiter: ":" do |load_path|
202
195
  load_path.map! do |path|
203
196
  /\A\.\// =~ path ? path : File.expand_path(path)
204
197
  end
@@ -220,6 +213,6 @@ Copyright (c) 2016 John Mair (banisterfiend)
220
213
 
221
214
  on(:c, :context=,
222
215
  "Start the session in the specified context. Equivalent to `context.pry` in a session.",
223
- :default => "Pry.toplevel_binding"
216
+ default: "Pry.toplevel_binding"
224
217
  )
225
218
  end