binding.repl 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/.pryrc +2 -3
- data/ChangeLog.txt +5 -0
- data/doc/disableatruntime.md +11 -8
- data/doc/runtimeoptions.md +24 -20
- data/lib/binding.repl.rb +12 -6
- data/lib/binding.repl/console/irb.rb +1 -1
- data/lib/binding.repl/console/pry.rb +1 -1
- data/lib/binding.repl/console/rib.rb +1 -1
- data/lib/binding.repl/console/ripl.rb +1 -1
- data/lib/binding.repl/core_ext/binding.rb +1 -1
- data/lib/binding.repl/env.rb +3 -8
- data/lib/binding.repl/version.rb +1 -1
- data/test/binding_repl_auto_test.rb +1 -1
- data/test/binding_repl_env_test.rb +3 -17
- data/test/binding_repl_test.rb +24 -0
- metadata +32 -25
- data/.binding.repl.rc +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
5
|
-
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cffcaf44dd2b6fa21dc2193251407a26f8bbd8be
|
4
|
+
data.tar.gz: 992180899557219bc351a42762061616c19e7242
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4d27fb0d57feb67ba74c351043d3512b6a9edc942d607a95a1f0fdf0069d6d4b75e8017b3b15a017491c77d8b6d15ebbe6a68077fd465f25a9d88594fabbc750
|
7
|
+
data.tar.gz: 405ccf998fc7816a63033e694170058eddb2dd3a0d7a83bd9a5172a2d62a5bcf82584e073d1f94896b7c7d46510db7d43cc29984bade4406e624036fa2730a03
|
data/.pryrc
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
require "binding.repl"
|
1
|
+
require "bundler"
|
2
|
+
Bundler.require :default
|
data/ChangeLog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== v1.0.1 (2014-02-10)
|
2
|
+
- BindingRepl::ENV.auto_order is lazy loaded and not on 'require'.
|
3
|
+
- remove sample file ".binding.repl.rc" from repository and rubygem. (forgot in v1.0.0)
|
4
|
+
- remove BindingRepl::ENV.enable_rc_file? (forgot in v1.0.0)
|
5
|
+
|
1
6
|
== v1.0.0 (2014-02-09)
|
2
7
|
- add binding.repl!
|
3
8
|
a shortcut to `binding.repl.auto`. (#26)
|
data/doc/disableatruntime.md
CHANGED
@@ -1,20 +1,23 @@
|
|
1
|
-
__ENABLE
|
1
|
+
__ENABLE OR DISABLE AT RUNTIME__
|
2
2
|
|
3
|
-
binding.repl can be enabled or disabled at runtime.
|
4
|
-
|
3
|
+
binding.repl can be enabled or disabled at runtime. <br>
|
4
|
+
the default state is 'enabled'.
|
5
|
+
|
6
|
+
__DISABLE__
|
5
7
|
|
6
8
|
```ruby
|
7
9
|
class Foo
|
8
|
-
|
9
|
-
binding.repl.irb
|
10
|
+
BindingRepl.disable!
|
11
|
+
value = binding.repl.irb
|
12
|
+
p value.disabled? # => true
|
10
13
|
end
|
11
14
|
```
|
12
15
|
|
13
|
-
|
16
|
+
__ENABLE__
|
14
17
|
|
15
18
|
```ruby
|
16
19
|
class Foo
|
17
|
-
|
18
|
-
binding.repl.irb # opens
|
20
|
+
BindingRepl.enable!
|
21
|
+
value = binding.repl.irb # opens irb on 'Foo'.
|
19
22
|
end
|
20
23
|
```
|
data/doc/runtimeoptions.md
CHANGED
@@ -1,42 +1,46 @@
|
|
1
1
|
__RUNTIME OPTIONS__
|
2
2
|
|
3
|
-
|
3
|
+
_pry_
|
4
4
|
|
5
|
-
pry
|
5
|
+
[pry](https://github.com/pry/pry) supports a large number of options for runtime configuration. <br>
|
6
|
+
a full list of options are available at [Pry.start(…) (API Docs)](http://rubydoc.info/github/banister/pry/Pry#start-class_method)
|
6
7
|
|
7
8
|
```ruby
|
8
|
-
class
|
9
|
+
class Person
|
9
10
|
binding.repl.pry quiet: true
|
10
11
|
end
|
11
12
|
```
|
12
13
|
|
13
|
-
|
14
|
+
_rib_
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
check out [its github page](https://github.com/cldwalker/ripl) for more information.
|
16
|
+
[rib](https://github.com/godfat/rib) is a little less well known ruby repl that binding.repl supports since v0.8.0. <br>
|
17
|
+
a full list of options are available at [Rib.anchor(…) (API Docs)](http://rdoc.info/github/godfat/rib/Rib/Anchor/Imp#anchor-instance_method)
|
18
18
|
|
19
19
|
```ruby
|
20
|
-
class
|
21
|
-
binding.repl.
|
20
|
+
class Alien
|
21
|
+
binding.repl.rib prompt: ">> ", result_prompt: "# => "
|
22
22
|
end
|
23
23
|
```
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
[rib](https://github.com/godfat/rib) is a little less well known ruby console that binding.repl
|
28
|
-
supports since v0.8.0. it can be configured to change the prompt and the prefix inserted before
|
29
|
-
a return value.
|
25
|
+
_ripl_
|
30
26
|
|
31
|
-
|
32
|
-
|
27
|
+
[ripl](https://github.com/cldwalker/ripl) supports (some) runtime configuration. <br>
|
28
|
+
I couldn't find API docs for `Ripl.start(..)`, so I recommend checking out the github
|
29
|
+
page to learn more.
|
33
30
|
|
34
31
|
```ruby
|
35
|
-
class
|
36
|
-
binding.repl.
|
32
|
+
class Sink
|
33
|
+
binding.repl.ripl riplrc: false
|
37
34
|
end
|
38
35
|
```
|
39
36
|
|
40
|
-
|
37
|
+
_note about irb_
|
41
38
|
|
42
|
-
binding.repl doesn't implement
|
39
|
+
binding.repl doesn't implement runtime options for IRB because it wasn't immediately obvious
|
40
|
+
how IRB is configured at runtime (it looks like `IRB.conf` might be used)
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
class Car
|
44
|
+
binding.repl.irb
|
45
|
+
end
|
46
|
+
```
|
data/lib/binding.repl.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
class BindingRepl
|
2
2
|
LOOKUP = {}
|
3
3
|
LOOKUP.default = [proc { true }, proc { :'binding.repl.unknown_console' }]
|
4
|
-
|
4
|
+
DEFAULT_AUTO_ORDER = ["pry", "ripl", "rib", "irb"].freeze
|
5
|
+
|
6
|
+
def self.auto_order=(list)
|
7
|
+
@auto_order = list
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.auto_order
|
11
|
+
@auto_order or BindingRepl::ENV.auto_order or DEFAULT_AUTO_ORDER
|
12
|
+
end
|
5
13
|
|
6
14
|
#
|
7
15
|
# returns true when binding.repl is disabled.
|
@@ -74,10 +82,10 @@ class BindingRepl
|
|
74
82
|
# returns an instance of {BindingRepl::ExitValue} when the repl has exited.
|
75
83
|
#
|
76
84
|
def auto
|
77
|
-
consoles =
|
85
|
+
consoles = BindingRepl.auto_order
|
78
86
|
value = run_any_console(consoles)
|
79
87
|
if consoles.empty?
|
80
|
-
raise LoadError, "no consoles available to load.
|
88
|
+
raise LoadError, "no consoles available to load. BindingRepl.auto_order is empty"
|
81
89
|
elsif value.nil?
|
82
90
|
consoles_str = consoles.join(", ")
|
83
91
|
raise LoadError, "attempts to require any of the following consoles failed: #{consoles_str}"
|
@@ -101,7 +109,7 @@ private
|
|
101
109
|
|
102
110
|
def run_console(console, options = {})
|
103
111
|
console = console.to_s
|
104
|
-
if
|
112
|
+
if BindingRepl.disabled?
|
105
113
|
value = BindingRepl::ExitValue.disabled_value
|
106
114
|
else
|
107
115
|
initializer, runner = @lookup[console]
|
@@ -115,7 +123,6 @@ private
|
|
115
123
|
return BindingRepl::ExitValue.new(value)
|
116
124
|
end
|
117
125
|
end
|
118
|
-
|
119
126
|
require_relative "binding.repl/core_ext/binding"
|
120
127
|
require_relative "binding.repl/env"
|
121
128
|
require_relative "binding.repl/exit_value"
|
@@ -124,4 +131,3 @@ require_relative "binding.repl/console/pry"
|
|
124
131
|
require_relative "binding.repl/console/irb"
|
125
132
|
require_relative "binding.repl/console/ripl"
|
126
133
|
require_relative "binding.repl/console/rib"
|
127
|
-
BindingRepl.auto_order = BindingRepl::ENV.auto_order
|
data/lib/binding.repl/env.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
module BindingRepl::ENV
|
2
2
|
@env = ::ENV
|
3
|
-
DEFAULT_AUTO_ORDER = ["pry", "ripl", "rib", "irb"]
|
4
3
|
DELIMITER_REGEXP = /[:,]/
|
5
4
|
|
6
|
-
module_function
|
7
|
-
def enable_rc_file?
|
8
|
-
@env['disable_rc'] != 'true' and @env['disable_rc'] != '1'
|
9
|
-
end
|
10
|
-
|
11
5
|
def auto_order
|
12
|
-
|
13
|
-
|
6
|
+
list = @env['auto_order'].to_s.split(DELIMITER_REGEXP)
|
7
|
+
list.empty? ? nil : list
|
14
8
|
end
|
9
|
+
module_function :auto_order
|
15
10
|
end
|
data/lib/binding.repl/version.rb
CHANGED
@@ -26,7 +26,7 @@ class BindingReplAutoTest < MiniTest::Test
|
|
26
26
|
def test_no_matches_on_auto
|
27
27
|
BindingRepl.auto_order = []
|
28
28
|
e = assert_raises(LoadError) {binding.repl.auto}
|
29
|
-
assert_equal "no consoles available to load.
|
29
|
+
assert_equal "no consoles available to load. BindingRepl.auto_order is empty", e.message
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_no_requireable_console_on_auto
|
@@ -1,26 +1,12 @@
|
|
1
1
|
require_relative "setup"
|
2
2
|
class BindingReplEnvTest < MiniTest::Test
|
3
3
|
def teardown
|
4
|
-
ENV.delete "disable_rc"
|
5
4
|
ENV.delete "auto_order"
|
6
5
|
end
|
7
6
|
|
8
|
-
def
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def test_disable_of_rc_file_with_true
|
13
|
-
ENV["disable_rc"] = 'true'
|
14
|
-
assert_equal false, BindingRepl::ENV.enable_rc_file?
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_disable_of_rc_file_with_one
|
18
|
-
ENV["disable_rc"] = '1'
|
19
|
-
assert_equal false, BindingRepl::ENV.enable_rc_file?
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_default_of_auto_order
|
23
|
-
assert_equal BindingRepl::ENV::DEFAULT_AUTO_ORDER, BindingRepl.auto_order
|
7
|
+
def test_unset_auto_order_shell_var
|
8
|
+
ENV["auto_order"] = nil
|
9
|
+
assert_equal nil, BindingRepl::ENV.auto_order
|
24
10
|
end
|
25
11
|
|
26
12
|
def test_auto_order_defined_by_shell
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "setup"
|
2
|
+
class BindingReplTest < MiniTest::Test
|
3
|
+
def setup
|
4
|
+
@before = BindingRepl.auto_order.dup
|
5
|
+
end
|
6
|
+
|
7
|
+
def teardown
|
8
|
+
BindingRepl.auto_order = @before
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_default_return_value_of_auto_order
|
12
|
+
assert_equal BindingRepl::DEFAULT_AUTO_ORDER, BindingRepl.auto_order
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_set_of_new_auto_order
|
16
|
+
BindingRepl.auto_order = ["a", "b"]
|
17
|
+
assert_equal ["a", "b"], BindingRepl.auto_order
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_set_of_nil_on_auto_order
|
21
|
+
BindingRepl.auto_order = nil
|
22
|
+
assert_equal BindingRepl::DEFAULT_AUTO_ORDER, BindingRepl.auto_order
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: binding.repl
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Public Domain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
11
|
+
|
12
|
+
date: 2014-02-10 00:00:00 Z
|
12
13
|
dependencies: []
|
14
|
+
|
13
15
|
description: binding.repl can start a number of different ruby consoles at runtime
|
14
|
-
email:
|
16
|
+
email:
|
15
17
|
- robert@flowof.info
|
16
18
|
executables: []
|
19
|
+
|
17
20
|
extensions: []
|
21
|
+
|
18
22
|
extra_rdoc_files: []
|
19
|
-
|
20
|
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
23
|
+
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- .pryrc
|
27
|
+
- .travis.yml
|
24
28
|
- ChangeLog.txt
|
25
29
|
- Gemfile
|
26
30
|
- README.md
|
@@ -46,6 +50,7 @@ files:
|
|
46
50
|
- test/binding_repl_pry_test.rb
|
47
51
|
- test/binding_repl_rib_test.rb
|
48
52
|
- test/binding_repl_ripl_test.rb
|
53
|
+
- test/binding_repl_test.rb
|
49
54
|
- test/binding_test.rb
|
50
55
|
- test/isolation/lazy_irb_require_test.rb
|
51
56
|
- test/isolation/lazy_pry_require_test.rb
|
@@ -54,39 +59,40 @@ files:
|
|
54
59
|
- test/setup.rb
|
55
60
|
- test/support/binding.repl/rspec_mocks.rb
|
56
61
|
homepage: https://github.com/robgleeson/binding.repl
|
57
|
-
licenses:
|
62
|
+
licenses:
|
58
63
|
- Public Domain
|
59
64
|
metadata: {}
|
60
|
-
|
61
|
-
|
62
|
-
ChangeLog.txt:
|
63
|
-
https://github.com/robgleeson/binding.repl/blob/v1.0.0/ChangeLog.txt
|
65
|
+
|
66
|
+
post_install_message: " == binding.repl v1.0.1\n ChangeLog.txt:\n https://github.com/robgleeson/binding.repl/blob/v1.0.1/ChangeLog.txt\n"
|
64
67
|
rdoc_options: []
|
65
|
-
|
68
|
+
|
69
|
+
require_paths:
|
66
70
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
69
73
|
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
74
|
+
- !ruby/object:Gem::Version
|
71
75
|
version: 1.9.2
|
72
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
74
78
|
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version:
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
77
81
|
requirements: []
|
82
|
+
|
78
83
|
rubyforge_project:
|
79
84
|
rubygems_version: 2.2.2
|
80
85
|
signing_key:
|
81
86
|
specification_version: 4
|
82
87
|
summary: binding.repl can start a number of different ruby consoles at runtime
|
83
|
-
test_files:
|
88
|
+
test_files:
|
84
89
|
- test/binding_repl_auto_test.rb
|
85
90
|
- test/binding_repl_env_test.rb
|
86
91
|
- test/binding_repl_irb_test.rb
|
87
92
|
- test/binding_repl_pry_test.rb
|
88
93
|
- test/binding_repl_rib_test.rb
|
89
94
|
- test/binding_repl_ripl_test.rb
|
95
|
+
- test/binding_repl_test.rb
|
90
96
|
- test/binding_test.rb
|
91
97
|
- test/isolation/lazy_irb_require_test.rb
|
92
98
|
- test/isolation/lazy_pry_require_test.rb
|
@@ -94,3 +100,4 @@ test_files:
|
|
94
100
|
- test/isolation/lazy_ripl_require_test.rb
|
95
101
|
- test/setup.rb
|
96
102
|
- test/support/binding.repl/rspec_mocks.rb
|
103
|
+
has_rdoc:
|
data/.binding.repl.rc
DELETED