rib 0.1.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.gitignore +0 -4
  2. data/CHANGES.md +6 -0
  3. data/README +107 -113
  4. data/README.md +107 -113
  5. data/Rakefile +5 -3
  6. data/TODO.md +6 -0
  7. data/bin/rib-all +5 -0
  8. data/bin/rib-auto +9 -0
  9. data/bin/rib-min +5 -0
  10. data/bin/rib-rails +9 -0
  11. data/bin/rib-ramaze +9 -0
  12. data/lib/rib.rb +70 -6
  13. data/lib/rib/all.rb +0 -1
  14. data/lib/rib/api.rb +60 -64
  15. data/lib/rib/app/auto.rb +25 -0
  16. data/lib/rib/app/rails.rb +41 -0
  17. data/lib/rib/app/ramaze.rb +25 -0
  18. data/lib/rib/config.rb +3 -0
  19. data/lib/rib/core.rb +13 -1
  20. data/lib/rib/core/completion.rb +15 -3
  21. data/lib/rib/core/history.rb +56 -0
  22. data/lib/rib/core/multiline.rb +104 -0
  23. data/lib/rib/core/readline.rb +3 -1
  24. data/lib/rib/core/squeeze_history.rb +45 -0
  25. data/lib/rib/core/strip_backtrace.rb +45 -0
  26. data/lib/rib/core/underscore.rb +17 -8
  27. data/lib/rib/debug.rb +2 -1
  28. data/lib/rib/dep/hirb.rb +24 -0
  29. data/lib/rib/more.rb +4 -3
  30. data/lib/rib/more/anchor.rb +85 -0
  31. data/lib/rib/more/color.rb +44 -43
  32. data/lib/rib/{zore → more}/edit.rb +3 -3
  33. data/lib/rib/more/multiline_history.rb +24 -12
  34. data/lib/rib/more/multiline_history_file.rb +7 -3
  35. data/lib/rib/plugin.rb +2 -4
  36. data/lib/rib/runner.rb +84 -49
  37. data/lib/rib/shell.rb +4 -2
  38. data/lib/rib/test.rb +55 -2
  39. data/lib/rib/test/multiline.rb +140 -0
  40. data/lib/rib/version.rb +1 -1
  41. data/rib.gemspec +54 -22
  42. data/screenshot.png +0 -0
  43. data/task/gemgem.rb +3 -1
  44. data/test/core/{test_history_file.rb → test_history.rb} +29 -19
  45. data/test/core/test_multiline.rb +22 -0
  46. data/test/core/test_readline.rb +13 -8
  47. data/test/{more → core}/test_squeeze_history.rb +24 -18
  48. data/test/core/test_underscore.rb +32 -21
  49. data/test/more/test_multiline_history.rb +42 -0
  50. data/test/test_shell.rb +13 -8
  51. metadata +72 -27
  52. data/2011-02-28.md +0 -203
  53. data/CHANGES +0 -86
  54. data/TODO +0 -6
  55. data/lib/rib/core/history_file.rb +0 -38
  56. data/lib/rib/more/multiline.rb +0 -77
  57. data/lib/rib/more/squeeze_history.rb +0 -37
  58. data/lib/rib/more/strip_backtrace.rb +0 -43
  59. data/lib/rib/zore.rb +0 -3
  60. data/lib/rib/zore/anchor.rb +0 -69
data/.gitignore CHANGED
@@ -1,6 +1,2 @@
1
1
  pkg
2
- rdoc
3
2
  *.rbc
4
- .bundle
5
- .yardoc
6
- Gemfile.lock
data/CHANGES.md ADDED
@@ -0,0 +1,6 @@
1
+ # Rib CHANGES
2
+
3
+ ## Rib 0.9.0 -- 2011-08-14
4
+
5
+ * First serious release!
6
+ * So much enhancement over ripl-rc!
data/README CHANGED
@@ -1,175 +1,169 @@
1
- # ripl-rc
1
+ # Rib
2
2
 
