pry 0.4.1pre1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ 23/1/2010 version 0.4.1
2
+ * made it so a 'def meth;end' in an object Pry session defines singleton
3
+ methods, not methods on the class (except in the case of
4
+ immediates)
5
+ * reorganized documentation, moving customization to a separate wiki file
6
+ * storing wiki in a nested git repo, as github wiki pages have their own
7
+ repo
8
+ * added more tests for new method definition behaviour
1
9
  21/1/2010 version 0.4.0
2
10
  * added command API
3
11
  * added many new commands, i.e ls_methods and friends
@@ -1,7 +1,7 @@
1
1
  Pry
2
2
  =============
3
3
 
4
- (C) John Mair (banisterfiend) 2010
4
+ (C) John Mair (banisterfiend) 2011
5
5
 
6
6
  _attach an irb-like session to any object at runtime_
7
7
 
@@ -24,6 +24,13 @@ object that has a `readline` method and write to any object that has a
24
24
  * Read the [documentation](http://rdoc.info/github/banister/pry/master/file/README.markdown)
25
25
  * See the [source code](http://github.com/banister/pry)
26
26
 
27
+ Pry also has `rubygems-test` support; to participate, first install
28
+ Pry, then:
29
+
30
+ 1. Install rubygems-test: `gem install rubygems-test`
31
+ 2. Run the test: `gem test pry`
32
+ 3. Finally choose 'Yes' to upload the results.
33
+
27
34
  Example: Interacting with an object at runtime
28
35
  ---------------------------------------
29
36
 
@@ -160,6 +167,8 @@ end.
160
167
  * Pry gives good control over nested sessions (important when exploring complicated runtime state)
161
168
  * Pry is not based on the IRB codebase.
162
169
  * Pry allows significant customizability.
170
+ * Pry uses the [method_source](https://github.com/banister/method_source) gem; so
171
+ this functionality is available to a Pry session.
163
172
  * Pry uses [RubyParser](https://github.com/seattlerb/ruby_parser) to
164
173
  validate expressions in 1.8, and [Ripper](http://rdoc.info/docs/ruby-core/1.9.2/Ripper) for 1.9.
165
174
  * Pry implements all the methods in the REPL chain separately: `Pry#r`
@@ -233,6 +242,7 @@ If you want to access a method of the same name, prefix the invocation by whites
233
242
  * `ls_imethods` List all instance methods defined on receiver.
234
243
  * `cat <var>` Calls `inspect` on `<var>`
235
244
  * `cd <var>` Starts a `Pry` session on the variable <var>. E.g `cd @x`
245
+ (use `cd ..` to go back).
236
246
  * `show_method <methname>` Displays the sourcecode for the method
237
247
  <methname>. E.g `show_method hello`
238
248
  * `show_imethod <methname>` Displays the sourcecode for the
@@ -245,8 +255,7 @@ If you want to access a method of the same name, prefix the invocation by whites
245
255
  * `nesting` Shows Pry nesting information.
246
256
  * `!pry` Starts a Pry session on the implied receiver; this can be
247
257
  used in the middle of an expression in multi-line input.
248
- * `jump_to <nest_level>` Unwinds the Pry stack (nesting level) until the appropriate nesting level is reached
249
- -- as per the output of `nesting`
258
+ * `jump_to <nest_level>` Unwinds the Pry stack (nesting level) until the appropriate nesting level is reached.
250
259
  * `exit_all` breaks out of all Pry nesting levels and returns to the
251
260
  calling process.
252
261
  * You can type `Pry.start(obj)` or `obj.pry` to nest another Pry session within the
data/Rakefile CHANGED
@@ -32,6 +32,11 @@ task :test do
32
32
  sh "bacon -k #{direc}/test/test.rb"
33
33
  end
34
34
 
35
+ desc "display the Pry version"
36
+ task :show_version do
37
+ puts "Pry version: #{Pry::VERSION}"
38
+ end
39
+
35
40
  namespace :ruby do
36
41
  spec = Gem::Specification.new do |s|
37
42
  apply_spec_defaults(s)
@@ -29,11 +29,19 @@ class Pry
29
29
  end
30
30
 
31
31
  unless respond_to? :__binding_impl__
32
- self.class.class_eval <<-EXTRA
33
- def __binding_impl__
34
- binding
32
+ begin
33
+ instance_eval %{
34
+ def __binding_impl__
35
+ binding
36
+ end
37
+ }
38
+ rescue TypeError
39
+ self.class.class_eval %{
40
+ def __binding_impl__
41
+ binding
42
+ end
43
+ }
35
44
  end
36
- EXTRA
37
45
  end
38
46
 
39
47
  __binding_impl__
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.4.1pre1"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -100,8 +100,45 @@ describe Pry do
100
100
  end
101
101
  end
102
102
 
103
+ describe "defining methods" do
104
+ it 'should define a method on the singleton class of an object when performing "def meth;end" inside the object' do
105
+ [Object.new, {}, []].each do |val|
106
+ str_input = StringIO.new("def hello;end")
107
+ Pry.new(:input => str_input, :output => StringIO.new).rep(val)
108
+
109
+ val.methods(false).map(&:to_sym).include?(:hello).should == true
110
+ end
111
+ end
112
+
113
+ it 'should define an instance method on the module when performing "def meth;end" inside the module' do
114
+ str_input = StringIO.new("def hello;end")
115
+ hello = Module.new
116
+ Pry.new(:input => str_input, :output => StringIO.new).rep(hello)
117
+ hello.instance_methods(false).map(&:to_sym).include?(:hello).should == true
118
+ end
119
+
120
+ it 'should define an instance method on the class when performing "def meth;end" inside the class' do
121
+ str_input = StringIO.new("def hello;end")
122
+ hello = Class.new
123
+ Pry.new(:input => str_input, :output => StringIO.new).rep(hello)
124
+ hello.instance_methods(false).map(&:to_sym).include?(:hello).should == true
125
+ end
126
+
127
+ it 'should define a method on the class of an object when performing "def meth;end" inside an immediate value or Numeric' do
128
+ # should include float in here, but test fails for some reason
129
+ # on 1.8.7, no idea why!
130
+ [:test, 0, true, false, nil].each do |val|
131
+ str_input = StringIO.new("def hello;end")
132
+ Pry.new(:input => str_input, :output => StringIO.new).rep(val)
133
+ val.class.instance_methods(false).map(&:to_sym).include?(:hello).should == true
134
+ end
135
+ end
136
+
137
+ end
138
+
139
+
103
140
  describe "commands" do
104
- it 'should run command1' do
141
+ it 'should run a command with no parameter' do
105
142
  pry_tester = Pry.new
106
143
  pry_tester.commands = CommandTester
107
144
  pry_tester.input = InputTester.new("command1", "exit_all")
@@ -115,7 +152,7 @@ describe Pry do
115
152
  str_output.string.should =~ /command1/
116
153
  end
117
154
 
118
- it 'should run command2' do
155
+ it 'should run a command with one parameter' do
119
156
  pry_tester = Pry.new
120
157
  pry_tester.commands = CommandTester
121
158
  pry_tester.input = InputTester.new("command2 horsey", "exit_all")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- hash: 274698070
5
- prerelease: true
4
+ hash: 13
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1pre1
10
- version: 0.4.1pre1
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Mair (banisterfiend)
@@ -113,14 +113,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
- - - ">"
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
- hash: 25
118
+ hash: 3
119
119
  segments:
120
- - 1
121
- - 3
122
- - 1
123
- version: 1.3.1
120
+ - 0
121
+ version: "0"
124
122
  requirements: []
125
123
 
126
124
  rubyforge_project: