pry 0.7.3 → 0.7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +9 -0
- data/README.markdown +0 -3
- data/examples/example_basic.rb +1 -1
- data/lib/pry/commands.rb +21 -9
- data/lib/pry/hooks.rb +3 -1
- data/lib/pry/version.rb +1 -1
- metadata +4 -3
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
26/3/2011 version 0.7.6.1
|
|
2
|
+
* added slightly better support for YARD
|
|
3
|
+
* now @param and @return tags are colored green and markdown `code` is syntax highlighted using coderay
|
|
4
|
+
|
|
5
|
+
26/3/2011 version 0.7.6
|
|
6
|
+
* `whereami` command now accepts parameter AROUND, to display AROUND lines on eitherside of invocation line.
|
|
7
|
+
* made it so `whereami` is invoked even if no method exists in current context (i.e in rspec tests)
|
|
8
|
+
* added rubinius support for `whereami` invocation in HOOKS by checking for __unknown__.rb rather than just <main>
|
|
9
|
+
|
|
1
10
|
15/3/2011 version 0.7.0
|
|
2
11
|
* add pry-doc support with syntax highlighting for docs
|
|
3
12
|
* add 'mj' option to ls (restrict to singleton methods)
|
data/README.markdown
CHANGED
|
@@ -269,9 +269,6 @@ If you want to access a method of the same name, prefix the invocation by whites
|
|
|
269
269
|
* `jump-to NEST_LEVEL` Unwinds the Pry stack (nesting level) until the appropriate nesting level is reached.
|
|
270
270
|
* `exit-all` breaks out of all Pry nesting levels and returns to the
|
|
271
271
|
calling process.
|
|
272
|
-
* You can type `Pry.start(obj)` or `obj.pry` to nest another Pry session within the
|
|
273
|
-
current one with `obj` as the receiver of the new session. Very useful
|
|
274
|
-
when exploring large or complicated runtime state.
|
|
275
272
|
|
|
276
273
|
Syntax Highlighting
|
|
277
274
|
--------------------
|
data/examples/example_basic.rb
CHANGED
data/lib/pry/commands.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "pry/command_base"
|
|
|
4
4
|
require "pry/pry_instance"
|
|
5
5
|
|
|
6
6
|
begin
|
|
7
|
-
require "pry-doc"
|
|
7
|
+
require "pry-doc"
|
|
8
8
|
rescue LoadError
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -158,26 +158,34 @@ class Pry
|
|
|
158
158
|
output.puts "Last result: #{Pry.view(Pry.last_result)}"
|
|
159
159
|
end
|
|
160
160
|
|
|
161
|
-
command "whereami", "Show the code context for the session." do
|
|
161
|
+
command "whereami", "Show the code context for the session. Shows AROUND lines around the invocation line. AROUND defaults to 5 lines. " do |num|
|
|
162
162
|
file = target.eval('__FILE__')
|
|
163
163
|
line_num = target.eval('__LINE__')
|
|
164
164
|
klass = target.eval('self.class')
|
|
165
165
|
|
|
166
|
+
if num
|
|
167
|
+
i_num = num.to_i
|
|
168
|
+
else
|
|
169
|
+
i_num = 5
|
|
170
|
+
end
|
|
171
|
+
|
|
166
172
|
meth_name = meth_name_from_binding.call(target)
|
|
167
|
-
if !meth_name
|
|
168
|
-
|
|
173
|
+
meth_name = "N/A" if !meth_name
|
|
174
|
+
|
|
175
|
+
# FIX ME!!! this line is screwed
|
|
176
|
+
# check_for_dynamically_defined_method.call()
|
|
177
|
+
if file =~ /(\(.*\))|<.*>/
|
|
178
|
+
output.puts "Cannot find local context. Did you use `binding.pry` ?"
|
|
169
179
|
next
|
|
170
180
|
end
|
|
171
|
-
|
|
172
|
-
check_for_dynamically_defined_method.call(file)
|
|
173
181
|
|
|
174
182
|
output.puts "--\nFrom #{file} @ line #{line_num} in #{klass}##{meth_name}:\n--"
|
|
175
183
|
|
|
176
184
|
# This method inspired by http://rubygems.org/gems/ir_b
|
|
177
185
|
File.open(file).each_with_index do |line, index|
|
|
178
186
|
line_n = index + 1
|
|
179
|
-
next unless line_n > (line_num -
|
|
180
|
-
break if line_n > (line_num +
|
|
187
|
+
next unless line_n > (line_num - i_num - 1)
|
|
188
|
+
break if line_n > (line_num + i_num)
|
|
181
189
|
if line_n == line_num
|
|
182
190
|
code =" =>#{line_n.to_s.rjust(3)}: #{line.chomp}"
|
|
183
191
|
if Pry.color
|
|
@@ -459,7 +467,9 @@ e.g: eval-file -c self "hello.rb"
|
|
|
459
467
|
gsub(/<em>(?:\s*\n)?(.*?)\s*<\/em>/m) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
|
460
468
|
gsub(/<i>(?:\s*\n)?(.*?)\s*<\/i>/m) { Pry.color ? "\e[34m#{$1}\e[0m" : $1 }.
|
|
461
469
|
gsub(/\B\+(\w*?)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
|
|
462
|
-
gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }
|
|
470
|
+
gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
|
|
471
|
+
gsub(/`(?:\s*\n)?(.*?)\s*`/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
|
|
472
|
+
gsub(/(@param|@return)/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }
|
|
463
473
|
end
|
|
464
474
|
|
|
465
475
|
strip_leading_hash_from_ruby_comments = lambda do |comment|
|
|
@@ -557,6 +567,8 @@ e.g: show-method hello_method
|
|
|
557
567
|
|
|
558
568
|
next if options[:h]
|
|
559
569
|
|
|
570
|
+
meth_name = meth_name_from_binding.call(target) if !meth_name
|
|
571
|
+
|
|
560
572
|
if (meth = get_method_object.call(meth_name, target, options)).nil?
|
|
561
573
|
output.puts "Invalid method name: #{meth_name}. Type `show-method --help` for help"
|
|
562
574
|
next
|
data/lib/pry/hooks.rb
CHANGED
|
@@ -9,7 +9,9 @@ class Pry
|
|
|
9
9
|
# ensure we're actually in a method
|
|
10
10
|
meth_name = target.eval('__method__')
|
|
11
11
|
file = target.eval('__FILE__')
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
# /unknown/ for rbx
|
|
14
|
+
if file !~ /(\(.*\))|<.*>/ && file !~ /__unknown__/
|
|
13
15
|
Pry.run_command "whereami", :output => out, :show_output => true, :context => target, :commands => Pry::Commands
|
|
14
16
|
end
|
|
15
17
|
end,
|
data/lib/pry/version.rb
CHANGED
metadata
CHANGED
|
@@ -5,8 +5,9 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 7
|
|
8
|
-
-
|
|
9
|
-
|
|
8
|
+
- 6
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.7.6.1
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- John Mair (banisterfiend)
|
|
@@ -14,7 +15,7 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date: 2011-03-
|
|
18
|
+
date: 2011-03-26 00:00:00 +13:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies:
|
|
20
21
|
- !ruby/object:Gem::Dependency
|