pry-stack_explorer 0.2.8pre6 → 0.2.8pre7

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/README.md CHANGED
@@ -1,27 +1,128 @@
1
- pry-stack_explore
1
+ pry-stack_explorer
2
2
  ===========
3
3
 
4
4
  (C) John Mair (banisterfiend) 2011
5
5
 
6
- FIXME: _tagline_
6
+ _Walk the stack in a Pry session_
7
7
 
8
- FIXME: _description goes here_
8
+ pry-stack_explorer is a plugin for the [Pry](http://pry.github.com)
9
+ REPL that enables the user to navigate the call-stack.
9
10
 
10
- * Install the [gem](https://rubygems.org/gems/pry-stack_explore): `gem install pry-stack_explore`
11
- * Read the [documentation](http://rdoc.info/github/banister/pry-stack_explore/master/file/README.md)
12
- * See the [source code](http://github.com/banister/pry-stack_explore)
11
+ From the point a Pry session is started, the user can move up the stack
12
+ through parent frames, examine state, and even evaluate code.
13
13
 
14
- Example: Example description
15
- --------
14
+ Unlike `ruby-debug`, pry-stack_explorer incurs no runtime cost and
15
+ enables navigation right up the call-stack to the birth of the
16
+ program.
17
+
18
+ pry-stack_explorer is currently designed to work on MRI and
19
+ Ruby 1.9.2+ (including 1.9.3). Support for other Ruby versions and
20
+ implementations is planned for the future.
21
+
22
+ The `up`, `down`, `frame` and `show-stack` commands are provided.
23
+
24
+ Please note that this is a first release and may have some teething problems, feel free to file an [issue](https://github.com/banister/pry-stack_explorer) if you encounter any problems.
16
25
 
17
- Example preamble
26
+ * Install the [gem](https://rubygems.org/gems/pry-stack_explorer): `gem install pry-stack_explorer`
27
+ * Read the [documentation](http://rdoc.info/github/banister/pry-stack_explorer/master/file/README.md)
28
+ * See the [source code](http://github.com/banister/pry-stack_explorer)
18
29
 
19
- puts "example code"
30
+ Example: Moving around between frames
31
+ --------
32
+
33
+ ```
34
+ [8] pry(J)> show-stack
35
+
36
+ Showing all accessible frames in stack:
37
+ --
38
+ => #0 [method] c <Object#c()>
39
+ #1 [block] block in b <Object#b()>
40
+ #2 [method] b <Object#b()>
41
+ #3 [method] alphabet <Object#alphabet(y)>
42
+ #4 [class] <class:J>
43
+ #5 [block] block in <main>
44
+ #6 [eval] <main>
45
+ #7 [top] <main>
46
+ [9] pry(J)> frame 3
47
+
48
+ Frame number: 3/7
49
+ Frame type: method
50
+
51
+ From: /Users/john/ruby/projects/pry-stack_explorer/examples/example.rb @ line 10 in Object#alphabet:
52
+
53
+ 5:
54
+ 6: require 'pry-stack_explorer'
55
+ 7:
56
+ 8: def alphabet(y)
57
+ 9: x = 20
58
+ => 10: b
59
+ 11: end
60
+ 12:
61
+ 13: def b
62
+ 14: x = 30
63
+ 15: proc {
64
+ [10] pry(J)> x
65
+ => 20
66
+ ```
67
+
68
+ Example: Modifying state in a caller
69
+ -------
20
70
 
21
- Features and limitations
71
+ ```
72
+ Frame number: 0/3
73
+ Frame type: method
74
+
75
+ From: /Users/john/ruby/projects/pry-stack_explorer/examples/example2.rb @ line 15 in Object#beta:
76
+
77
+ 10: beta
78
+ 11: puts x
79
+ 12: end
80
+ 13:
81
+ 14: def beta
82
+ => 15: binding.pry
83
+ 16: end
84
+ 17:
85
+ 18: alpha
86
+ [1] pry(main)> show-stack
87
+
88
+ Showing all accessible frames in stack:
89
+ --
90
+ => #0 [method] beta <Object#beta()>
91
+ #1 [method] alpha <Object#alpha()>
92
+ #2 [eval] <main>
93
+ #3 [top] <main>
94
+ [2] pry(main)> up
95
+
96
+ Frame number: 1/3
97
+ Frame type: method
98
+
99
+ From: /Users/john/ruby/projects/pry-stack_explorer/examples/example2.rb @ line 10 in Object#alpha:
100
+
101
+ 5:
102
+ 6:
103
+ 7:
104
+ 8: def alpha
105
+ 9: x = "hello"
106
+ => 10: beta
107
+ 11: puts x
108
+ 12: end
109
+ 13:
110
+ 14: def beta
111
+ 15: binding.pry
112
+ [3] pry(main)> x = "goodbye"
113
+ => "goodbye"
114
+ [4] pry(main)> ^D
115
+
116
+ OUTPUT: goodbye
117
+ ```
118
+
119
+ Output from above is `goodbye` as we changed the `x` local inside the `alpha` (caller) stack frame.
120
+
121
+ Limitations
22
122
  -------------------------
23
123
 
24
- Feature List Preamble
124
+ * First release, so may have teething problems.
125
+ * Limited to MRI 1.9.2+ at this stage.
25
126
 
26
127
  Contact
27
128
  -------
@@ -32,7 +133,7 @@ Problems or questions contact me at [github](http://github.com/banister)
32
133
  License
33
134
  -------
34
135
 
35
- (The MIT License)
136
+ (The MIT License)
36
137
 
37
138
  Copyright (c) 2011 John Mair (banisterfiend)
38
139
 
data/Rakefile CHANGED
@@ -26,6 +26,7 @@ def apply_spec_defaults(s)
26
26
  s.add_dependency("pry","0.9.8pre2")
27
27
  s.add_development_dependency("bacon","~>1.1.0")
28
28
  s.add_development_dependency('rake', '~> 0.9')
29
+ s.required_ruby_version = '>= 1.9.2'
29
30
  s.homepage = "https://github.com/banister"
30
31
  s.files = `git ls-files`.split("\n")
31
32
  s.test_files = `git ls-files -- test/*`.split("\n")
@@ -41,6 +42,11 @@ task :example do
41
42
  sh "ruby -I#{direc}/lib/ #{direc}/examples/example.rb "
42
43
  end
43
44
 
45
+ desc "Run example2"
46
+ task :example2 do
47
+ sh "ruby -I#{direc}/lib/ #{direc}/examples/example2.rb "
48
+ end
49
+
44
50
  desc "Show version"
45
51
  task :version do
46
52
  puts "PryStackExplorer version: #{PryStackExplorer::VERSION}"
@@ -19,7 +19,7 @@ end
19
19
 
20
20
  def c
21
21
  u = 50
22
- J.pry
22
+ binding.pry
23
23
  end
24
24
 
25
25
  # hello
@@ -0,0 +1,18 @@
1
+ unless Object.const_defined? :PryStackExplorer
2
+ $:.unshift File.expand_path '../../lib', __FILE__
3
+ require 'pry'
4
+ end
5
+
6
+ require 'pry-stack_explorer'
7
+
8
+ def alpha
9
+ x = "hello"
10
+ beta
11
+ puts x
12
+ end
13
+
14
+ def beta
15
+ binding.pry
16
+ end
17
+
18
+ alpha
@@ -64,32 +64,28 @@ module PryStackExplorer
64
64
  if frame_num
65
65
  PryStackExplorer.frame_manager(_pry_).change_frame_to frame_num.to_i
66
66
  else
67
- output.puts "##{PryStackExplorer.frame_manager(_pry_).binding_index} #{frame_info(target)}"
67
+ output.puts "##{PryStackExplorer.frame_manager(_pry_).binding_index} #{frame_info(target, true)}"
68
68
  end
69
69
  end
70
70
  end
71
71
 
72
- command "frame-type", "Display current frame type." do
73
- output.puts _pry_.binding_stack.last.frame_type
74
- end
75
-
76
72
  helpers do
77
73
  def frame_info(b, verbose = false)
78
74
  meth = b.eval('__method__')
79
75
  b_self = b.eval('self')
80
76
  meth_obj = Pry::Method.from_binding(b) if meth
81
77
 
82
- type = b.frame_type ? "[#{b.frame_type}]" : ""
78
+ type = b.frame_type ? "[#{b.frame_type}]".ljust(9) : ""
83
79
  desc = b.frame_description ? "#{b.frame_description}" : "#{PryStackExplorer.frame_manager(_pry_).frame_info_for(b)}"
84
- sig = meth ? "#{se_signature_with_owner(meth_obj)}" : ""
80
+ sig = meth_obj ? "<#{se_signature_with_owner(meth_obj)}>" : ""
85
81
 
86
- slf_class = "#{Pry.view_clip(b_self)}"
82
+ self_clipped = "#{Pry.view_clip(b_self)}"
87
83
  path = "@ #{b.eval('__FILE__')}:#{b.eval('__LINE__')}"
88
84
 
89
85
  if !verbose
90
- "#{desc} #{sig} #{type}"
86
+ "#{type} #{desc} #{sig}"
91
87
  else
92
- "#{desc} #{sig} #{type}\n in #{slf_class} #{path}"
88
+ "#{type} #{desc} #{sig}\n in #{self_clipped} #{path}"
93
89
  end
94
90
  end
95
91
 
@@ -1,3 +1,3 @@
1
1
  module PryStackExplorer
2
- VERSION = "0.2.8pre6"
2
+ VERSION = "0.2.8pre7"
3
3
  end
@@ -2,19 +2,19 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pry-stack_explorer}
5
- s.version = "0.2.8pre5"
5
+ s.version = "0.2.8pre6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["John Mair (banisterfiend)"]
8
+ s.authors = [%q{John Mair (banisterfiend)}]
9
9
  s.date = %q{2011-12-21}
10
10
  s.description = %q{Walk the stack in a Pry session}
11
11
  s.email = %q{jrmair@gmail.com}
12
- s.files = [".gemtest", ".gitignore", ".travis.yml", ".yardopts", "CHANGELOG", "Gemfile", "LICENSE", "README.md", "Rakefile", "examples/example.rb", "lib/pry-stack_explorer.rb", "lib/pry-stack_explorer/commands.rb", "lib/pry-stack_explorer/frame_manager.rb", "lib/pry-stack_explorer/version.rb", "pry-stack_explorer.gemspec", "test/helper.rb", "test/test_frame_manager.rb", "test/test_stack_explorer.rb", "tester.rb"]
12
+ s.files = [%q{.gemtest}, %q{.gitignore}, %q{.travis.yml}, %q{.yardopts}, %q{CHANGELOG}, %q{Gemfile}, %q{LICENSE}, %q{README.md}, %q{Rakefile}, %q{examples/example.rb}, %q{lib/pry-stack_explorer.rb}, %q{lib/pry-stack_explorer/commands.rb}, %q{lib/pry-stack_explorer/frame_manager.rb}, %q{lib/pry-stack_explorer/version.rb}, %q{pry-stack_explorer.gemspec}, %q{test/helper.rb}, %q{test/test_frame_manager.rb}, %q{test/test_stack_explorer.rb}, %q{tester.rb}]
13
13
  s.homepage = %q{https://github.com/banister}
14
- s.require_paths = ["lib"]
15
- s.rubygems_version = %q{1.6.2}
14
+ s.require_paths = [%q{lib}]
15
+ s.rubygems_version = %q{1.8.6}
16
16
  s.summary = %q{Walk the stack in a Pry session}
17
- s.test_files = ["test/helper.rb", "test/test_frame_manager.rb", "test/test_stack_explorer.rb"]
17
+ s.test_files = [%q{test/helper.rb}, %q{test/test_frame_manager.rb}, %q{test/test_stack_explorer.rb}]
18
18
 
19
19
  if s.respond_to? :specification_version then
20
20
  s.specification_version = 3
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.8pre6
4
+ version: 0.2.8pre7
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-21 00:00:00.000000000 Z
12
+ date: 2011-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: binding_of_caller
16
- requirement: &70304748409420 !ruby/object:Gem::Requirement
16
+ requirement: &70297085157800 !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: *70304748409420
24
+ version_requirements: *70297085157800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: pry
27
- requirement: &70304748402320 !ruby/object:Gem::Requirement
27
+ requirement: &70297085156300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.8pre2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70304748402320
35
+ version_requirements: *70297085156300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bacon
38
- requirement: &70304748401240 !ruby/object:Gem::Requirement
38
+ requirement: &70297088892900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70304748401240
46
+ version_requirements: *70297088892900
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70304748399760 !ruby/object:Gem::Requirement
49
+ requirement: &70297088891420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0.9'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70304748399760
57
+ version_requirements: *70297088891420
58
58
  description: Walk the stack in a Pry session
59
59
  email: jrmair@gmail.com
60
60
  executables: []
@@ -71,6 +71,7 @@ files:
71
71
  - README.md
72
72
  - Rakefile
73
73
  - examples/example.rb
74
+ - examples/example2.rb
74
75
  - lib/pry-stack_explorer.rb
75
76
  - lib/pry-stack_explorer/commands.rb
76
77
  - lib/pry-stack_explorer/frame_manager.rb
@@ -91,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
92
  requirements:
92
93
  - - ! '>='
93
94
  - !ruby/object:Gem::Version
94
- version: '0'
95
+ version: 1.9.2
95
96
  required_rubygems_version: !ruby/object:Gem::Requirement
96
97
  none: false
97
98
  requirements: