binding.repl 0.10.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -10
- data/ChangeLog.txt +15 -0
- data/Gemfile +1 -2
- data/README.md +38 -22
- data/binding.repl.gemspec +3 -12
- data/doc/exit_values.md +53 -0
- data/doc/shellvariables.md +2 -13
- data/lib/binding.repl.rb +16 -3
- data/lib/binding.repl/core_ext/binding.rb +4 -0
- data/lib/binding.repl/version.rb +1 -2
- data/test/binding_repl_auto_test.rb +2 -2
- data/test/binding_repl_irb_test.rb +1 -1
- data/test/binding_repl_pry_test.rb +1 -1
- data/test/binding_repl_rib_test.rb +1 -1
- data/test/binding_repl_ripl_test.rb +1 -1
- data/test/binding_test.rb +12 -0
- data/test/isolation/lazy_irb_require_test.rb +9 -0
- data/test/isolation/lazy_pry_require_test.rb +9 -0
- data/test/isolation/lazy_rib_require_test.rb +9 -0
- data/test/isolation/lazy_ripl_require_test.rb +9 -0
- data/test/setup.rb +1 -3
- data/test/support/binding.repl/{mock.rb → rspec_mocks.rb} +1 -1
- metadata +22 -62
- data/doc/rcfile.md +0 -20
- data/lib/binding.repl/rcfile.rb +0 -20
- data/test/binding_repl_rcfile_test.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c545da807e38567cab20601c50fdd8ffd36f8fad
|
4
|
+
data.tar.gz: 623dd1a001140557e2f1ee8821bf2d0630fe5384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ceb58d6786c6d564cea9b3f9c37ef251b4494d1f9547b2a18e7c202ab7d6f02cfb200c2da165156b3e239a10528c5d06b11024d28670f896e534d287ff2b27b1
|
7
|
+
data.tar.gz: d211a14e759a9d1cf1a5c747bdd38ba9dc3178c1512de577bb5d0f6b2315110b779f2d28d7b73b9a98f8a2cc4857d86781e003b9c25a707c71384b5abaa92540
|
data/.travis.yml
CHANGED
@@ -7,17 +7,14 @@ rvm:
|
|
7
7
|
- 2.1.0
|
8
8
|
- ruby-head
|
9
9
|
- rbx
|
10
|
-
- jruby
|
10
|
+
- jruby
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# Gemset '' does not exist, 'rvm jruby-d19 do rvm gemset create ' first, or append '--create'.
|
19
|
-
# The command "rvm use jruby-d19 --install --binary --fuzzy" failed and exited with 2 during setup.
|
20
|
-
- rvm: jruby-19mode
|
12
|
+
script:
|
13
|
+
- rake
|
14
|
+
- ruby test/isolation/lazy_irb_require_test.rb
|
15
|
+
- ruby test/isolation/lazy_pry_require_test.rb
|
16
|
+
- ruby test/isolation/lazy_rib_require_test.rb
|
17
|
+
- ruby test/isolation/lazy_ripl_require_test.rb
|
21
18
|
|
22
19
|
notifications:
|
23
20
|
email: true
|
data/ChangeLog.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== v1.0.0 (2014-02-09)
|
2
|
+
- add binding.repl!
|
3
|
+
a shortcut to `binding.repl.auto`. (#26)
|
4
|
+
|
5
|
+
- remove toml parser as a runtime dependency.
|
6
|
+
brings the number of runtime dependencies binding.repl has from 3 to 0. (#27)
|
7
|
+
|
8
|
+
- remove rc file support
|
9
|
+
if i find the time i might provide the feature in a `binding.repl-rcfile` gem.
|
10
|
+
(related #25)
|
11
|
+
|
12
|
+
- add isolation tests
|
13
|
+
add tests to test/isolation that confirm a require of "binding.repl" does not
|
14
|
+
attempt to require a console(e.g: "irb").
|
15
|
+
|
1
16
|
== v0.10.0 (2014-02-08)
|
2
17
|
- add DELIMITER_REGEXP to BindingRepl::ENV.
|
3
18
|
it is a single reference kept to /[,:]/ which is used when parsing
|
data/Gemfile
CHANGED
@@ -7,14 +7,13 @@ end
|
|
7
7
|
|
8
8
|
group :test do
|
9
9
|
gem "rspec-mocks"
|
10
|
-
gem "minitest"
|
10
|
+
gem "minitest", require: "minitest/autorun"
|
11
11
|
end
|
12
12
|
|
13
13
|
group :test, :repls do
|
14
14
|
gem 'ripl'
|
15
15
|
gem 'pry'
|
16
16
|
gem 'rib'
|
17
|
-
gem "fakefs", require: "fakefs/safe"
|
18
17
|
end
|
19
18
|
|
20
19
|
platform :rbx do
|
data/README.md
CHANGED
@@ -6,12 +6,12 @@
|
|
6
6
|
__DESCRIPTION__
|
7
7
|
|
8
8
|
__binding.repl__ can start a number of different ruby consoles at runtime.
|
9
|
-
IRB, ripl, rib, and pry(of course!) can be
|
10
|
-
that an instance of `Binding` closes over.
|
11
|
-
the
|
12
|
-
runtime and bound to
|
9
|
+
IRB, ripl, rib, and pry(of course!) can be started at runtime in any context
|
10
|
+
that an instance of `Binding` closes over. credit is owed to John Mair([banisterfiend](https://github.com/banister)),
|
11
|
+
the original author of pry, for seeing the potential in a console that can be started at
|
12
|
+
runtime and bound to a `Binding` with ease.
|
13
13
|
|
14
|
-
the interface to
|
14
|
+
the interface to start pry at runtime(`binding.pry`) has become known in a lot of circles and
|
15
15
|
I thought it'd be cool to offer the same feature to other REPLs.
|
16
16
|
|
17
17
|
__FEATURES__
|
@@ -19,9 +19,13 @@ __FEATURES__
|
|
19
19
|
- `binding.pry` for all ruby consoles
|
20
20
|
- start the consoles IRB, Pry, Ripl, or Rib at runtime
|
21
21
|
- option to auto discover and start the first available console
|
22
|
-
-
|
23
|
-
-
|
22
|
+
- default auto order is configurable via shell environment variable and at runtime.
|
23
|
+
- it can be enabled or disabled at runtime(like pry)
|
24
24
|
- easily extended to support new consoles.
|
25
|
+
- lazy require of consoles (e.g: `binding.repl.irb` requires "irb"). <br>
|
26
|
+
`Kernel#require` is never called more than once for a given console.
|
27
|
+
- zero (gemspec) runtime dependencies.
|
28
|
+
- ships with a helpful [doc/](https://github.com/robgleeson/binding.repl/tree/master/doc) directory
|
25
29
|
|
26
30
|
__EXAMPLES__
|
27
31
|
|
@@ -38,30 +42,27 @@ end
|
|
38
42
|
|
39
43
|
_Auto discovery_
|
40
44
|
|
41
|
-
the first available console can be loaded with `binding.repl.auto
|
42
|
-
is defined `["pry", "ripl", "rib", "irb"]` but
|
43
|
-
|
45
|
+
the first available console can be loaded with `binding.repl.auto` or if you're in a
|
46
|
+
hurry `binding.repl!`. the default order is defined as `["pry", "ripl", "rib", "irb"]` but
|
47
|
+
it can be changed at runtime and with shell environment variables.
|
44
48
|
|
45
49
|
```ruby
|
46
50
|
class Foo
|
47
51
|
# auto discover and start the first available console.
|
48
52
|
binding.repl.auto
|
49
53
|
|
50
|
-
#
|
51
|
-
|
54
|
+
# same as 'binding.repl.auto' but in a hurry
|
55
|
+
binding.repl!
|
56
|
+
|
57
|
+
# change default load order of auto (irb first, etc..)
|
58
|
+
BindingRepl.auto_order = ["irb", "ripl"]
|
52
59
|
end
|
53
60
|
```
|
54
61
|
|
55
62
|
__DOCS__
|
56
63
|
|
57
|
-
- RCFILE <br>
|
58
|
-
configure the default order of `binding.repl.auto` with an RC file.
|
59
|
-
|
60
|
-
see [doc/rcfile.md](https://github.com/robgleeson/binding.repl/blob/master/doc/rcfile.md)
|
61
|
-
|
62
64
|
- SHELL ENVIRONMENT VARIABLES <br>
|
63
|
-
|
64
|
-
envionment variables.
|
65
|
+
configure the default order used by `binding.repl.auto` with shell envionment variables.
|
65
66
|
|
66
67
|
see [doc/shellvariables.md](https://github.com/robgleeson/binding.repl/blob/master/doc/shellvariables.md)
|
67
68
|
|
@@ -72,6 +73,11 @@ __DOCS__
|
|
72
73
|
|
73
74
|
see [doc/runtimeoptions.md](https://github.com/robgleeson/binding.repl/blob/master/doc/runtimeoptions.md)
|
74
75
|
|
76
|
+
- EXIT VALUES <br>
|
77
|
+
binding.repl and repl exit values.
|
78
|
+
|
79
|
+
see [doc/exit_values.md](https://github.com/robgleeson/binding.repl/blob/master/doc/exit_values.md)
|
80
|
+
|
75
81
|
- ENABLE/DISABLE AT RUNTIME <br>
|
76
82
|
binding.repl can be enabled or disabled at runtime.
|
77
83
|
|
@@ -79,9 +85,12 @@ __DOCS__
|
|
79
85
|
|
80
86
|
__DEPENDENCIES__
|
81
87
|
|
82
|
-
binding.repl
|
83
|
-
|
84
|
-
|
88
|
+
binding.repl has 0 (gemspec) runtime dependencies. <br>
|
89
|
+
irb, pry, rib, and ripl can be installed manually and binding.repl will delay their require
|
90
|
+
until you try to start a console at runtime(e.g: `binding.repl.irb`).
|
91
|
+
|
92
|
+
binding.repl has no load dependencies on external gems or the standard library. <br>
|
93
|
+
it should be light to load and prevent eager-loading of dependencies you don't use at runtime.
|
85
94
|
|
86
95
|
__RUBIES__
|
87
96
|
|
@@ -100,6 +109,13 @@ bundle install
|
|
100
109
|
rake test # run tests
|
101
110
|
```
|
102
111
|
|
112
|
+
_the isolation tests_
|
113
|
+
|
114
|
+
tests inside `test/isolation/` are meant to be run as standalone tests and are excluded
|
115
|
+
from a regular test run through 'rake test'. the tests inside `test/isolation/` make sure
|
116
|
+
a require of "binding.repl" does not attempt to require any consoles. the CI service TravisCI
|
117
|
+
takes care of running each isolation test in its own process on every push.
|
118
|
+
|
103
119
|
__INSTALL__
|
104
120
|
|
105
121
|
```
|
data/binding.repl.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.version = BindingRepl.version
|
6
6
|
spec.authors = ["Public Domain"]
|
7
7
|
spec.email = ["robert@flowof.info"]
|
8
|
-
spec.description = "binding.repl
|
8
|
+
spec.description = "binding.repl can start a number of different ruby consoles at runtime"
|
9
9
|
spec.summary = spec.description
|
10
10
|
spec.homepage = "https://github.com/robgleeson/binding.repl"
|
11
11
|
spec.license = "Public Domain"
|
@@ -16,18 +16,9 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ["lib"]
|
17
17
|
spec.required_ruby_version = ">= 1.9.2"
|
18
18
|
|
19
|
-
spec.add_runtime_dependency "toml", "~> 0.0.3"
|
20
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
-
spec.add_development_dependency "rake"
|
22
|
-
|
23
19
|
spec.post_install_message = <<-INSTALL_MESSAGE
|
24
|
-
|
25
|
-
|
26
|
-
Thanks for installing v#{BindingRepl.version}!
|
27
|
-
Check out ChangeLog.txt to read about what's changed.
|
28
|
-
|
29
|
-
ChangeLog.txt
|
20
|
+
== binding.repl v#{BindingRepl.version}
|
21
|
+
ChangeLog.txt:
|
30
22
|
https://github.com/robgleeson/binding.repl/blob/v#{BindingRepl.version}/ChangeLog.txt
|
31
|
-
|
32
23
|
INSTALL_MESSAGE
|
33
24
|
end
|
data/doc/exit_values.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
__EXIT VALUES__
|
2
|
+
|
3
|
+
a repl exit value is returned when `binding.repl.{irb,pry,ripl,rib,auto}` has <br>
|
4
|
+
been called and the repl has exited through "exit".
|
5
|
+
|
6
|
+
__IRB__
|
7
|
+
|
8
|
+
for the IRB example I used a nested IRB session who passes an exit value back <br>
|
9
|
+
through to a parent session:
|
10
|
+
|
11
|
+
```
|
12
|
+
irb(main):001:0> exit "hello world!"
|
13
|
+
=> #<BindingRepl::ExitValue:0x007fb3124e6cc8 @object="hello world!">
|
14
|
+
irb(main):002:0> method(:exit).owner
|
15
|
+
=> IRB::ExtendCommandBundle
|
16
|
+
```
|
17
|
+
|
18
|
+
__pry__
|
19
|
+
|
20
|
+
pry exits a session through a pry command called 'exit'. the difference between a <br>
|
21
|
+
pry command and a ruby method is that a command is not mapped as a ruby method in <br>
|
22
|
+
the active context. like IRB though, the exit command exists partially to allow a <br>
|
23
|
+
value to be passed back to the caller:
|
24
|
+
|
25
|
+
```
|
26
|
+
[1] pry(main)> exit "Hello!"
|
27
|
+
=> #<BindingRepl::ExitValue:0x007fd95d1f4670 @object="Hello!">
|
28
|
+
[2] pry(main)>
|
29
|
+
```
|
30
|
+
|
31
|
+
__rib__
|
32
|
+
|
33
|
+
'exit' inside rib resolves back to `Kernel#exit`. it wasn't immediately clear to me how <br>
|
34
|
+
to send back a custom value with rib but for an example you can see how it works: <br>
|
35
|
+
|
36
|
+
```
|
37
|
+
main(0)>> binding.repl.rib
|
38
|
+
main(1)>> exit
|
39
|
+
=> #<BindingRepl::ExitValue:0x007faab19cc328 @object=#<Object:0x007faab1a16d60>>
|
40
|
+
main(0)>> method(:exit).owner
|
41
|
+
=> Kernel
|
42
|
+
main(0)>>
|
43
|
+
```
|
44
|
+
|
45
|
+
__ripl__
|
46
|
+
|
47
|
+
'ripl' is similar to rib. i couldn't figure out how to pass a value back to the caller <br>
|
48
|
+
and 'exit' resolves to `Kernel#exit` like on rib: <br>
|
49
|
+
|
50
|
+
```
|
51
|
+
>> exit
|
52
|
+
=> #<BindingRepl::ExitValue:0x007faab2d2cee0 @object=nil>
|
53
|
+
```
|
data/doc/shellvariables.md
CHANGED
@@ -2,20 +2,9 @@ __SHELL ENVIRONMENT VARIABLES__
|
|
2
2
|
|
3
3
|
__$auto\_order__
|
4
4
|
|
5
|
-
binding.repl can start the first available console through `binding.repl.auto
|
6
|
-
|
7
|
-
named `auto_order` and takes precendece over an RC file when defined. values can be separated by
|
8
|
-
a comma(`,`) or a colon(`:`).
|
5
|
+
binding.repl can start the first available console through `binding.repl.auto` or the shortcut
|
6
|
+
`binding.repl!`. the default lookup order can be changed by setting an environment variable:
|
9
7
|
|
10
8
|
example
|
11
9
|
|
12
10
|
$ auto_order=pry,irb ruby myscript.rb
|
13
|
-
|
14
|
-
__$disable\_rc__
|
15
|
-
|
16
|
-
the `disable_rc` environment variable can be set to '1' or 'true' to disable or abort the load
|
17
|
-
of `$HOME/.binding.repl.rc`.
|
18
|
-
|
19
|
-
example
|
20
|
-
|
21
|
-
$ disable_rc=1 ruby myscript.rb
|
data/lib/binding.repl.rb
CHANGED
@@ -43,7 +43,9 @@ class BindingRepl
|
|
43
43
|
# a Proc that is expected to start a repl.
|
44
44
|
# the Proc is passed a `Binding` and a Hash of options.
|
45
45
|
#
|
46
|
-
# @return [
|
46
|
+
# @return [nil, Symbol]
|
47
|
+
# returns the return value of a method definition.
|
48
|
+
# on 2.1+ that could be the method name as a symbol, or nil on <2.1.
|
47
49
|
#
|
48
50
|
def self.add(console, initializer, runner)
|
49
51
|
LOOKUP[console.to_s] = [initializer, runner]
|
@@ -58,6 +60,19 @@ class BindingRepl
|
|
58
60
|
@lookup = LOOKUP
|
59
61
|
end
|
60
62
|
|
63
|
+
#
|
64
|
+
# iterates through BindingRepl.auto_order and starts the first available console.
|
65
|
+
#
|
66
|
+
# @raise [LoadError]
|
67
|
+
# raises a LoadError when BindingRepl.auto_order is empty.
|
68
|
+
#
|
69
|
+
# @raise [LoadError]
|
70
|
+
# raises a LoadError when no consoles in BindingRepl.auto_order can be loaded
|
71
|
+
# via Kernel#require.
|
72
|
+
#
|
73
|
+
# @return [BindingRepl::ExitValue]
|
74
|
+
# returns an instance of {BindingRepl::ExitValue} when the repl has exited.
|
75
|
+
#
|
61
76
|
def auto
|
62
77
|
consoles = Binding.repl.auto_order
|
63
78
|
value = run_any_console(consoles)
|
@@ -103,12 +118,10 @@ end
|
|
103
118
|
|
104
119
|
require_relative "binding.repl/core_ext/binding"
|
105
120
|
require_relative "binding.repl/env"
|
106
|
-
require_relative "binding.repl/rcfile"
|
107
121
|
require_relative "binding.repl/exit_value"
|
108
122
|
require_relative "binding.repl/version"
|
109
123
|
require_relative "binding.repl/console/pry"
|
110
124
|
require_relative "binding.repl/console/irb"
|
111
125
|
require_relative "binding.repl/console/ripl"
|
112
126
|
require_relative "binding.repl/console/rib"
|
113
|
-
BindingRepl::RCFile.load
|
114
127
|
BindingRepl.auto_order = BindingRepl::ENV.auto_order
|
data/lib/binding.repl/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative "setup"
|
2
|
+
class BindingTest < MiniTest::Test
|
3
|
+
include BindingRepl::RSpecMocks
|
4
|
+
def test_return_value_of_repl
|
5
|
+
assert_instance_of BindingRepl, binding.repl
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_delegate_to_auto
|
9
|
+
expect_any_instance_of(BindingRepl).to receive(:auto)
|
10
|
+
binding.repl!
|
11
|
+
end
|
12
|
+
end
|
data/test/setup.rb
CHANGED
metadata
CHANGED
@@ -1,58 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binding.repl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Public Domain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
name: toml
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.3
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.3
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.3'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.3'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
description: 'binding.repl: binding.pry for all ruby consoles'
|
11
|
+
date: 2014-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: binding.repl can start a number of different ruby consoles at runtime
|
56
14
|
email:
|
57
15
|
- robert@flowof.info
|
58
16
|
executables: []
|
@@ -70,7 +28,7 @@ files:
|
|
70
28
|
- UNLICENSE.txt
|
71
29
|
- binding.repl.gemspec
|
72
30
|
- doc/disableatruntime.md
|
73
|
-
- doc/
|
31
|
+
- doc/exit_values.md
|
74
32
|
- doc/runtimeoptions.md
|
75
33
|
- doc/shellvariables.md
|
76
34
|
- lib/binding.repl.rb
|
@@ -81,30 +39,28 @@ files:
|
|
81
39
|
- lib/binding.repl/core_ext/binding.rb
|
82
40
|
- lib/binding.repl/env.rb
|
83
41
|
- lib/binding.repl/exit_value.rb
|
84
|
-
- lib/binding.repl/rcfile.rb
|
85
42
|
- lib/binding.repl/version.rb
|
86
43
|
- test/binding_repl_auto_test.rb
|
87
44
|
- test/binding_repl_env_test.rb
|
88
45
|
- test/binding_repl_irb_test.rb
|
89
46
|
- test/binding_repl_pry_test.rb
|
90
|
-
- test/binding_repl_rcfile_test.rb
|
91
47
|
- test/binding_repl_rib_test.rb
|
92
48
|
- test/binding_repl_ripl_test.rb
|
49
|
+
- test/binding_test.rb
|
50
|
+
- test/isolation/lazy_irb_require_test.rb
|
51
|
+
- test/isolation/lazy_pry_require_test.rb
|
52
|
+
- test/isolation/lazy_rib_require_test.rb
|
53
|
+
- test/isolation/lazy_ripl_require_test.rb
|
93
54
|
- test/setup.rb
|
94
|
-
- test/support/binding.repl/
|
55
|
+
- test/support/binding.repl/rspec_mocks.rb
|
95
56
|
homepage: https://github.com/robgleeson/binding.repl
|
96
57
|
licenses:
|
97
58
|
- Public Domain
|
98
59
|
metadata: {}
|
99
|
-
post_install_message: |2
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
Check out ChangeLog.txt to read about what's changed.
|
104
|
-
|
105
|
-
ChangeLog.txt
|
106
|
-
https://github.com/robgleeson/binding.repl/blob/v0.10.0/ChangeLog.txt
|
107
|
-
|
60
|
+
post_install_message: |2
|
61
|
+
== binding.repl v1.0.0
|
62
|
+
ChangeLog.txt:
|
63
|
+
https://github.com/robgleeson/binding.repl/blob/v1.0.0/ChangeLog.txt
|
108
64
|
rdoc_options: []
|
109
65
|
require_paths:
|
110
66
|
- lib
|
@@ -123,14 +79,18 @@ rubyforge_project:
|
|
123
79
|
rubygems_version: 2.2.2
|
124
80
|
signing_key:
|
125
81
|
specification_version: 4
|
126
|
-
summary:
|
82
|
+
summary: binding.repl can start a number of different ruby consoles at runtime
|
127
83
|
test_files:
|
128
84
|
- test/binding_repl_auto_test.rb
|
129
85
|
- test/binding_repl_env_test.rb
|
130
86
|
- test/binding_repl_irb_test.rb
|
131
87
|
- test/binding_repl_pry_test.rb
|
132
|
-
- test/binding_repl_rcfile_test.rb
|
133
88
|
- test/binding_repl_rib_test.rb
|
134
89
|
- test/binding_repl_ripl_test.rb
|
90
|
+
- test/binding_test.rb
|
91
|
+
- test/isolation/lazy_irb_require_test.rb
|
92
|
+
- test/isolation/lazy_pry_require_test.rb
|
93
|
+
- test/isolation/lazy_rib_require_test.rb
|
94
|
+
- test/isolation/lazy_ripl_require_test.rb
|
135
95
|
- test/setup.rb
|
136
|
-
- test/support/binding.repl/
|
96
|
+
- test/support/binding.repl/rspec_mocks.rb
|
data/doc/rcfile.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
__RCFILE__
|
2
|
-
|
3
|
-
binding.repl reads a configuration file from `$HOME/.binding.repl.rc`.
|
4
|
-
the configuration file is written in a human readable and writable
|
5
|
-
language called [toml](https://github.com/mojombo/toml).
|
6
|
-
|
7
|
-
at the moment the only configuration option is to define the order that
|
8
|
-
`binding.repl.auto` will use to look for ruby consoles. the example sets
|
9
|
-
up pry to be the first preference, then ripl, then rib, and finally irb.
|
10
|
-
|
11
|
-
```toml
|
12
|
-
[auto]
|
13
|
-
order = ["pry", "ripl", "rib", "irb"]
|
14
|
-
```
|
15
|
-
|
16
|
-
__DISABLE OR OVERRIDE__
|
17
|
-
|
18
|
-
the RC file is optional. if it doesn't exist that's cool.
|
19
|
-
it can be temporarily disabled and overriden by setting [shell environment variables](https://github.com/robgleeson/binding.repl/blob/master/doc/shellvariables.md)
|
20
|
-
when it does exist.
|
data/lib/binding.repl/rcfile.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "toml"
|
2
|
-
module BindingRepl::RCFile
|
3
|
-
module_function
|
4
|
-
def path
|
5
|
-
File.join ENV["HOME"], ".binding.repl.rc"
|
6
|
-
end
|
7
|
-
|
8
|
-
def enabled?
|
9
|
-
BindingRepl::ENV.enable_rc_file?
|
10
|
-
end
|
11
|
-
|
12
|
-
def load
|
13
|
-
return nil unless enabled? and File.readable?(path)
|
14
|
-
content = File.read(path)
|
15
|
-
parsed = TOML::Parser.new(content).parsed
|
16
|
-
Binding.repl.auto_order = parsed["auto"]["order"]
|
17
|
-
rescue StandardError => e
|
18
|
-
warn "binding.repl: '#{path}' read failed."
|
19
|
-
end
|
20
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative "setup"
|
2
|
-
testcase = if defined?(Rubinius)
|
3
|
-
# skip Rubinius (breaks with FakeFS).
|
4
|
-
Object
|
5
|
-
else
|
6
|
-
MiniTest::Test
|
7
|
-
end
|
8
|
-
|
9
|
-
class BindingReplRCFileTest < testcase
|
10
|
-
DIR = File.dirname BindingRepl::RCFile.path
|
11
|
-
FILENAME = File.basename BindingRepl::RCFile.path
|
12
|
-
|
13
|
-
def setup
|
14
|
-
@before = BindingRepl.auto_order
|
15
|
-
FakeFS.activate!
|
16
|
-
dir = FakeFS::FileSystem.add DIR
|
17
|
-
file = FakeFS::FakeFile.new FILENAME, dir
|
18
|
-
file.content = <<-RCFILE
|
19
|
-
[auto]
|
20
|
-
order = ["fakerepl", "irb"]
|
21
|
-
RCFILE
|
22
|
-
dir[file.name] = file
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
BindingRepl.auto_order = @before
|
27
|
-
FakeFS.deactivate!
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_auto_order_defined_by_rc_file
|
31
|
-
BindingRepl::RCFile.load
|
32
|
-
assert_equal ["fakerepl", "irb"], BindingRepl.auto_order
|
33
|
-
end
|
34
|
-
end
|