pry 0.10.2-i386-mswin32 → 1.0.0.pre1-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -0
- data/.gitignore +16 -0
- data/.travis.yml +21 -0
- data/.yardopts +3 -0
- data/CHANGELOG +503 -0
- data/CONTRIBUTORS +55 -0
- data/Gemfile +9 -0
- data/Guardfile +62 -0
- data/LICENSE +2 -2
- data/{README.md → README.markdown} +31 -37
- data/Rakefile +144 -0
- data/TODO +117 -0
- data/lib/pry.rb +146 -33
- data/lib/pry/cli.rb +13 -35
- data/lib/pry/code.rb +63 -24
- data/lib/pry/code/loc.rb +2 -2
- data/lib/pry/code_object.rb +21 -40
- data/lib/pry/command.rb +6 -9
- data/lib/pry/command_set.rb +37 -80
- data/lib/pry/commands.rb +1 -1
- data/lib/pry/commands/amend_line.rb +1 -1
- data/lib/pry/commands/bang.rb +1 -1
- data/lib/pry/commands/cat.rb +2 -11
- data/lib/pry/commands/cat/abstract_formatter.rb +1 -1
- data/lib/pry/commands/cat/exception_formatter.rb +7 -6
- data/lib/pry/commands/cat/file_formatter.rb +32 -15
- data/lib/pry/commands/cat/input_expression_formatter.rb +1 -1
- data/lib/pry/commands/cd.rb +3 -14
- data/lib/pry/commands/code_collector.rb +4 -4
- data/lib/pry/commands/easter_eggs.rb +3 -3
- data/lib/pry/commands/edit.rb +22 -10
- data/lib/pry/commands/edit/exception_patcher.rb +1 -1
- data/lib/pry/commands/edit/file_and_line_locator.rb +2 -0
- data/lib/pry/{method/patcher.rb → commands/edit/method_patcher.rb} +37 -40
- data/lib/pry/commands/find_method.rb +22 -16
- data/lib/pry/commands/gem_install.rb +2 -5
- data/lib/pry/commands/gem_open.rb +1 -1
- data/lib/pry/commands/gist.rb +11 -10
- data/lib/pry/commands/help.rb +14 -14
- data/lib/pry/commands/hist.rb +5 -24
- data/lib/pry/commands/ls.rb +287 -56
- data/lib/pry/commands/play.rb +10 -44
- data/lib/pry/commands/pry_backtrace.rb +2 -1
- data/lib/pry/commands/raise_up.rb +1 -1
- data/lib/pry/commands/reload_code.rb +15 -31
- data/lib/pry/commands/ri.rb +3 -7
- data/lib/pry/commands/shell_command.rb +12 -17
- data/lib/pry/commands/shell_mode.rb +2 -2
- data/lib/pry/commands/show_doc.rb +0 -5
- data/lib/pry/commands/show_info.rb +10 -11
- data/lib/pry/commands/show_source.rb +3 -15
- data/lib/pry/commands/simple_prompt.rb +1 -1
- data/lib/pry/commands/toggle_color.rb +4 -8
- data/lib/pry/commands/whereami.rb +10 -18
- data/lib/pry/completion.rb +293 -0
- data/lib/pry/config.rb +233 -20
- data/lib/pry/core_extensions.rb +19 -29
- data/lib/pry/custom_completions.rb +6 -0
- data/lib/pry/editor.rb +103 -109
- data/lib/pry/helpers/base_helpers.rb +109 -22
- data/lib/pry/helpers/command_helpers.rb +8 -10
- data/lib/pry/helpers/documentation_helpers.rb +2 -1
- data/lib/pry/helpers/text.rb +5 -4
- data/lib/pry/history.rb +10 -21
- data/lib/pry/history_array.rb +0 -5
- data/lib/pry/hooks.rb +29 -9
- data/lib/pry/indent.rb +10 -5
- data/lib/pry/method.rb +86 -81
- data/lib/pry/method/weird_method_locator.rb +2 -4
- data/lib/pry/module_candidate.rb +14 -5
- data/lib/pry/pager.rb +48 -193
- data/lib/pry/plugins.rb +2 -2
- data/lib/pry/pry_class.rb +193 -104
- data/lib/pry/pry_instance.rb +154 -152
- data/lib/pry/rbx_method.rb +13 -0
- data/lib/pry/rbx_path.rb +1 -1
- data/lib/pry/repl.rb +14 -17
- data/lib/pry/repl_file_loader.rb +3 -8
- data/lib/pry/rubygem.rb +3 -3
- data/lib/pry/terminal.rb +3 -4
- data/lib/pry/test/helper.rb +11 -6
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +56 -49
- data/man/pry.1 +195 -0
- data/man/pry.1.html +204 -0
- data/man/pry.1.ronn +141 -0
- data/pry.gemspec +31 -0
- data/spec/Procfile +3 -0
- data/spec/cli_spec.rb +78 -0
- data/spec/code_object_spec.rb +277 -0
- data/spec/code_spec.rb +219 -0
- data/spec/command_helpers_spec.rb +29 -0
- data/spec/command_integration_spec.rb +562 -0
- data/spec/command_set_spec.rb +627 -0
- data/spec/command_spec.rb +821 -0
- data/spec/commands/amend_line_spec.rb +247 -0
- data/spec/commands/bang_spec.rb +18 -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 +725 -0
- data/spec/commands/exit_all_spec.rb +27 -0
- data/spec/commands/exit_program_spec.rb +19 -0
- data/spec/commands/exit_spec.rb +28 -0
- data/spec/commands/find_method_spec.rb +70 -0
- data/spec/commands/gem_list_spec.rb +26 -0
- data/spec/commands/gist_spec.rb +79 -0
- data/spec/commands/help_spec.rb +56 -0
- data/spec/commands/hist_spec.rb +172 -0
- data/spec/commands/jump_to_spec.rb +15 -0
- data/spec/commands/ls_spec.rb +189 -0
- data/spec/commands/play_spec.rb +136 -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 +488 -0
- data/spec/commands/show_input_spec.rb +17 -0
- data/spec/commands/show_source_spec.rb +760 -0
- data/spec/commands/whereami_spec.rb +203 -0
- data/spec/completion_spec.rb +221 -0
- data/spec/control_d_handler_spec.rb +62 -0
- data/spec/documentation_helper_spec.rb +73 -0
- data/spec/editor_spec.rb +79 -0
- data/spec/exception_whitelist_spec.rb +21 -0
- data/spec/fixtures/candidate_helper1.rb +11 -0
- data/spec/fixtures/candidate_helper2.rb +8 -0
- data/spec/fixtures/example.erb +5 -0
- data/spec/fixtures/example_nesting.rb +33 -0
- data/spec/fixtures/show_source_doc_examples.rb +15 -0
- data/spec/fixtures/testlinkrc +2 -0
- data/spec/fixtures/testrc +2 -0
- data/spec/fixtures/testrcbad +2 -0
- data/spec/fixtures/whereami_helper.rb +6 -0
- data/spec/helper.rb +35 -0
- data/spec/helpers/bacon.rb +86 -0
- data/spec/helpers/mock_pry.rb +44 -0
- data/spec/helpers/repl_tester.rb +112 -0
- data/spec/helpers/table_spec.rb +105 -0
- data/spec/history_array_spec.rb +67 -0
- data/spec/hooks_spec.rb +522 -0
- data/spec/indent_spec.rb +301 -0
- data/spec/method_spec.rb +482 -0
- data/spec/prompt_spec.rb +61 -0
- data/spec/pry_defaults_spec.rb +420 -0
- data/spec/pry_history_spec.rb +69 -0
- data/spec/pry_output_spec.rb +95 -0
- data/spec/pry_repl_spec.rb +86 -0
- data/spec/pry_spec.rb +394 -0
- data/spec/pryrc_spec.rb +97 -0
- data/spec/run_command_spec.rb +25 -0
- data/spec/sticky_locals_spec.rb +147 -0
- data/spec/syntax_checking_spec.rb +81 -0
- data/spec/wrapped_module_spec.rb +261 -0
- data/wiki/Customizing-pry.md +397 -0
- data/wiki/Home.md +4 -0
- metadata +272 -61
- checksums.yaml +0 -7
- data/CHANGELOG.md +0 -714
- data/lib/pry/code/code_file.rb +0 -103
- data/lib/pry/color_printer.rb +0 -55
- data/lib/pry/commands/change_inspector.rb +0 -27
- data/lib/pry/commands/change_prompt.rb +0 -26
- data/lib/pry/commands/list_inspectors.rb +0 -35
- data/lib/pry/commands/list_prompts.rb +0 -35
- data/lib/pry/commands/ls/constants.rb +0 -47
- data/lib/pry/commands/ls/formatter.rb +0 -49
- data/lib/pry/commands/ls/globals.rb +0 -48
- data/lib/pry/commands/ls/grep.rb +0 -21
- data/lib/pry/commands/ls/instance_vars.rb +0 -39
- data/lib/pry/commands/ls/interrogatable.rb +0 -18
- data/lib/pry/commands/ls/jruby_hacks.rb +0 -49
- data/lib/pry/commands/ls/local_names.rb +0 -35
- data/lib/pry/commands/ls/local_vars.rb +0 -39
- data/lib/pry/commands/ls/ls_entity.rb +0 -70
- data/lib/pry/commands/ls/methods.rb +0 -57
- data/lib/pry/commands/ls/methods_helper.rb +0 -46
- data/lib/pry/commands/ls/self_methods.rb +0 -32
- data/lib/pry/commands/watch_expression.rb +0 -105
- data/lib/pry/commands/watch_expression/expression.rb +0 -38
- data/lib/pry/config/behavior.rb +0 -139
- data/lib/pry/config/convenience.rb +0 -25
- data/lib/pry/config/default.rb +0 -161
- data/lib/pry/exceptions.rb +0 -78
- data/lib/pry/input_completer.rb +0 -242
- data/lib/pry/input_lock.rb +0 -132
- data/lib/pry/inspector.rb +0 -27
- data/lib/pry/last_exception.rb +0 -61
- data/lib/pry/object_path.rb +0 -82
- data/lib/pry/output.rb +0 -50
- data/lib/pry/prompt.rb +0 -26
data/CONTRIBUTORS
ADDED
@@ -0,0 +1,55 @@
|
|
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
|
11
|
+
18 David Palm
|
12
|
+
18 Robert Gleeson
|
13
|
+
15 epitron
|
14
|
+
12 Andrew Vos
|
15
|
+
11 Reginald Tan
|
16
|
+
10 Matt Carey
|
17
|
+
8 Eero Saynatkari
|
18
|
+
8 Trey Lawrence
|
19
|
+
6 Jason Laster
|
20
|
+
3 misfo
|
21
|
+
3 fowlmouth
|
22
|
+
3 Darrick Wiebe
|
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
|
29
|
+
2 Xavier Shay
|
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
|
38
|
+
1 Joe Peduto
|
39
|
+
1 Greg Stearns
|
40
|
+
1 Jonathan Jackson
|
41
|
+
1 Jordan Running
|
42
|
+
1 Gosha Arinich
|
43
|
+
1 Josh Cheek
|
44
|
+
1 Kirill Lashuk
|
45
|
+
1 Gerbert Olivé
|
46
|
+
1 Larry Gilbert
|
47
|
+
1 Lars Haugseth
|
48
|
+
1 Loic Nageleisen
|
49
|
+
1 Matthew Carey
|
50
|
+
1 Michael Bensoussan
|
51
|
+
1 Renato Mascarenhas
|
52
|
+
1 Havenwood
|
53
|
+
1 Sherin C
|
54
|
+
1 Sonali Sridhar
|
55
|
+
1 Tim Pope
|
data/Gemfile
ADDED
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/LICENSE
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
License
|
2
2
|
-------
|
3
3
|
|
4
|
-
(The MIT License)
|
4
|
+
(The MIT License)
|
5
5
|
|
6
|
-
Copyright (c)
|
6
|
+
Copyright (c) 2011 John Mair (banisterfiend)
|
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
|
@@ -1,19 +1,16 @@
|
|
1
|
-
[![Build Status](https://
|
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)](http://inch-ci.org/github/pry/pry)
|
1
|
+
[![Build Status](https://secure.travis-ci.org/pry/pry.png)](http://travis-ci.org/pry/pry)
|
4
2
|
|
5
3
|
<center>
|
6
4
|
![The Pry Logo](https://dl.dropbox.com/u/26521875/pry%20stuff/logo/pry_logo_350.png)
|
7
5
|
|
8
|
-
© John Mair (
|
6
|
+
© John Mair (banisterfiend) 2012<br>
|
9
7
|
|
10
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!
|
11
9
|
|
12
10
|
**Sponsors**
|
13
11
|
|
14
|
-
[Tealeaf Academy](http://www.gotealeaf.com)<br/>
|
15
12
|
[Atomic Object](http://www.atomicobject.com/)<br/>
|
16
|
-
[
|
13
|
+
[Bendyworks](http://bendyworks.com/)<br/>
|
17
14
|
[Intridea](http://intridea.com/)<br/>
|
18
15
|
[Gaslight](http://gaslight.co/home)<br/>
|
19
16
|
|
@@ -30,7 +27,7 @@ including:
|
|
30
27
|
* Source code browsing (including core C source with the pry-doc gem)
|
31
28
|
* Documentation browsing
|
32
29
|
* Live help system
|
33
|
-
* Open methods in editors (`edit Class#method`)
|
30
|
+
* Open methods in editors (`edit-method Class#method`)
|
34
31
|
* Syntax highlighting
|
35
32
|
* Command shell integration (start editors, run git, and rake from within Pry)
|
36
33
|
* Gist integration
|
@@ -39,6 +36,7 @@ including:
|
|
39
36
|
* Exotic object support (BasicObject instances, IClasses, ...)
|
40
37
|
* A Powerful and flexible command system
|
41
38
|
* Ability to view and replay history
|
39
|
+
|
42
40
|
* Many convenience commands inspired by IPython, Smalltalk and other advanced REPLs
|
43
41
|
* A wide-range number of [plugins](https://github.com/pry/pry/wiki/Available-plugins) that provide remote sessions, full debugging functionality, and more.
|
44
42
|
|
@@ -67,6 +65,13 @@ methods. The additional docs are accessed through the `show-doc` and
|
|
67
65
|
* Read the [YARD API documentation](http://rdoc.info/github/pry/pry/master/file/README.markdown)
|
68
66
|
* See the [source code](http://github.com/pry/pry)
|
69
67
|
|
68
|
+
Pry also has `rubygems-test` support; to participate, first install
|
69
|
+
Pry, then:
|
70
|
+
|
71
|
+
1. Install rubygems-test: `gem install rubygems-test`
|
72
|
+
2. Run the test: `gem test pry`
|
73
|
+
3. Finally choose 'Yes' to upload the results.
|
74
|
+
|
70
75
|
### Commands
|
71
76
|
|
72
77
|
Nearly every piece of functionality in a Pry session is implemented as
|
@@ -97,9 +102,9 @@ an instance variable inside that class:
|
|
97
102
|
pry(Hello):1> ls -i
|
98
103
|
instance variables: @x
|
99
104
|
pry(Hello):1> cd @x
|
100
|
-
pry(20
|
105
|
+
pry(20:2)> self + 10
|
101
106
|
=> 30
|
102
|
-
pry(20
|
107
|
+
pry(20:2)> cd ..
|
103
108
|
pry(Hello):1> cd ..
|
104
109
|
pry(main)> cd ..
|
105
110
|
|
@@ -107,7 +112,7 @@ The number after the `:` in the pry prompt indicates the nesting
|
|
107
112
|
level. To display more information about nesting, use the `nesting`
|
108
113
|
command. E.g
|
109
114
|
|
110
|
-
pry("friend"
|
115
|
+
pry("friend":3)> nesting
|
111
116
|
Nesting status:
|
112
117
|
0. main (Pry top level)
|
113
118
|
1. Hello
|
@@ -118,7 +123,7 @@ command. E.g
|
|
118
123
|
We can then jump back to any of the previous nesting levels by using
|
119
124
|
the `jump-to` command:
|
120
125
|
|
121
|
-
pry("friend"
|
126
|
+
pry("friend":3)> jump-to 1
|
122
127
|
=> 100
|
123
128
|
pry(Hello):1>
|
124
129
|
|
@@ -219,7 +224,7 @@ In the following example we will enter the `Pry` class, list the
|
|
219
224
|
instance methods beginning with 're' and display the source code for the `rep` method:
|
220
225
|
|
221
226
|
pry(main)> cd Pry
|
222
|
-
pry(Pry)
|
227
|
+
pry(Pry)> ls -M --grep re
|
223
228
|
Pry#methods: re readline refresh rep repl repl_epilogue repl_prologue retrieve_line
|
224
229
|
pry(Pry):1> show-method rep -l
|
225
230
|
|
@@ -251,9 +256,9 @@ Note that we can also view C methods (from Ruby Core) using the
|
|
251
256
|
RETURN_ENUMERATOR(ary, 0, 0);
|
252
257
|
result = rb_ary_new2(RARRAY_LEN(ary));
|
253
258
|
for (i = 0; i < RARRAY_LEN(ary); i++) {
|
254
|
-
|
255
|
-
|
256
|
-
|
259
|
+
if (RTEST(rb_yield(RARRAY_PTR(ary)[i]))) {
|
260
|
+
rb_ary_push(result, rb_ary_elt(ary, i));
|
261
|
+
}
|
257
262
|
}
|
258
263
|
return result;
|
259
264
|
}
|
@@ -327,7 +332,7 @@ You can see the actual gist generated here: [https://gist.github.com/5332c38afc4
|
|
327
332
|
|
328
333
|
### Edit methods
|
329
334
|
|
330
|
-
You can use `edit Class#method` or `edit my_method`
|
335
|
+
You can use `edit-method Class#method` or `edit-method my_method`
|
331
336
|
(if the method is in scope) to open a method for editing directly in
|
332
337
|
your favorite editor. Pry has knowledge of a few different editors and
|
333
338
|
will attempt to open the file at the line the method is defined.
|
@@ -336,13 +341,13 @@ You can set the editor to use by assigning to the `Pry.editor`
|
|
336
341
|
accessor. `Pry.editor` will default to `$EDITOR` or failing that will
|
337
342
|
use `nano` as the backup default. The file that is edited will be
|
338
343
|
automatically reloaded after exiting the editor - reloading can be
|
339
|
-
suppressed by passing the `--no-reload` option to `edit`
|
344
|
+
suppressed by passing the `--no-reload` option to `edit-method`
|
340
345
|
|
341
346
|
In the example below we will set our default editor to "emacsclient"
|
342
347
|
and open the `Pry#repl` method for editing:
|
343
348
|
|
344
349
|
pry(main)> Pry.editor = "emacsclient"
|
345
|
-
pry(main)> edit Pry#repl
|
350
|
+
pry(main)> edit-method Pry#repl
|
346
351
|
|
347
352
|
### Live Help System
|
348
353
|
|
@@ -355,19 +360,11 @@ avaiable.
|
|
355
360
|
|
356
361
|
### Use Pry as your Rails Console
|
357
362
|
|
358
|
-
The recommended way to use Pry as your Rails console is to add
|
359
|
-
[the `pry-rails` gem](https://github.com/rweng/pry-rails) to
|
360
|
-
your Gemfile. This replaces the default console with Pry, in
|
361
|
-
addition to loading the Rails console helpers and adding some
|
362
|
-
useful Rails-specific commands.
|
363
|
-
|
364
|
-
If you don't want to change your Gemfile, you can still run a Pry
|
365
|
-
console in your app's environment using Pry's `-r` flag:
|
366
|
-
|
367
363
|
pry -r ./config/environment
|
368
364
|
|
369
|
-
|
370
|
-
|
365
|
+
MyArtChannel has kindly provided a hack to replace the `rails console` command in Rails 3: [https://gist.github.com/941174](https://gist.github.com/941174) This is not recommended for code bases with multiple developers, as they may not all want to use Pry.
|
366
|
+
|
367
|
+
Also check out the [wiki](https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry) for other strategies on integrating Pry with rails, notably the [pry-rails](https://github.com/pry/pry/wiki/Setting-up-Rails-or-Heroku-to-use-Pry#wiki-pry_rails) plugin.
|
371
368
|
|
372
369
|
### Limitations:
|
373
370
|
|
@@ -376,20 +373,17 @@ for more information about integrating Pry with Rails.
|
|
376
373
|
|
377
374
|
### Syntax Highlighting
|
378
375
|
|
379
|
-
Syntax highlighting is on by default in Pry.
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
You can toggle the syntax highlighting on and off in a session by
|
384
|
-
using the `toggle-color` command. Alternatively, you can turn it off
|
385
|
-
permanently by putting the line `Pry.color = false` in your `~/.pryrc`
|
386
|
-
file.
|
376
|
+
Syntax highlighting is on by default in Pry. You can toggle it on and
|
377
|
+
off in a session by using the `toggle-color` command. Alternatively,
|
378
|
+
you can turn it off permanently by putting the line `Pry.color =
|
379
|
+
false` in your `~/.pryrc` file.
|
387
380
|
|
388
381
|
### Future Directions
|
389
382
|
|
390
383
|
Many new features are planned such as:
|
391
384
|
|
392
385
|
* Increase modularity (rely more on plugin system)
|
386
|
+
* Much improved tab completion (using [Bond](http://github.com/cldwalker/bond))
|
393
387
|
* Much improved documentation system, better support for YARD
|
394
388
|
* Better support for code and method reloading and saving code
|
395
389
|
* Extended and more sophisticated command system, allowing piping
|
data/Rakefile
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems/package_task'
|
3
|
+
|
4
|
+
$:.unshift 'lib'
|
5
|
+
require 'pry/version'
|
6
|
+
|
7
|
+
CLOBBER.include('**/*~', '**/*#*', '**/*.log')
|
8
|
+
CLEAN.include('**/*#*', '**/*#*.*', '**/*_flymake*.*', '**/*_flymake', '**/*.rbc', '**/.#*.*')
|
9
|
+
|
10
|
+
def check_dependencies
|
11
|
+
require 'bundler'
|
12
|
+
Bundler.definition.missing_specs
|
13
|
+
|
14
|
+
eval('nil', TOPLEVEL_BINDING, '<main>') # workaround for issue #395
|
15
|
+
rescue LoadError
|
16
|
+
# if Bundler isn't installed, we'll just assume your setup is ok.
|
17
|
+
rescue Bundler::GemNotFound
|
18
|
+
raise RuntimeError, "You're missing one or more required gems. Run `bundle install` first."
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Set up and run tests"
|
22
|
+
task :default => [:test]
|
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
|
+
|
38
|
+
desc "Run tests"
|
39
|
+
task :test do
|
40
|
+
check_dependencies unless ENV['SKIP_DEP_CHECK']
|
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
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Run pry (you can pass arguments using _ in place of -)"
|
58
|
+
task :pry do
|
59
|
+
check_dependencies unless ENV['SKIP_DEP_CHECK']
|
60
|
+
ARGV.shift if ARGV.first == "pry"
|
61
|
+
ARGV.map! do |arg|
|
62
|
+
arg.sub(/^_*/) { |m| "-" * m.size }
|
63
|
+
end
|
64
|
+
load 'bin/pry'
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "Show pry version."
|
68
|
+
task :version do
|
69
|
+
puts "Pry version: #{Pry::VERSION}"
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "Profile pry's startup time"
|
73
|
+
task :profile do
|
74
|
+
require 'profile'
|
75
|
+
require 'pry'
|
76
|
+
Pry.start(TOPLEVEL_BINDING, :input => StringIO.new('exit'))
|
77
|
+
end
|
78
|
+
|
79
|
+
def modify_base_gemspec
|
80
|
+
eval(File.read('pry.gemspec')).tap { |s| yield s }
|
81
|
+
end
|
82
|
+
|
83
|
+
namespace :ruby do
|
84
|
+
spec = modify_base_gemspec do |s|
|
85
|
+
s.platform = Gem::Platform::RUBY
|
86
|
+
end
|
87
|
+
|
88
|
+
Gem::PackageTask.new(spec) do |pkg|
|
89
|
+
pkg.need_zip = false
|
90
|
+
pkg.need_tar = false
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
namespace :jruby do
|
95
|
+
spec = modify_base_gemspec do |s|
|
96
|
+
s.add_dependency('spoon', '~> 0.0')
|
97
|
+
s.platform = 'java'
|
98
|
+
end
|
99
|
+
|
100
|
+
Gem::PackageTask.new(spec) do |pkg|
|
101
|
+
pkg.need_zip = false
|
102
|
+
pkg.need_tar = false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
[:mingw32, :mswin32].each do |v|
|
108
|
+
namespace v do
|
109
|
+
spec = modify_base_gemspec do |s|
|
110
|
+
s.add_dependency('win32console', '~> 1.3')
|
111
|
+
s.platform = "i386-#{v}"
|
112
|
+
end
|
113
|
+
|
114
|
+
Gem::PackageTask.new(spec) do |pkg|
|
115
|
+
pkg.need_zip = false
|
116
|
+
pkg.need_tar = false
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
desc "build all platform gems at once"
|
122
|
+
task :gems => [:clean, :rmgems, 'ruby:gem', 'mswin32:gem', 'mingw32:gem', 'jruby:gem']
|
123
|
+
|
124
|
+
desc "remove all platform gems"
|
125
|
+
task :rmgems => ['ruby:clobber_package']
|
126
|
+
task :rm_gems => :rmgems
|
127
|
+
task :rm_pkgs => :rmgems
|
128
|
+
|
129
|
+
desc "reinstall gem"
|
130
|
+
task :reinstall => :gems do
|
131
|
+
sh "gem uninstall pry" rescue nil
|
132
|
+
sh "gem install #{File.dirname(__FILE__)}/pkg/pry-#{Pry::VERSION}.gem"
|
133
|
+
end
|
134
|
+
|
135
|
+
task :install => :reinstall
|
136
|
+
|
137
|
+
desc "build and push latest gems"
|
138
|
+
task :pushgems => :gems do
|
139
|
+
chdir("#{File.dirname(__FILE__)}/pkg") do
|
140
|
+
Dir["*.gem"].each do |gemfile|
|
141
|
+
sh "gem push #{gemfile}"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|