binding.repl 0.7.0 → 0.8.0
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.txt +20 -0
- data/Gemfile +6 -2
- data/README.md +19 -8
- data/binding.repl.gemspec +14 -0
- data/lib/binding.repl.rb +8 -13
- data/lib/binding.repl/console/irb.rb +4 -8
- data/lib/binding.repl/console/pry.rb +3 -3
- data/lib/binding.repl/console/rib.rb +8 -0
- data/lib/binding.repl/console/ripl.rb +3 -3
- metadata +8 -4
data/ChangeLog.txt
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
== v0.8.0
|
2
|
+
- add "rib" as a supported console.
|
3
|
+
"rib" is inspired by ripl, the ripl-rc project, and by some of
|
4
|
+
the ideas from the pry project.
|
5
|
+
|
6
|
+
be sure to check it out if you're curious:
|
7
|
+
* https://github.com/godfat/rib
|
8
|
+
|
9
|
+
'binding.repl.rib' to try it out!
|
10
|
+
|
11
|
+
- internals shakeup
|
12
|
+
when a console is added to binding.repl it also defines an
|
13
|
+
initializer that should be run for the very first time.
|
14
|
+
|
15
|
+
binding.repl takes care of the initializer not being run again,
|
16
|
+
but the initializer is expected to do whatever it needs to make
|
17
|
+
the console available for use.
|
18
|
+
|
19
|
+
see lib/binding.repl/console/*.rb for examples.
|
20
|
+
|
1
21
|
== v0.7.0
|
2
22
|
- catch JSON parse errors when reading .binding.repl.rc
|
3
23
|
closes #7
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
__DESCRIPTION__
|
10
10
|
|
11
11
|
__binding.repl__ can start a number of different ruby consoles at runtime.
|
12
|
-
IRB, ripl, and pry(of course!) can be invoked at runtime in any context
|
12
|
+
IRB, ripl, rib, and pry(of course!) can be invoked at runtime in any context
|
13
13
|
that an instance of `Binding` closes over.
|
14
14
|
|
15
15
|
I owe all credit to John Mair([banisterfiend](https://github.com/banister)),
|
@@ -35,7 +35,7 @@ _Rails_
|
|
35
35
|
class BlogsController < ApplicationController
|
36
36
|
def show
|
37
37
|
@blog = Blog.find(params[:id])
|
38
|
-
binding.repl.{pry,irb,ripl,auto}
|
38
|
+
binding.repl.{pry,irb,ripl,rib,auto}
|
39
39
|
end
|
40
40
|
end
|
41
41
|
```
|
@@ -45,14 +45,14 @@ _Auto discovery_
|
|
45
45
|
```ruby
|
46
46
|
class Bar
|
47
47
|
# auto discover and start the first available console.
|
48
|
-
# default order is: ripl, pry, or irb.
|
48
|
+
# default order is: ripl, pry, rib, or irb.
|
49
49
|
binding.repl.auto
|
50
50
|
|
51
51
|
# change default load order
|
52
|
-
Binding.repl.auto_load_order = %w(pry ripl irb)
|
52
|
+
Binding.repl.auto_load_order = %w(pry ripl irb rib)
|
53
53
|
|
54
|
-
# remove "irb" from auto discovery
|
55
|
-
Binding.repl.auto_load_order -= ["irb"]
|
54
|
+
# remove "irb" & "rib" from auto discovery
|
55
|
+
Binding.repl.auto_load_order -= ["irb", "rib"]
|
56
56
|
end
|
57
57
|
```
|
58
58
|
|
@@ -78,7 +78,7 @@ __NOTES__
|
|
78
78
|
|
79
79
|
_CONFIGURATION_
|
80
80
|
|
81
|
-
ripl and pry can be customized by passing a set of key-value pairs but
|
81
|
+
ripl, rib, and pry can be customized by passing a set of key-value pairs but
|
82
82
|
IRB isn't as straight forward to configure and I haven't implemented
|
83
83
|
any customization options for it yet.
|
84
84
|
|
@@ -98,6 +98,17 @@ class Foo
|
|
98
98
|
end
|
99
99
|
```
|
100
100
|
|
101
|
+
rib is a little less well known ruby console that binding.repl
|
102
|
+
supports since v0.8.0. I don't know much about the options it accepts,
|
103
|
+
but it does accept some. please check out [its github page](https://github.com/godfat/rib)
|
104
|
+
if you're curious.
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
class Foo
|
108
|
+
binding.repl.rib({})
|
109
|
+
end
|
110
|
+
```
|
111
|
+
|
101
112
|
_WORKING WITH TEAMS_
|
102
113
|
|
103
114
|
people working in teams might have different choices for what ruby
|
@@ -147,7 +158,7 @@ export BINDING_REPL_ORDER=pry,irb
|
|
147
158
|
_DEPENDENCIES_
|
148
159
|
|
149
160
|
binding.repl doesn't depend on anything. it's up to you to meet the
|
150
|
-
dependencies(pry, irb, and/or ripl). `binding.repl.{ripl,pry,irb}`
|
161
|
+
dependencies(pry, irb, rib, and/or ripl). `binding.repl.{ripl,pry,rib,irb}`
|
151
162
|
will try to load the appropiate console for you if it looks like it
|
152
163
|
hasn't been loaded yet.
|
153
164
|
|
data/binding.repl.gemspec
CHANGED
@@ -18,4 +18,18 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.add_development_dependency "bundler", "~> 1.3"
|
20
20
|
spec.add_development_dependency "rake"
|
21
|
+
|
22
|
+
spec.post_install_message = <<-INSTALL_MESSAGE
|
23
|
+
|
24
|
+
** binding.repl **
|
25
|
+
Thanks for installing v#{Binding.repl.version}!
|
26
|
+
Check out the README and ChangeLog to see what's new in this release.
|
27
|
+
|
28
|
+
README.md
|
29
|
+
https://github.com/robgleeson/binding.repl/blob/v#{Binding.repl.version}/README.md
|
30
|
+
|
31
|
+
ChangeLog.txt
|
32
|
+
https://github.com/robgleeson/binding.repl/blob/v#{Binding.repl.version}/ChangeLog.txt
|
33
|
+
|
34
|
+
INSTALL_MESSAGE
|
21
35
|
end
|
data/lib/binding.repl.rb
CHANGED
@@ -18,7 +18,7 @@ class BindingRepl
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.version
|
21
|
-
"0.
|
21
|
+
"0.8.0"
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.disabled?
|
@@ -34,8 +34,8 @@ class BindingRepl
|
|
34
34
|
@disabled = true
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.add(console,
|
38
|
-
LOOKUP[console] = [
|
37
|
+
def self.add(console, initializer, runner)
|
38
|
+
LOOKUP[console] = [initializer, runner]
|
39
39
|
define_method(console) do |options = {}|
|
40
40
|
exit_value = invoke_console(console, options)
|
41
41
|
invoke_failed?(exit_value) ? fail!(console) : exit_value
|
@@ -80,19 +80,13 @@ private
|
|
80
80
|
if Binding.repl.disabled?
|
81
81
|
return :'binding.repl.disabled'
|
82
82
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
initializer, runner = @lookup[console]
|
84
|
+
initializer.call
|
85
|
+
@lookup[console] = [@lookup.default.at(0), runner]
|
86
|
+
runner.call @binding, options
|
86
87
|
rescue LoadError
|
87
88
|
:'binding.repl.load_error'
|
88
89
|
end
|
89
|
-
|
90
|
-
def require_console(console, predicate)
|
91
|
-
already_required = predicate.call
|
92
|
-
if !already_required
|
93
|
-
require(console.to_s)
|
94
|
-
end
|
95
|
-
end
|
96
90
|
end
|
97
91
|
|
98
92
|
klass = BindingRepl
|
@@ -105,4 +99,5 @@ end
|
|
105
99
|
require_relative "binding.repl/console/pry"
|
106
100
|
require_relative "binding.repl/console/irb"
|
107
101
|
require_relative "binding.repl/console/ripl"
|
102
|
+
require_relative "binding.repl/console/rib"
|
108
103
|
require_relative "binding.repl/rc"
|
@@ -1,16 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
initializer = lambda do
|
2
|
+
require "irb"
|
3
|
+
IRB.setup(nil)
|
3
4
|
end
|
4
5
|
|
5
|
-
irb_setup = false
|
6
6
|
runner = lambda do |binding, options|
|
7
|
-
unless irb_setup
|
8
|
-
IRB.setup(nil)
|
9
|
-
irb_setup = true
|
10
|
-
end
|
11
7
|
irb = IRB::Irb.new IRB::WorkSpace.new(binding)
|
12
8
|
IRB.conf[:MAIN_CONTEXT] = irb.context
|
13
9
|
trap("SIGINT") { irb.signal_handle }
|
14
10
|
catch(:IRB_EXIT) { irb.eval_input }
|
15
11
|
end
|
16
|
-
Binding.repl.add :irb,
|
12
|
+
Binding.repl.add :irb, initializer, runner
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
initializer = lambda do
|
2
|
+
require "ripl"
|
3
3
|
end
|
4
4
|
runner = lambda do |binding, options|
|
5
5
|
Ripl.start options.merge(binding: binding)
|
6
6
|
end
|
7
|
-
Binding.repl.add :ripl,
|
7
|
+
Binding.repl.add :ripl, initializer, runner
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binding.repl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -62,12 +62,16 @@ files:
|
|
62
62
|
- lib/binding.repl.rb
|
63
63
|
- lib/binding.repl/console/irb.rb
|
64
64
|
- lib/binding.repl/console/pry.rb
|
65
|
+
- lib/binding.repl/console/rib.rb
|
65
66
|
- lib/binding.repl/console/ripl.rb
|
66
67
|
- lib/binding.repl/rc.rb
|
67
68
|
homepage: https://github.com/robgleeson/binding.repl
|
68
69
|
licenses:
|
69
70
|
- MIT
|
70
|
-
post_install_message:
|
71
|
+
post_install_message: ! "\n ** binding.repl **\n Thanks for installing v0.8.0!\n
|
72
|
+
\ Check out the README and ChangeLog to see what's new in this release.\n\n README.md\n
|
73
|
+
\ https://github.com/robgleeson/binding.repl/blob/v0.8.0/README.md\n\n ChangeLog.txt\n
|
74
|
+
\ https://github.com/robgleeson/binding.repl/blob/v0.8.0/ChangeLog.txt\n\n"
|
71
75
|
rdoc_options: []
|
72
76
|
require_paths:
|
73
77
|
- lib
|
@@ -85,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
89
|
version: '0'
|
86
90
|
segments:
|
87
91
|
- 0
|
88
|
-
hash:
|
92
|
+
hash: 4383143691404002571
|
89
93
|
requirements: []
|
90
94
|
rubyforge_project:
|
91
95
|
rubygems_version: 1.8.23
|