pry 0.7.0pre4-java → 0.7.1-java

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 15/3/2011 version 0.7.0
2
+ * add pry-doc support with syntax highlighting for docs
3
+ * add 'mj' option to ls (restrict to singleton methods)
4
+ * add _ex_ local to hold last exception raised in an exception
5
+
1
6
  6/3/2011 version 0.6.8
2
7
  * add whereami command, a la the `ir_b` gem
3
8
  * make whereami run at the start of every session
@@ -22,9 +22,14 @@ is trivial to set it to read from any object that has a `readline` method and wr
22
22
  `puts` method - many other aspects of Pry are also configurable making
23
23
  it a good choice for implementing custom shells.
24
24
 
25
- Pry now comes with an executable so it can be invoked at the command line.
25
+ Pry comes with an executable so it can be invoked at the command line.
26
26
  Just enter `pry` to start. A `.pryrc` file in the user's home directory will
27
- be loaded if it exists. Type `pry --help` at the command line for more information.
27
+ be loaded if it exists. Type `pry --help` at the command line for more
28
+ information.
29
+
30
+ Try `gem install pry-doc` for additional documentation on Ruby Core
31
+ methods. The additional docs are accessed through the `show-doc` and
32
+ `show-method` commands.
28
33
 
29
34
  * Install the [gem](https://rubygems.org/gems/pry): `gem install pry`
30
35
  * Read the [documentation](http://rdoc.info/github/banister/pry/master/file/README.markdown)
@@ -163,10 +168,12 @@ end.
163
168
  ###Features:
164
169
 
165
170
  * Pry can be invoked at any time and on any object in the running program.
171
+ * Additional documentation and source code for Ruby Core methods are supported when the `pry-doc` gem is installed.
166
172
  * Pry sessions can nest arbitrarily deeply -- to go back one level of nesting type 'exit' or 'quit' or 'back'
167
173
  * Pry comes with syntax highlighting on by default just use the `toggle-color` command to turn it on and off.
168
174
  * Use `_` to recover last result.
169
175
  * Use `_pry_` to reference the Pry instance managing the current session.
176
+ * Use `_ex_` to recover the last exception.
170
177
  * Pry supports tab completion.
171
178
  * Pry has multi-line support built in.
172
179
  * Use `^d` (control-d) to quickly break out of a session.
@@ -38,15 +38,15 @@ class Pry
38
38
  get_method_object = lambda do |meth_name, target, options|
39
39
  if options[:M]
40
40
  target.eval("instance_method(:#{meth_name})")
41
- elsif options[:m]
41
+ elsif options[:m]
42
42
  target.eval("method(:#{meth_name})")
43
- else
44
- begin
45
- target.eval("method(:#{meth_name})")
46
- rescue
47
- target.eval("instance_method(:#{meth_name})")
48
- end
43
+ else
44
+ begin
45
+ target.eval("instance_method(:#{meth_name})")
46
+ rescue
47
+ target.eval("method(:#{meth_name})")
49
48
  end
49
+ end
50
50
  end
51
51
 
52
52
  make_header = lambda do |file, line, code_type|
@@ -414,13 +414,12 @@ e.g: eval-file -c self "hello.rb"
414
414
  target.eval("#{obj}.pry")
415
415
  end
416
416
 
417
- # FIXME!!! the last matcher doesn't work on "+nil+ or +false+", it
418
- # doesn't accurately strip the +
419
417
  process_comment_markup = lambda do |comment, code_type|
420
418
  comment.gsub(/<code>(?:\s*\n)?(.*?)\s*<\/code>/m) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }.
421
419
  gsub(/<em>(?:\s*\n)?(.*?)\s*<\/em>/m) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
422
420
  gsub(/<i>(?:\s*\n)?(.*?)\s*<\/i>/m) { Pry.color ? "\e[34m#{$1}\e[0m" : $1 }.
423
- gsub(/\B\+(.*)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }
421
+ gsub(/\B\+(\w*?)\+\B/) { Pry.color ? "\e[32m#{$1}\e[0m": $1 }.
422
+ gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { Pry.color ? CodeRay.scan($1, code_type).term : $1 }
424
423
  end
425
424
 
426
425
  strip_leading_hash_from_ruby_comments = lambda do |comment|
@@ -434,7 +433,7 @@ e.g: eval-file -c self "hello.rb"
434
433
 
435
434
  OptionParser.new do |opts|
436
435
  opts.banner = %{Usage: show-doc [OPTIONS] [METH]
437
- Show the comments above method METH. Shows _method_ comments (rather than instance methods) by default.
436
+ Show the comments above method METH. Tries instance methods first and then methods by default.
438
437
  e.g show-doc hello_method
439
438
  --
440
439
  }
@@ -473,7 +472,6 @@ e.g show-doc hello_method
473
472
  end
474
473
 
475
474
  code_type = :ruby
476
-
477
475
  if Pry.has_pry_doc && meth.source_location.nil?
478
476
  info = Pry::MethodInfo.info_for(meth)
479
477
  if !info
@@ -483,7 +481,13 @@ e.g show-doc hello_method
483
481
  doc = info.docstring
484
482
  code_type = info.source_type
485
483
  else
486
- doc = strip_leading_hash_from_ruby_comments.call(meth.comment)
484
+ begin
485
+ doc = meth.comment
486
+ rescue
487
+ output.puts "Cannot locate source for this method: #{meth_name}. Try `gem install pry-doc` to get access to Ruby Core documentation."
488
+ next
489
+ end
490
+ doc = strip_leading_hash_from_ruby_comments.call(doc)
487
491
  end
488
492
 
489
493
  doc = process_comment_markup.call(doc, code_type)
@@ -508,7 +512,7 @@ e.g show-doc hello_method
508
512
 
509
513
  OptionParser.new do |opts|
510
514
  opts.banner = %{Usage: show-method [OPTIONS] [METH]
511
- Show the source for method METH. Shows _method_ source (rather than instance methods) by default.
515
+ Show the source for method METH. Tries instance methods first and then methods by default.
512
516
  e.g: show-method hello_method
513
517
  --
514
518
  }
@@ -553,7 +557,7 @@ e.g: show-method hello_method
553
557
  # Try to find source for C methods using MethodInfo (if possible)
554
558
  if Pry.has_pry_doc && meth.source_location.nil?
555
559
  info = Pry::MethodInfo.info_for(meth)
556
- if !info
560
+ if !info || !info.source
557
561
  output.puts "Cannot find source for C method: #{meth_name}"
558
562
  next
559
563
  end
@@ -561,7 +565,12 @@ e.g: show-method hello_method
561
565
  code = strip_comments_from_c_code.call(code)
562
566
  code_type = info.source_type
563
567
  else
564
- code = meth.source
568
+ begin
569
+ code = meth.source
570
+ rescue
571
+ output.puts "Cannot locate source for this method: #{meth_name}. Try `gem install pry-doc` to get access to Ruby Core documentation."
572
+ next
573
+ end
565
574
  end
566
575
 
567
576
  file, line = meth.source_location
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.7.0pre4"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- hash: -766259871
5
- prerelease: true
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 7
9
- - 0pre4
10
- version: 0.7.0pre4
8
+ - 1
9
+ version: 0.7.1
11
10
  platform: java
12
11
  authors:
13
12
  - John Mair (banisterfiend)
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-03-15 00:00:00 +13:00
17
+ date: 2011-03-16 00:00:00 +13:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 5
30
28
  segments:
31
29
  - 2
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 53
46
43
  segments:
47
44
  - 0
48
45
  - 9
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 19
62
58
  segments:
63
59
  - 1
64
60
  - 1
@@ -74,7 +70,6 @@ dependencies:
74
70
  requirements:
75
71
  - - "="
76
72
  - !ruby/object:Gem::Version
77
- hash: 23
78
73
  segments:
79
74
  - 0
80
75
  - 2
@@ -135,21 +130,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
130
  requirements:
136
131
  - - ">="
137
132
  - !ruby/object:Gem::Version
138
- hash: 3
139
133
  segments:
140
134
  - 0
141
135
  version: "0"
142
136
  required_rubygems_version: !ruby/object:Gem::Requirement
143
137
  none: false
144
138
  requirements:
145
- - - ">"
139
+ - - ">="
146
140
  - !ruby/object:Gem::Version
147
- hash: 25
148
141
  segments:
149
- - 1
150
- - 3
151
- - 1
152
- version: 1.3.1
142
+ - 0
143
+ version: "0"
153
144
  requirements: []
154
145
 
155
146
  rubyforge_project: