1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

version 0.5.7, added Pry executable, pry --help at command line for more info

This commit is contained in:
John Mair 2011-02-21 05:54:18 +13:00
parent 99c0cb3545
commit 22d31c0b92
6 changed files with 92 additions and 5 deletions

View file

@ -1,3 +1,7 @@
21/2/2010 version 0.5.7
* Added pry executable, auto-loads .pryrc in user's home directory, if it
exists.
19/2/2010 version 0.5.5
* Added Pry.run_command
* More useful error messages

View file

@ -21,6 +21,10 @@ is trivial to set it to read from any object that has a `readline` method and wr
`puts` method - many other aspects of Pry are also configurable making
it a good choice for implementing custom shells.
Pry now comes with an executable so it can be invoked at the command line.
Just enter `pry` to start. A `.pryrc` file in the user's home directory will
be loaded if it exists. Type `pry --help` at the command line for more information.
* Install the [gem](https://rubygems.org/gems/pry): `gem install pry`
* Read the [documentation](http://rdoc.info/github/banister/pry/master/file/README.markdown)
* See the [source code](http://github.com/banister/pry)
@ -180,10 +184,6 @@ invoke any of these methods directly depending on exactly what aspect of the fun
###Limitations:
* Pry does not pretend to be a replacement for `irb`,
and so does not have an executable. It is designed to be used by
other programs, not on its own. For a full-featured `irb` replacement
see [ripl](https://github.com/cldwalker/ripl)
* Pry's `show-method` and `show-doc` commands do not work
in Ruby 1.8.

View file

@ -24,6 +24,7 @@ def apply_spec_defaults(s)
s.add_development_dependency("bacon",">=1.1.0")
s.homepage = "http://banisterfiend.wordpress.com"
s.has_rdoc = 'yard'
s.executables = ["pry"]
s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*.rb", "examples/**/*.rb",
"test/*.rb", "CHANGELOG", "LICENSE", "README.markdown", "Rakefile", ".gemtest"]
end

63
bin/pry Normal file
View file

@ -0,0 +1,63 @@
#!/usr/bin/env ruby
# (C) John Mair (banisterfiend)
# MIT license
begin
require 'pry'
rescue LoadError
require 'rubygems'
require 'pry'
end
require "optparse"
# defaults
options = {
:context => TOPLEVEL_BINDING,
:loadrc => true
}
OptionParser.new do |opts|
opts.banner = %{Usage: pry [OPTIONS]
Start a Pry session.
See: `https://github.com/banister` for more information.
--
}
opts.on("-r", "--require FILE", "`require` a Ruby script at startup.") do |file|
require file
end
opts.on("-e", "--exec CODE", "A line of Ruby code to execute in context before the session starts.") do |code|
options[:code] = code
end
opts.on("-f", "Suppress loading of ~/.pryrc") do
options[:loadrc] = false
end
opts.on("-v", "--version", "Display the Pry version.") do
puts "Pry version #{Pry::VERSION} on Ruby #{RUBY_VERSION}"
exit
end
opts.on("-c", "--context CONTEXT",
"Start the session in the specified context. Equivalent to `context.pry` in a session.") do |context|
options[:context] = Pry.binding_for(eval(context))
end
opts.on_tail("-h", "--help", "This message.") do
puts opts
exit
end
end.parse!
rcpath = File.expand_path("~/.pryrc")
# load ~/.pryrc, if not suppressed with -f option
load rcpath if File.exists?(rcpath) && options[:loadrc]
# execute line of code, if provided with -e option
options[:context].eval(options[:code]) if options[:code]
# start the session
options[:context].pry

View file

@ -465,6 +465,25 @@ e.g: show-method hello_method
end
end
command "east-coker", "" do
text = %{
--
Now the light falls
Across the open field, leaving the deep lane
Shuttered with branches, dark in the afternoon,
Where you lean against a bank while a van passes,
And the deep lane insists on the direction
Into the village, in the electric heat
Hypnotised. In a warm haze the sultry light
Is absorbed, not refracted, by grey stone.
The dahlias sleep in the empty silence.
Wait for the early owl.
-- T.S Eliot
}
output.puts text
text
end
command "cohen-poem", "" do
text = %{
--

View file

@ -1,3 +1,3 @@
class Pry
VERSION = "0.5.6"
VERSION = "0.5.7"
end