3
3
  by Lin Jen-Shin ([godfat](http://godfat.org))
4
4
 
5
5
  ## LINKS:
6
6
 
7
- * [github](https://github.com/godfat/ripl-rc)
8
- * [rubygems](http://rubygems.org/gems/ripl-rc)
7
+ * [github](https://github.com/godfat/rib)
8
+ * [rubygems](http://rubygems.org/gems/rib)
9
9
 
10
10
  ## DESCRIPTION:
11
11
 
12
- ripl plugins collection, take you want, leave you don't.
12
+ Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
13
13
 
14
- ## REQUIREMENTS:
15
-
16
- * Tested with MRI 1.8.7, 1.9.2 and Rubinius 1.2.3, JRuby 1.6.0
17
- * ripl
18
-
19
- ## INSTALLATION:
20
-
21
- gem install ripl-rc
14
+ Rib is based on the design of [ripl][] and the work of [ripl-rc][], some of
15
+ the features are also inspired by [pry][]. The aim of Rib is to be fully
16
+ featured and yet very easy to opt-out or opt-in other features. It shall
17
+ be simple, lightweight and modular so that everyone could customize Rib.
22
18
 
23
- ## SYNOPSIS:
24
-
25
- If you don't know what is __ripl__, or just want to have an
26
- overview of what does __ripl-rc__ do, then you can use it as
27
- a command line tool:
19
+ [ripl]: https://github.com/cldwalker/ripl
20
+ [ripl-rc]: https://github.com/godfat/ripl-rc
21
+ [pry]: https://github.com/pry/pry
28
22
 
29
- ripl rc
23
+ ## REQUIREMENTS:
30
24
 
31
- This can be used to run rails console, too. First install
32
- _ripl-rails_ by `gem install ripl-rails` then run this:
25
+ * Tested with MRI 1.8.7, 1.9.2 and Rubinius 1.2, JRuby 1.6
26
+ * All gem dependencies are optional, but it's highly recommended to use
27
+ Rib with [bond][] for tab completion.
33
28
 
34
- ripl rc rails
29
+ [bond]: https://github.com/cldwalker/bond
35
30
 
36
- Then you'll have a _ripl-rc_ flavored rails console without
37
- setting anything (i.e. `~/.riplrc`)
31
+ ## INSTALLATION:
38
32
 
39
- If you already know what is _ripl_, you might want to setup
40
- yourself, to be better control what you might want and what
41
- you might not want. Then checkout FEATURES for all plugins
42
- you can put in `~/.riplrc`.
33
+ gem install rib
43
34
 
44
- If you want to enable all plugins, the use this:
35
+ ## SYNOPSIS:
45
36
 
46
- require 'ripl/rc'
37
+ ![Screenshot](https://github.com/godfat/rib/raw/master/screenshot.png)
47
38
 
48
- Another thing which might worth to be mentioned is
49
- `ripl/rc/anchor`, which is a _pry_ like feature built into
50
- ripl. You can embed two things into ripl, one is any object:
39
+ ### As an interactive shell
51
40
 
52
- Ripl.anchor your_object_want_to_be_viewed_as_self
41
+ As IRB (reads `~/.config/rib/config.rb` writes `~/.config/rib/history.rb`)
53
42
 
54
- Another one is local binding inside a method:
43
+ rib
55
44
 
56
- Ripl.anchor binding
45
+ As Rails console
57
46
 
58
- Then you can look through local variables inside a method
59
- with an interactive environment. Anchor could be nested, too.
60
- You can anchor another object inside a _ripl_ session. The number
61
- shown in prompt is the level of anchors, started from 1.
47
+ rib rails
62
48
 
63
- ![Screenshot](https://github.com/godfat/ripl-rc/raw/master/screenshot.png)
49
+ As Ramaze console
64
50
 
65
- Please read this blog post for other detail since I haven't
66
- had time to update this README... Sorry about that.
51
+ rib ramaze
67
52
 
68
- * [a new feature mainly for anchor in ripl-rc ](http://blogger.godfat.org/2011/06/new-feature-mainly-for-anchor-in-ripl.html)
53
+ As a console for whichever the app in the current path
54
+ it should be (for now, it's either Rails or Ramaze)
69
55
 
70
- ## FEATURES:
56
+ rib auto
71
57
 
72
- upon session ends:
58
+ As a fully featured interactive Ruby shell (as ripl-rc)
73
59
 
74
- * `require 'ripl/rc/squeeze_history'`
60
+ rib all
75
61
 
76
- Which squeezes the same input in history, both in memory
77
- and history file.
62
+ As a fully featured app console (yes, some commands could be used together)
78
63
 
79
- * `require 'ripl/rc/mkdir_history'`
64
+ rib all auto # or `rib auto all`, the order doesn't really matter
80
65
 
81
- Which calls `mkdir -p` on directory which contains history
82
- file. For example, I put my irb_history in an directory
83
- might not exist before use: `~/.config/irb/irb_history`
66
+ You can customize Rib's behaviour by setting `~/.config/rib/config.rb` (by
67
+ default). Since it's merely a Ruby script which would be loaded into memory
68
+ before launching Rib shell session, You can put any customization or monkey
69
+ patch there. Personally, I use all plugins provided by Rib.
84
70
 
85
- * `require 'ripl/rc/ctrld_newline'`
71
+ <https://github.com/godfat/dev-tool/blob/master/.config/rib/config.rb>
86
72
 
87
- Ruby 1.9.2 has no this problem in irb, but 1.8 and ripl do.
88
- When hitting ctrl+d to exit ripl, it would print a newline
89
- instead of messing up with shell prompt.
73
+ As you can see, putting `require 'rib/all'` into config file is exactly the
74
+ same as running `rib all` without a config file. What `rib all` would do is
75
+ merely require the file, and that file is also merely requiring all plugins.
76
+ Suppose you only want to use the core plugins and color plugin, you'll put
77
+ this into your config file:
90
78
 
91
- upon exception occurs:
79
+ require 'rib/core'
80
+ require 'rib/more/color'
92
81
 
93
- * `require 'ripl/rc/last_exception'`
82
+ You can also write your plugins there. Here's another example:
94
83
 
95
- We can't access $! for last exception because input evaluation
96
- is not in the block which rescues the exception, neither can we
97
- update $! because it's a read only pseudo global variable.
84
+ require 'rib/core'
85
+ require 'pp'
86
+ Rib.config[:prompt] = '$ '
98
87
 
99
- This plugin makes last rescued exception stored in `Ripl.last_exception`
88
+ module RibPP
89
+ Rib::Shell.send(:include, self)
100
90
 
101
- upon formatting output:
91
+ def format_result result
92
+ result_prompt + result.pretty_inspect
93
+ end
94
+ end
102
95
 
103
- * `require 'ripl/rc/strip_backtrace'`
96
+ So that we override the original format_result to pretty_inspect the result.
97
+ You can also build your own gem and then simply require it in your config
98
+ file. To see a list of overridable API, please read [api.rb][]
104
99
 
105
- ripl prints the full backtrace upon exceptions, even the
106
- exceptions come from interactive environment, making it
107
- very verbose. This ripl plugin strips those backtrace.
100
+ [api.rb]: https://github.com/godfat/rib/blob/master/lib/rib/api.rb
108
101
 
109
- * `require 'ripl/rc/color'`
102
+ #### Basic configuration
110
103
 
111
- There's ripl-color_result that make use of <a href="https://github.com/michaeldv/awesome_print">awesome_print</a>,
112
- <a href="http://coderay.rubychan.de/">coderay</a>, or <a href="https://github.com/janlelis/wirb">wirb</a>. The problem of awesome_print is it's too
113
- awesome and too verbose, and the problem of coderay and
114
- wirb is that they are both parser based. In ripl, this should
115
- be as simple as just print different colors upon different
116
- objects, instead of inspecting it and parsing it.
104
+ <pre>
105
+ Rib.config[:config] | The path where config should be located
106
+ Rib.config[:name] | The name of this shell
107
+ Rib.config[:result_prompt] | Default is "=>"
108
+ Rib.config[:prompt] | Default is ">>"
109
+ Rib.config[:binding] | Context, default: TOPLEVEL_BINDING
110
+ Rib.config[:exit] | Commands to exit, default [nil, 'exit', 'quit']
111
+ </pre>
117
112
 
118
- ripl/rc/color just uses a hash with Class to color mapping
119
- to pick up which color should be used upon a ruby object.
113
+ #### Plugin specific configuration
120
114
 
121
- To customize the color schema, inspect `Ripl.config[:rc_color]`
115
+ <pre>
116
+ Rib.config[:completion] | Completion: Bond config
117
+ Rib.config[:history_file] | Default is "~/.rib/config/history.rb"
118
+ Rib.config[:history_size] | Default is 500
119
+ Rib.config[:color] | A hash of Class => :color mapping
120
+ </pre>
122
121
 
123
- upon input:
122
+ ### As a debugging/interacting tool
124
123
 
125
- * `require 'ripl/rc/multiline'`
124
+ Rib could be used as a kind of debugging tool which you can set break point
125
+ in the source program.
126
126
 
127
- I need some modification on ripl-multi_line to make prompt
128
- work better, but not sure if I can come up a good fix and
129
- try to convince the author to accept those patches. So I
130
- just bundle and maintain it on my own. If you're using
131
- ripl-rc, you could use this plugin, otherwise, keep using
132
- ripl-multi_line.
127
+ require 'rib/config' # This would load your ~/.config/rib/config.rb
128
+ require 'rib/anchor' # If you enabled this in config, then needed not.
129
+ Rib.anchor binding # This would give you an interactive shell
130
+ # when your program has been executed here.
131
+ Rib.anchor 123 # You can also anchor on an object.
133
132
 
134
- * `require 'ripl/rc/eat_whites'`
133
+ But this might be called in a loop, you might only want to
134
+ enter the shell under certain circumstance, then you'll do:
135
135
 
136
- irb will just give you another prompt upon an empty input,
137
- while ripl would show you that your input is nil. I don't like
138
- this, because sometimes I'll keep hitting enter to separate
139
- between inspects. This plugin would skip inspect if the input
140
- is empty just like irb.
136
+ require 'rib/debug'
137
+ Rib.enable_anchor do
138
+ # Only `Rib.anchor` called in the block would launch a shell
139
+ end
141
140
 
142
- special tool:
141
+ Rib.anchor binding # No effect (no-op) outside the block
143
142
 
144
- * `require 'ripl/rc/anchor'`
143
+ Anchor could also be nested. The level would be shown on the prompt,
144
+ starting from 1.
145
145
 
146
- So this is my attempt to emulate pry in ripl. Instead
147
- trying to make pry support irb_history, colorizing, etc.,
148
- I think implement pry like feature in ripl is a lot easier.
149
- No need to be fancy, I just need the basic functionality.
146
+ ### In place editing
150
147
 
151
- To use it, use:
152
- <pre><code>Ripl.anchor your_object_want_to_be_viewed_as_self</code></pre>
153
- or
154
- <pre><code>Ripl.anchor binding</code></pre>
155
- in your code. Other than pry ripl support, you might be
156
- interested in <a href="https://github.com/cldwalker/ripl-rails">ripl-rails</a> and <a href="https://github.com/cldwalker/ripl-hijack">ripl-hijack</a>, too.
148
+ Whenever you called:
157
149
 
158
- about config:
150
+ Rib.edit
159
151
 
160
- * `require 'ripl/rc/noirbrc'`
152
+ Rib would open an editor according to $EDITOR (`ENV['EDITOR']`) for you.
153
+ After save and leave the editor, Rib would evaluate what you had input.
154
+ This also works inside an anchor. To use it, require either rib/more/edit
155
+ or rib/more or rib/all.
161
156
 
162
- By default ripl is reading `~/.irbrc`. I don't think this
163
- is what people still using irb would want, because the
164
- configuration is totally different. This suppress that,
165
- make it only read `~/.riplrc`
157
+ ### As a shell framework
166
158
 
167
- for lazies:
159
+ The essence is:
168
160
 
169
- * `require 'ripl/rc'`
161
+ require 'rib'
170
162
 
171
- This requires anything above for you, and is what `ripl rc`
172
- and `ripl rc rails` shell commands did.
163
+ All others are optional. The core plugins are lying in `rib/core/*.rb`, and
164
+ more plugins are lying in `rib/more/*.rb`. You can read `rib/app/ramaze.rb`
165
+ and `bin/rib-ramaze` as a Rib App reference implementation, because it's very
166
+ simple, simpler than rib-rails.
173
167
 
174
168
  ## LICENSE:
175
169
 
data/README.md CHANGED
@@ -1,175 +1,169 @@
1
- # ripl-rc
1
+ # Rib
2
2
 
3
3
  by Lin Jen-Shin ([godfat](http://godfat.org))
4
4
 
5
5
  ## LINKS:
6
6
 
7
- * [github](https://github.com/godfat/ripl-rc)
8
- * [rubygems](http://rubygems.org/gems/ripl-rc)
7
+ * [github](https://github.com/godfat/rib)
8
+ * [rubygems](http://rubygems.org/gems/rib)
9
9
 
10
10
  ## DESCRIPTION:
11
11
 
12
- ripl plugins collection, take you want, leave you don't.
12
+ Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
13
13
 
14
- ## REQUIREMENTS:
15
-
16
- * Tested with MRI 1.8.7, 1.9.2 and Rubinius 1.2.3, JRuby 1.6.0
17
- * ripl
18
-
19
- ## INSTALLATION:
20
-
21
- gem install ripl-rc
14
+ Rib is based on the design of [ripl][] and the work of [ripl-rc][], some of
15
+ the features are also inspired by [pry][]. The aim of Rib is to be fully
16
+ featured and yet very easy to opt-out or opt-in other features. It shall
17
+ be simple, lightweight and modular so that everyone could customize Rib.
22
18
 
23
- ## SYNOPSIS:
24
-
25
- If you don't know what is __ripl__, or just want to have an
26
- overview of what does __ripl-rc__ do, then you can use it as
27
- a command line tool:
19
+ [ripl]: https://github.com/cldwalker/ripl
20
+ [ripl-rc]: https://github.com/godfat/ripl-rc
21
+ [pry]: https://github.com/pry/pry
28
22
 
29
- ripl rc
23
+ ## REQUIREMENTS:
30
24
 
31
- This can be used to run rails console, too. First install
32
- _ripl-rails_ by `gem install ripl-rails` then run this:
25
+ * Tested with MRI 1.8.7, 1.9.2 and Rubinius 1.2, JRuby 1.6
26
+ * All gem dependencies are optional, but it's highly recommended to use
27
+ Rib with [bond][] for tab completion.
33
28
 
34
- ripl rc rails
29
+ [bond]: https://github.com/cldwalker/bond
35
30
 
36
- Then you'll have a _ripl-rc_ flavored rails console without
37
- setting anything (i.e. `~/.riplrc`)
31
+ ## INSTALLATION:
38
32
 
39
- If you already know what is _ripl_, you might want to setup
40
- yourself, to be better control what you might want and what
41
- you might not want. Then checkout FEATURES for all plugins
42
- you can put in `~/.riplrc`.
33
+ gem install rib
43
34
 
44
- If you want to enable all plugins, the use this:
35
+ ## SYNOPSIS:
45
36
 
46
- require 'ripl/rc'
37
+ ![Screenshot](https://github.com/godfat/rib/raw/master/screenshot.png)
47
38
 
48
- Another thing which might worth to be mentioned is
49
- `ripl/rc/anchor`, which is a _pry_ like feature built into
50
- ripl. You can embed two things into ripl, one is any object:
39
+ ### As an interactive shell
51
40
 
52
- Ripl.anchor your_object_want_to_be_viewed_as_self
41
+ As IRB (reads `~/.config/rib/config.rb` writes `~/.config/rib/history.rb`)
53
42
 
54
- Another one is local binding inside a method:
43
+ rib
55
44
 
56
- Ripl.anchor binding
45
+ As Rails console
57
46
 
58
- Then you can look through local variables inside a method
59
- with an interactive environment. Anchor could be nested, too.
60
- You can anchor another object inside a _ripl_ session. The number
61
- shown in prompt is the level of anchors, started from 1.
47
+ rib rails
62
48
 
63
- ![Screenshot](https://github.com/godfat/ripl-rc/raw/master/screenshot.png)
49
+ As Ramaze console
64
50
 
65
- Please read this blog post for other detail since I haven't
66
- had time to update this README... Sorry about that.
51
+ rib ramaze
67
52
 
68
- * [a new feature mainly for anchor in ripl-rc ](http://blogger.godfat.org/2011/06/new-feature-mainly-for-anchor-in-ripl.html)
53
+ As a console for whichever the app in the current path
54
+ it should be (for now, it's either Rails or Ramaze)
69
55
 
70
- ## FEATURES:
56
+ rib auto
71
57
 
72
- upon session ends:
58
+ As a fully featured interactive Ruby shell (as ripl-rc)
73
59
 
74
- * `require 'ripl/rc/squeeze_history'`
60
+ rib all
75
61
 
76
- Which squeezes the same input in history, both in memory
77
- and history file.
62
+ As a fully featured app console (yes, some commands could be used together)
78
63
 
79
- * `require 'ripl/rc/mkdir_history'`
64
+ rib all auto # or `rib auto all`, the order doesn't really matter
80
65
 
81
- Which calls `mkdir -p` on directory which contains history
82
- file. For example, I put my irb_history in an directory
83
- might not exist before use: `~/.config/irb/irb_history`
66
+ You can customize Rib's behaviour by setting `~/.config/rib/config.rb` (by
67
+ default). Since it's merely a Ruby script which would be loaded into memory
68
+ before launching Rib shell session, You can put any customization or monkey
69
+ patch there. Personally, I use all plugins provided by Rib.
84
70
 
85
- * `require 'ripl/rc/ctrld_newline'`
71
+ <https://github.com/godfat/dev-tool/blob/master/.config/rib/config.rb>
86
72
 
87
- Ruby 1.9.2 has no this problem in irb, but 1.8 and ripl do.
88
- When hitting ctrl+d to exit ripl, it would print a newline
89
- instead of messing up with shell prompt.
73
+ As you can see, putting `require 'rib/all'` into config file is exactly the
74
+ same as running `rib all` without a config file. What `rib all` would do is
75
+ merely require the file, and that file is also merely requiring all plugins.
76
+ Suppose you only want to use the core plugins and color plugin, you'll put
77
+ this into your config file:
90
78
 
91
- upon exception occurs:
79
+ require 'rib/core'
80
+ require 'rib/more/color'
92
81
 
93
- * `require 'ripl/rc/last_exception'`
82
+ You can also write your plugins there. Here's another example:
94
83
 
95
- We can't access $! for last exception because input evaluation
96
- is not in the block which rescues the exception, neither can we
97
- update $! because it's a read only pseudo global variable.
84
+ require 'rib/core'
85
+ require 'pp'
86
+ Rib.config[:prompt] = '$ '
98
87
 
99
- This plugin makes last rescued exception stored in `Ripl.last_exception`
88
+ module RibPP
89
+ Rib::Shell.send(:include, self)
100
90
 
101
- upon formatting output:
91
+ def format_result result
92
+ result_prompt + result.pretty_inspect
93
+ end
94
+ end
102
95
 
103
- * `require 'ripl/rc/strip_backtrace'`
96
+ So that we override the original format_result to pretty_inspect the result.
97
+ You can also build your own gem and then simply require it in your config
98
+ file. To see a list of overridable API, please read [api.rb][]
104
99
 
105
- ripl prints the full backtrace upon exceptions, even the
106
- exceptions come from interactive environment, making it
107
- very verbose. This ripl plugin strips those backtrace.
100
+ [api.rb]: https://github.com/godfat/rib/blob/master/lib/rib/api.rb
108
101
 
109
- * `require 'ripl/rc/color'`
102
+ #### Basic configuration
110
103
 
111
- There's ripl-color_result that make use of <a href="https://github.com/michaeldv/awesome_print">awesome_print</a>,
112
- <a href="http://coderay.rubychan.de/">coderay</a>, or <a href="https://github.com/janlelis/wirb">wirb</a>. The problem of awesome_print is it's too
113
- awesome and too verbose, and the problem of coderay and
114
- wirb is that they are both parser based. In ripl, this should
115
- be as simple as just print different colors upon different
116
- objects, instead of inspecting it and parsing it.
104
+ <pre>
105
+ Rib.config[:config] | The path where config should be located
106
+ Rib.config[:name] | The name of this shell
107
+ Rib.config[:result_prompt] | Default is "=>"
108
+ Rib.config[:prompt] | Default is ">>"
109
+ Rib.config[:binding] | Context, default: TOPLEVEL_BINDING
110
+ Rib.config[:exit] | Commands to exit, default [nil, 'exit', 'quit']
111
+ </pre>
117
112
 
118
- ripl/rc/color just uses a hash with Class to color mapping
119
- to pick up which color should be used upon a ruby object.
113
+ #### Plugin specific configuration
120
114
 
121
- To customize the color schema, inspect `Ripl.config[:rc_color]`
115
+ <pre>
116
+ Rib.config[:completion] | Completion: Bond config
117
+ Rib.config[:history_file] | Default is "~/.rib/config/history.rb"
118
+ Rib.config[:history_size] | Default is 500
119
+ Rib.config[:color] | A hash of Class => :color mapping
120
+ </pre>
122
121
 
123
- upon input:
122
+ ### As a debugging/interacting tool
124
123
 
125
- * `require 'ripl/rc/multiline'`
124
+ Rib could be used as a kind of debugging tool which you can set break point
125
+ in the source program.
126
126
 
127
- I need some modification on ripl-multi_line to make prompt
128
- work better, but not sure if I can come up a good fix and
129
- try to convince the author to accept those patches. So I
130
- just bundle and maintain it on my own. If you're using
131
- ripl-rc, you could use this plugin, otherwise, keep using
132
- ripl-multi_line.
127
+ require 'rib/config' # This would load your ~/.config/rib/config.rb
128
+ require 'rib/anchor' # If you enabled this in config, then needed not.
129
+ Rib.anchor binding # This would give you an interactive shell
130
+ # when your program has been executed here.
131
+ Rib.anchor 123 # You can also anchor on an object.
133
132
 
134
- * `require 'ripl/rc/eat_whites'`
133
+ But this might be called in a loop, you might only want to
134
+ enter the shell under certain circumstance, then you'll do:
135
135
 
136
- irb will just give you another prompt upon an empty input,
137
- while ripl would show you that your input is nil. I don't like
138
- this, because sometimes I'll keep hitting enter to separate
139
- between inspects. This plugin would skip inspect if the input
140
- is empty just like irb.
136
+ require 'rib/debug'
137
+ Rib.enable_anchor do
138
+ # Only `Rib.anchor` called in the block would launch a shell
139
+ end
141
140
 
142
- special tool:
141
+ Rib.anchor binding # No effect (no-op) outside the block
143
142
 
144
- * `require 'ripl/rc/anchor'`
143
+ Anchor could also be nested. The level would be shown on the prompt,
144
+ starting from 1.
145
145
 
146
- So this is my attempt to emulate pry in ripl. Instead
147
- trying to make pry support irb_history, colorizing, etc.,
148
- I think implement pry like feature in ripl is a lot easier.
149
- No need to be fancy, I just need the basic functionality.
146
+ ### In place editing
150
147
 
151
- To use it, use:
152
- <pre><code>Ripl.anchor your_object_want_to_be_viewed_as_self</code></pre>
153
- or
154
- <pre><code>Ripl.anchor binding</code></pre>
155
- in your code. Other than pry ripl support, you might be
156
- interested in <a href="https://github.com/cldwalker/ripl-rails">ripl-rails</a> and <a href="https://github.com/cldwalker/ripl-hijack">ripl-hijack</a>, too.
148
+ Whenever you called:
157
149
 
158
- about config:
150
+ Rib.edit
159
151
 
160
- * `require 'ripl/rc/noirbrc'`
152
+ Rib would open an editor according to $EDITOR (`ENV['EDITOR']`) for you.
153
+ After save and leave the editor, Rib would evaluate what you had input.
154
+ This also works inside an anchor. To use it, require either rib/more/edit
155
+ or rib/more or rib/all.
161
156
 
162
- By default ripl is reading `~/.irbrc`. I don't think this
163
- is what people still using irb would want, because the
164
- configuration is totally different. This suppress that,
165
- make it only read `~/.riplrc`
157
+ ### As a shell framework
166
158
 
167
- for lazies:
159
+ The essence is:
168
160
 
169
- * `require 'ripl/rc'`
161
+ require 'rib'
170
162
 
171
- This requires anything above for you, and is what `ripl rc`
172
- and `ripl rc rails` shell commands did.
163
+ All others are optional. The core plugins are lying in `rib/core/*.rb`, and
164
+ more plugins are lying in `rib/more/*.rb`. You can read `rib/app/ramaze.rb`
165
+ and `bin/rib-ramaze` as a Rib App reference implementation, because it's very
166
+ simple, simpler than rib-rails.
173
167
 
174
168
  ## LICENSE:
175
169