ripl-commands 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +23 -1
- data/lib/ripl/commands.rb +2 -2
- metadata +4 -4
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -46,8 +46,30 @@ Try it out:
|
|
46
46
|
>> list
|
47
47
|
=> ["list", "config", "jumps", "jump"]
|
48
48
|
|
49
|
+
== Extending Commands
|
50
|
+
|
51
|
+
Extending commands is done by including a module into Ripl::Commands. Say we wanted to extend jumps
|
52
|
+
to look nicer:
|
53
|
+
|
54
|
+
# In ~/.riplrc
|
55
|
+
require 'ripl/commands'
|
56
|
+
module Ripl::Commands::NicerJump
|
57
|
+
def jumps
|
58
|
+
super.each_with_index {|e,i| puts "#{i}: #{e.inspect}" }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
Ripl::Commands.send :include, Ripl::Commands::NicerJump
|
62
|
+
|
63
|
+
The above jump session then looks like:
|
64
|
+
|
65
|
+
>> jumps
|
66
|
+
0: main
|
67
|
+
1: "dude"
|
68
|
+
|
69
|
+
== Credits
|
70
|
+
* janlelis for bug fix
|
71
|
+
|
49
72
|
== Todo
|
50
|
-
* Explain how to extend commands
|
51
73
|
* Add exit for a jump
|
52
74
|
* Add command completion
|
53
75
|
* Fix stacktrace interference caused by jumps
|
data/lib/ripl/commands.rb
CHANGED
@@ -2,7 +2,7 @@ require 'ripl'
|
|
2
2
|
|
3
3
|
module Ripl
|
4
4
|
module Commands
|
5
|
-
VERSION = '0.1.
|
5
|
+
VERSION = '0.1.1'
|
6
6
|
|
7
7
|
module Core
|
8
8
|
def self.jumps
|
@@ -24,7 +24,7 @@ module Ripl
|
|
24
24
|
Core.jumps << obj
|
25
25
|
Ripl.shell.add_commands(obj)
|
26
26
|
end
|
27
|
-
Ripl.shell.binding = obj.
|
27
|
+
Ripl.shell.binding = obj.instance_eval{ binding }
|
28
28
|
obj
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl-commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
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-11-
|
18
|
+
date: 2010-11-19 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|