pry-stack_explorer 0.2.8pre3 → 0.2.8pre4
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.
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
1
3
|
module PryStackExplorer
|
2
4
|
StackCommands = Pry::CommandSet.new do
|
3
5
|
command "up", "Go up to the caller's context. Accepts optional numeric parameter for how many frames to move up." do |inc_str|
|
@@ -77,15 +79,14 @@ module PryStackExplorer
|
|
77
79
|
b_self = b.eval('self')
|
78
80
|
meth_obj = Pry::Method.new(b_self.method(meth)) if meth
|
79
81
|
|
80
|
-
type = b.frame_type ? "
|
81
|
-
desc = b.frame_description ? "#{
|
82
|
-
|
83
|
-
sig = meth ? "#{text.bold('Signature:')} #{se_signature_with_owner(meth_obj)}".ljust(40) : "".ljust(32)
|
82
|
+
type = b.frame_type ? "[#{b.frame_type}]" : ""
|
83
|
+
desc = b.frame_description ? "#{b.frame_description} in " : "#{PryStackExplorer.frame_manager(_pry_).frame_info_for(b)} in "
|
84
|
+
sig = meth ? "#{se_signature_with_owner(meth_obj)}" : ""
|
84
85
|
|
85
|
-
slf_class = "#{
|
86
|
-
path = "
|
86
|
+
slf_class = "#{Pry.view_clip(b_self)}"
|
87
|
+
path = "@ #{b.eval('__FILE__')}:#{b.eval('__LINE__')}"
|
87
88
|
|
88
|
-
"#{desc} #{slf_class} #{sig} #{
|
89
|
+
"#{desc} #{slf_class} #{sig} #{path if verbose} #{type}"
|
89
90
|
end
|
90
91
|
|
91
92
|
def se_signature_with_owner(meth_obj)
|
data/lib/pry-stack_explorer.rb
CHANGED
@@ -22,6 +22,15 @@ module PryStackExplorer
|
|
22
22
|
Thread.current[:__pry_frame_managers__][_pry_].push FrameManager.new(bindings, _pry_)
|
23
23
|
end
|
24
24
|
|
25
|
+
# Return the complete frame manager stack for the Pry instance
|
26
|
+
# @param [Pry] _pry_ The Pry instance associated with the frame
|
27
|
+
# managers
|
28
|
+
# @return [Array] The stack of Pry::FrameManager objections
|
29
|
+
def self.all_frame_managers(_pry_)
|
30
|
+
init_frame_hash
|
31
|
+
Thread.current[:__pry_frame_managers__][_pry_]
|
32
|
+
end
|
33
|
+
|
25
34
|
# Delete the currently active frame manager
|
26
35
|
# @param [Pry] _pry_ The Pry instance associated with the frame managers
|
27
36
|
def self.pop_frame_manager(_pry_)
|
data/test/{test.rb → helper.rb}
RENAMED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
unless Object.const_defined? 'PryStackExplorer'
|
4
|
+
$:.unshift File.expand_path '../../lib', __FILE__
|
5
|
+
require 'pry-stack_explorer'
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'bacon'
|
9
|
+
|
10
|
+
puts "Testing pry-stack_explorer version #{PryStackExplorer::VERSION}..."
|
11
|
+
puts "Ruby version: #{RUBY_VERSION}"
|
12
|
+
|
13
|
+
PE = PryStackExplorer
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe PryStackExplorer do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@pry_instance = Pry.new
|
7
|
+
@bindings = [binding, binding]
|
8
|
+
end
|
9
|
+
|
10
|
+
after do
|
11
|
+
PE.clear_frame_managers(@pry_instance)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should create and push one new FrameManager" do
|
15
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
16
|
+
PE.frame_manager(@pry_instance).is_a?(PE::FrameManager).should == true
|
17
|
+
PE.all_frame_managers(@pry_instance).count.should == 1
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have the correct bindings" do
|
21
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
22
|
+
PE.frame_manager(@pry_instance).bindings.should == @bindings
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should pop a FrameManager" do
|
26
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
27
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
28
|
+
PE.pop_frame_manager(@pry_instance)
|
29
|
+
PE.all_frame_managers(@pry_instance).count.should == 1
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should clear all FrameManagers for a Pry instance" do
|
33
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
34
|
+
PE.create_and_push_frame_manager(@bindings, @pry_instance)
|
35
|
+
PE.clear_frame_managers(@pry_instance)
|
36
|
+
PE.all_frame_managers(@pry_instance).count.should == 0
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-stack_explorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8pre4
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: binding_of_caller
|
16
|
-
requirement: &
|
16
|
+
requirement: &70241510740720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.6.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70241510740720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bacon
|
27
|
-
requirement: &
|
27
|
+
requirement: &70241510738600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70241510738600
|
36
36
|
description: Walk the stack in a Pry session
|
37
37
|
email: jrmair@gmail.com
|
38
38
|
executables: []
|
@@ -43,7 +43,8 @@ files:
|
|
43
43
|
- lib/pry-stack_explorer/frame_manager.rb
|
44
44
|
- lib/pry-stack_explorer/version.rb
|
45
45
|
- lib/pry-stack_explorer.rb
|
46
|
-
- test/
|
46
|
+
- test/helper.rb
|
47
|
+
- test/test_stack_explorer.rb
|
47
48
|
- CHANGELOG
|
48
49
|
- README.md
|
49
50
|
- Rakefile
|