ripl 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +58 -1
- data/bin/ripl +1 -1
- data/lib/ripl.rb +25 -0
- data/lib/ripl/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -8,13 +8,70 @@ Install the gem with:
|
|
8
8
|
|
9
9
|
sudo gem install ripl
|
10
10
|
|
11
|
+
== Features
|
12
|
+
|
13
|
+
* Same as irb
|
14
|
+
* Reads ~/.irbrc on startup
|
15
|
+
* Appends to ~/.irb_history on exit
|
16
|
+
* Autocompletion (from bond)
|
17
|
+
* _ for last result
|
18
|
+
* Type 'exit' or Ctrl-D to exit
|
19
|
+
* Commandline options: -r, -I, -v
|
20
|
+
* Enhancements over irb
|
21
|
+
* ~/.irbrc errors caught
|
22
|
+
* Provides hooks for plugins
|
23
|
+
* Method argument and customizable autocompletion (from bond)
|
24
|
+
* Less than 150 loc vs irb's 5000+ loc
|
25
|
+
* Simple configuration i.e. one hash
|
26
|
+
* Different from irb
|
27
|
+
* No multi-line evaluation
|
28
|
+
* No irb subsessions or workspaces
|
29
|
+
* No IRB.conf features i.e. dynamic prompts and auto indent
|
30
|
+
* Most commandline options not supported
|
31
|
+
|
32
|
+
== Philosophy
|
33
|
+
|
34
|
+
ripl is a light, flexible repl(shell) meant to lay the foundation for customizable ruby shells. It
|
35
|
+
provides an environment for plugins to share and reuse best practices for shells. ripl can be
|
36
|
+
easily customized for gems, applications and is even usable on the web (examples forthcoming).
|
37
|
+
|
11
38
|
== Usage
|
12
39
|
|
13
40
|
$ ripl
|
14
41
|
>> ...
|
15
42
|
|
43
|
+
== Create Custom Shells
|
44
|
+
|
45
|
+
Creating a custom shell is as simple as:
|
46
|
+
|
47
|
+
#!/usr/bin/env ruby
|
48
|
+
|
49
|
+
require 'ripl'
|
50
|
+
# Do whatever setup you want ...
|
51
|
+
Ripl.start
|
52
|
+
|
53
|
+
Ripl.start takes options to customize your shell. For example if you wanted to
|
54
|
+
start on a specific binding:
|
55
|
+
|
56
|
+
Ripl.start :binding => my_desired_binding
|
57
|
+
|
58
|
+
== Create Commands
|
59
|
+
|
60
|
+
If you want to invoke your custom shell with ripl, make it a ripl command.
|
61
|
+
To create one, create an executable in the format ripl-<command> and make sure it's in your shell's
|
62
|
+
$PATH. For example, the file 'ripl-my_gem' would be invoked with `ripl my_gem`. Note that with your
|
63
|
+
command you can take arguments and parse your options as you please. For an example command,
|
64
|
+
see {ripl-rails}[http://github.com/cldwalker/ripl-rails].
|
65
|
+
|
16
66
|
== Credits
|
17
67
|
* janlelis for bug fix and tweaks
|
18
68
|
|
69
|
+
== irb alternatives
|
70
|
+
Some other irb alternatives which I encourage you to check out:
|
71
|
+
|
72
|
+
* {ir}[http://github.com/raggi/ir]: nice and light
|
73
|
+
* {irb2}[http://github.com/wycats/irb2]: yehuda katz's partial attempt at rewriting irb
|
74
|
+
* {dietrb}[http://github.com/alloy/dietrb]: mac and ruby 1.9 specific
|
75
|
+
|
19
76
|
== Todo
|
20
|
-
* Everything!
|
77
|
+
* Everything (tests especially)!
|
data/bin/ripl
CHANGED
data/lib/ripl.rb
CHANGED
@@ -4,6 +4,31 @@ require 'ripl/version'
|
|
4
4
|
module Ripl
|
5
5
|
extend self
|
6
6
|
|
7
|
+
def run
|
8
|
+
parse_options(ARGV)
|
9
|
+
ARGV[0] ? run_command(ARGV) : start
|
10
|
+
end
|
11
|
+
|
12
|
+
def parse_options(argv)
|
13
|
+
while argv[0] =~ /^-/
|
14
|
+
case argv.shift
|
15
|
+
when /-I=?(.*)/
|
16
|
+
$LOAD_PATH.unshift(*$1.split(":"))
|
17
|
+
when /-r=?(.*)/
|
18
|
+
require $1
|
19
|
+
when '-v', '--version'
|
20
|
+
puts Ripl::VERSION; exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_command(argv)
|
26
|
+
exec "ripl-#{argv.shift}", *argv
|
27
|
+
rescue Errno::ENOENT
|
28
|
+
raise unless $!.message =~ /No such file or directory.*ripl-(\w+)/
|
29
|
+
abort "`#{$1}' is not a ripl command."
|
30
|
+
end
|
31
|
+
|
7
32
|
def start(options={})
|
8
33
|
shell(options).loop
|
9
34
|
end
|
data/lib/ripl/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabriel Horner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-01 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|