mini_readline 0.4.5 → 0.4.6
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.
- checksums.yaml +4 -4
- data/README.md +30 -7
- data/lib/mini_readline.rb +22 -2
- data/lib/mini_readline/version.rb +1 -1
- data/{Rakefile → rakefile.rb} +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72da0352d9a3adb0946c9902542b9f79f8c01260
|
4
|
+
data.tar.gz: 4025883e28e90d1258818b51c9f30c7c3dc680e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17cf75c0a4f72b861b37343b183b2bfa48d61b8db58bf62f35ea4b9335e476f8390e64fb23397ed60df7139364a0d3cc5f795aeeb4579f56d4a701c14bb36002
|
7
|
+
data.tar.gz: e50bd96abeb77a6ecb9baf4784f6482f00fb3c7030d542fa9daae1126c6650529476b03de3612d2ec68811e72c2eccff51ba7ddd562b5d82b0863cea9540c4f4
|
data/README.md
CHANGED
@@ -63,13 +63,6 @@ The typical way of utilizing this gem is to place the following:
|
|
63
63
|
```ruby
|
64
64
|
require 'mini_readline'
|
65
65
|
```
|
66
|
-
By default, the constant Readline is set to the MiniReadline module. If this
|
67
|
-
is not desired use the following:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
$no_alias_read_line_module = true
|
71
|
-
require 'mini_readline'
|
72
|
-
```
|
73
66
|
|
74
67
|
### Compatible Mode
|
75
68
|
|
@@ -96,6 +89,36 @@ and
|
|
96
89
|
MiniReadline.readline('>', false)
|
97
90
|
```
|
98
91
|
|
92
|
+
##### Module Aliasing
|
93
|
+
|
94
|
+
For enhanced compatibility, the mini_readline gem has the ability to alias
|
95
|
+
itself as the readline gem. This ability is subject to the following list
|
96
|
+
of conditions.
|
97
|
+
|
98
|
+
1) If the global variable $no_alias_read_line_module is set to true before the
|
99
|
+
mini_readline gem is required, *no* aliasing will take place.
|
100
|
+
```ruby
|
101
|
+
$no_alias_read_line_module = true
|
102
|
+
require 'mini_readline'
|
103
|
+
```
|
104
|
+
2) Else, if the global variable $force_alias_read_line_module is set to true
|
105
|
+
before the mini_readline gem is required, aliasing *will* take place.
|
106
|
+
```ruby
|
107
|
+
$force_alias_read_line_module = true
|
108
|
+
require 'mini_readline'
|
109
|
+
```
|
110
|
+
3) Else, if the readline gem is already loaded, *no* aliasing will take place.
|
111
|
+
```ruby
|
112
|
+
require 'readline'
|
113
|
+
require 'mini_readline'
|
114
|
+
```
|
115
|
+
4) Finally, if none of the above conditions are met, aliasing *will* take place.
|
116
|
+
```ruby
|
117
|
+
require 'mini_readline'
|
118
|
+
```
|
119
|
+
Note that if the readline gem is subsequently required after the mini_readline
|
120
|
+
gem, it will redefine the Readline constant, generating a warning message on
|
121
|
+
$stderr.
|
99
122
|
|
100
123
|
### Native Mode
|
101
124
|
|
data/lib/mini_readline.rb
CHANGED
@@ -27,8 +27,28 @@ module MiniReadline
|
|
27
27
|
def self.readline(prompt, history = nil)
|
28
28
|
@reader.readline(prompt: prompt, history: history)
|
29
29
|
end
|
30
|
+
|
31
|
+
#A stub.
|
32
|
+
def self.input=(input)
|
33
|
+
input
|
34
|
+
end
|
35
|
+
|
36
|
+
#A stub.
|
37
|
+
def self.output=(output)
|
38
|
+
output
|
39
|
+
end
|
40
|
+
|
30
41
|
end
|
31
42
|
|
32
|
-
|
33
|
-
|
43
|
+
#Optionally: Setup the module alias for Readline
|
44
|
+
begin
|
45
|
+
old_stderr = $stderr
|
46
|
+
$stderr = File.open(File::NULL, 'w')
|
47
|
+
|
48
|
+
if !$no_alias_read_line_module&&($force_alias_read_line_module||!defined? Readline)
|
49
|
+
Readline = MiniReadline
|
50
|
+
end
|
51
|
+
ensure
|
52
|
+
$stderr.close
|
53
|
+
$stderr = old_stderr
|
34
54
|
end
|
data/{Rakefile → rakefile.rb}
RENAMED
@@ -28,6 +28,17 @@ Rake::TestTask.new do |t|
|
|
28
28
|
t.verbose = false
|
29
29
|
end
|
30
30
|
|
31
|
+
desc "Fire up an IRB session with mini_readline."
|
32
|
+
task :console do
|
33
|
+
require 'irb'
|
34
|
+
require 'irb/completion'
|
35
|
+
$force_alias_read_line_module = true
|
36
|
+
require './lib/mini_readline'
|
37
|
+
puts "Starting an IRB console with mini_readline."
|
38
|
+
ARGV.clear
|
39
|
+
IRB.start
|
40
|
+
end
|
41
|
+
|
31
42
|
desc "Run a scan for smelly code!"
|
32
43
|
task :reek do |t|
|
33
44
|
`reek --no-color lib > reek.txt`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_readline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- Gemfile
|
80
80
|
- LICENSE.txt
|
81
81
|
- README.md
|
82
|
-
- Rakefile
|
83
82
|
- lib/mini_readline.rb
|
84
83
|
- lib/mini_readline/exceptions.rb
|
85
84
|
- lib/mini_readline/options.rb
|
@@ -125,6 +124,7 @@ files:
|
|
125
124
|
- lib/mini_readline/version.rb
|
126
125
|
- mini_readline.gemspec
|
127
126
|
- mini_readline.reek
|
127
|
+
- rakefile.rb
|
128
128
|
- reek.txt
|
129
129
|
- sire.rb
|
130
130
|
- tests/mini_readline_tests.rb
|