pry 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 21/2/2010 version 0.5.7
2
+ * Added pry executable, auto-loads .pryrc in user's home directory, if it
3
+ exists.
4
+
1
5
  19/2/2010 version 0.5.5
2
6
  * Added Pry.run_command
3
7
  * More useful error messages
@@ -21,6 +21,10 @@ is trivial to set it to read from any object that has a `readline` method and wr
21
21
  `puts` method - many other aspects of Pry are also configurable making
22
22
  it a good choice for implementing custom shells.
23
23
 
24
+ Pry now comes with an executable so it can be invoked at the command line.
25
+ Just enter `pry` to start. A `.pryrc` file in the user's home directory will
26
+ be loaded if it exists. Type `pry --help` at the command line for more information.
27
+
24
28
  * Install the [gem](https://rubygems.org/gems/pry): `gem install pry`
25
29
  * Read the [documentation](http://rdoc.info/github/banister/pry/master/file/README.markdown)
26
30
  * See the [source code](http://github.com/banister/pry)
@@ -101,11 +105,11 @@ an instance variable inside that class:
101
105
  Beginning Pry session for 20
102
106
  pry(20:2)> self + 10
103
107
  => 30
104
- pry(20:2)> exit
108
+ pry(20:2)> cd ..
105
109
  Ending Pry session for 20
106
- pry(Hello):1> exit
110
+ pry(Hello):1> cd ..
107
111
  Ending Pry session for Hello
108
- pry(main)> exit
112
+ pry(main)> cd ..
109
113
  Ending Pry session for main
110
114
 
111
115
  The number after the `:` in the pry prompt indicates the nesting
@@ -180,10 +184,6 @@ invoke any of these methods directly depending on exactly what aspect of the fun
180
184
 
181
185
  ###Limitations:
182
186
 
183
- * Pry does not pretend to be a replacement for `irb`,
184
- and so does not have an executable. It is designed to be used by
185
- other programs, not on its own. For a full-featured `irb` replacement
186
- see [ripl](https://github.com/cldwalker/ripl)
187
187
  * Pry's `show-method` and `show-doc` commands do not work
188
188
  in Ruby 1.8.
189
189
 
data/Rakefile CHANGED
@@ -24,6 +24,7 @@ def apply_spec_defaults(s)
24
24
  s.add_development_dependency("bacon",">=1.1.0")
25
25
  s.homepage = "http://banisterfiend.wordpress.com"
26
26
  s.has_rdoc = 'yard'
27
+ s.executables = ["pry"]
27
28
  s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*.rb", "examples/**/*.rb",
28
29
  "test/*.rb", "CHANGELOG", "LICENSE", "README.markdown", "Rakefile", ".gemtest"]
29
30
  end
data/bin/pry ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # (C) John Mair (banisterfiend)
4
+ # MIT license
5
+
6
+ begin
7
+ require 'pry'
8
+ rescue LoadError
9
+ require 'rubygems'
10
+ require 'pry'
11
+ end
12
+ require "optparse"
13
+
14
+ # defaults
15
+ options = {
16
+ :context => TOPLEVEL_BINDING,
17
+ :loadrc => true
18
+ }
19
+
20
+ OptionParser.new do |opts|
21
+ opts.banner = %{Usage: pry [OPTIONS]
22
+ Start a Pry session.
23
+ See: `https://github.com/banister` for more information.
24
+ --
25
+ }
26
+ opts.on("-r", "--require FILE", "`require` a Ruby script at startup.") do |file|
27
+ require file
28
+ end
29
+
30
+ opts.on("-e", "--exec CODE", "A line of Ruby code to execute in context before the session starts.") do |code|
31
+ options[:code] = code
32
+ end
33
+
34
+ opts.on("-f", "Suppress loading of ~/.pryrc") do
35
+ options[:loadrc] = false
36
+ end
37
+
38
+ opts.on("-v", "--version", "Display the Pry version.") do
39
+ puts "Pry version #{Pry::VERSION} on Ruby #{RUBY_VERSION}"
40
+ exit
41
+ end
42
+
43
+ opts.on("-c", "--context CONTEXT",
44
+ "Start the session in the specified context. Equivalent to `context.pry` in a session.") do |context|
45
+ options[:context] = Pry.binding_for(eval(context))
46
+ end
47
+
48
+ opts.on_tail("-h", "--help", "This message.") do
49
+ puts opts
50
+ exit
51
+ end
52
+ end.parse!
53
+
54
+ rcpath = File.expand_path("~/.pryrc")
55
+
56
+ # load ~/.pryrc, if not suppressed with -f option
57
+ load rcpath if File.exists?(rcpath) && options[:loadrc]
58
+
59
+ # execute line of code, if provided with -e option
60
+ options[:context].eval(options[:code]) if options[:code]
61
+
62
+ # start the session
63
+ options[:context].pry
@@ -465,6 +465,25 @@ e.g: show-method hello_method
465
465
  end
466
466
  end
467
467
 
468
+ command "east-coker", "" do
469
+ text = %{
470
+ --
471
+ Now the light falls
472
+ Across the open field, leaving the deep lane
473
+ Shuttered with branches, dark in the afternoon,
474
+ Where you lean against a bank while a van passes,
475
+ And the deep lane insists on the direction
476
+ Into the village, in the electric heat
477
+ Hypnotised. In a warm haze the sultry light
478
+ Is absorbed, not refracted, by grey stone.
479
+ The dahlias sleep in the empty silence.
480
+ Wait for the early owl.
481
+ -- T.S Eliot
482
+ }
483
+ output.puts text
484
+ text
485
+ end
486
+
468
487
  command "cohen-poem", "" do
469
488
  text = %{
470
489
  --
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-02-19 00:00:00.000000000 +13:00
12
+ date: 2011-02-21 00:00:00.000000000 +13:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_parser
17
- requirement: &17241432 !ruby/object:Gem::Requirement
17
+ requirement: &17058996 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 2.0.5
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *17241432
25
+ version_requirements: *17058996
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: method_source
28
- requirement: &17241156 !ruby/object:Gem::Requirement
28
+ requirement: &17003496 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *17241156
36
+ version_requirements: *17003496
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bacon
39
- requirement: &17124828 !ruby/object:Gem::Requirement
39
+ requirement: &17003220 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,11 @@ dependencies:
44
44
  version: 1.1.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *17124828
47
+ version_requirements: *17003220
48
48
  description: attach an irb-like session to any object at runtime
49
49
  email: jrmair@gmail.com
50
- executables: []
50
+ executables:
51
+ - pry
51
52
  extensions: []
52
53
  extra_rdoc_files: []
53
54
  files:
@@ -79,6 +80,7 @@ files:
79
80
  - README.markdown
80
81
  - Rakefile
81
82
  - .gemtest
83
+ - bin/pry
82
84
  has_rdoc: true
83
85
  homepage: http://banisterfiend.wordpress.com
84
86
  licenses: []