mini_readline 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66df58b8ca2e0db8aaf7f468d2875e319d85015b
4
- data.tar.gz: 51b5958f048e2d2a9271df178c6ff858f4d98040
3
+ metadata.gz: 68a9bb122c272cbd3d0bdf26532cca602a75e140
4
+ data.tar.gz: 80fd1b109e5cdb190d4120f8762e1405cf533a9c
5
5
  SHA512:
6
- metadata.gz: cabf7deb7ab36fcd201205de153e473f139593d752bfc19323ff03082aaa7eb4e2072096639da32ed30324395c5c3fc6d067a2ba60bcefce6d4a66f2e553d02b
7
- data.tar.gz: a1fef7fd990291969cf1f0ef7bdbeaebc75a0a507bef7878675dd76200befc2b96e518c628dc6e3e7d3a5f068175746f81d93942ff6ae55c582c7663f931dfed
6
+ metadata.gz: e1a2dc21e88852da17e13cdf543232daaec3aac8def1b966e8984fd8084478183d18d28904d5c02295254501a369e7be86123c15149cee43eb95955f9ac4b8de
7
+ data.tar.gz: a4b000eb3ee2d956521f0a538c54863ed77a2908c0e6b71dc64e589aca38a60e74cc251b3c327f970ecd8930657f475770d70ec084bcb889219370d46f5d8e4b
data/README.md CHANGED
@@ -6,12 +6,8 @@ inline editing, command history, and stock or customizable auto-complete.
6
6
  The mini readline gem is an experiment in replacing the standard readline gem
7
7
  that is part of Ruby. The mini readline project will try to focus on the needs
8
8
  of Ruby programs. It will also try to correct a number of irritating issues
9
- encountered when running cross platform environments.
10
-
11
- The mini_readline gem is designed for use with MRI version 1.9.3 or later. The
12
- long term goal is to be as portable to as many versions of ruby as is
13
- possible. To this end, portability usage (problem) experiences are especially
14
- desired. (See the Testing and Contributing sections below.)
9
+ encountered when running cross platform environments. See Cross Platform
10
+ Portability Progress below for more details.
15
11
 
16
12
  ## Installation
17
13
 
@@ -130,7 +126,7 @@ can be accomplished with these options settings.
130
126
 
131
127
  ##### Module Aliasing [Support Ended]
132
128
 
133
- In an attempt to enhance compatibility, the mini_readline gem has the ability
129
+ In an attempt to enhance compatibility, the mini_readline gem had the ability
134
130
  to alias itself as the readline gem. This feature was found to be unworkable
135
131
  and has been removed as of Version 0.7.0.
136
132
 
@@ -230,10 +226,8 @@ BASE_OPTIONS = {
230
226
  :initial => "", #The initial text for the entry.
231
227
  #An empty string for none.
232
228
 
233
- :term => nil, #Filled in by raw_term.rb
229
+ :term => nil} #Filled in by raw_term.rb
234
230
  #MiniReadline::RawTerm
235
-
236
- :debug => false} #Used during development only.
237
231
  ```
238
232
 
239
233
  <br>While most of these options are self explanatory, a few could stand some
@@ -382,7 +376,7 @@ if all fails, it will load the "classic" Readline gem. Here is a typical run:
382
376
  Loaded mini_readline from the local code folder.
383
377
 
384
378
  Welcome to a Simple Interactive Ruby Environment
385
- Use the command 'q' to quit.
379
+ Use the command 'quit' to exit.
386
380
 
387
381
  SIRE>
388
382
  Of note, the run method can be used to test for the shell process bug. For
@@ -411,17 +405,36 @@ system gem, use this:
411
405
 
412
406
  $ ruby sire.rb local
413
407
 
414
- ## Testing
415
- To date this code has been tested under:
416
- * Windows 7 with ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
417
- * Windows 7 with ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]
418
- * Windows 7+Cygwin with ruby 2.2.3p173 (2015-08-18 revision 51636) [i386-cygwin]
408
+ ## Cross Platform Portability Progress
409
+
410
+ The mini_readline gem was initially designed for use with MRI version 1.9.3 or
411
+ later. The long term goal is to be as portable to as many versions of Ruby and
412
+ on as many operating systems platforms as is possible. So far the matrix of
413
+ support looks like:
414
+
415
+ Ruby | Win32 | Win64 | Cygwin | Linux | Mac
416
+ ---------------|---------|---------|---------|---------|---------
417
+ ruby 1.9.3p484 | Yes | Yes | ? | ? | ?
418
+ ruby 2.1.6p336 | Yes | ? | ? | ? | ?
419
+ ruby 2.2.3p173 | ? | ? | Yes | ? | ?
420
+ jruby 9.1.5.0 | ~Yes | ? | Planned | Planned | Planned
421
+ rubinius | N/A | N/A | N/A | Maybe | Maybe
422
+
423
+ <br>Where:
419
424
 
420
- <br>**More testing is clearly called for and suggestions/bug reports are most
421
- welcomed!!!**
425
+ * 'Yes' means good to go! Coded and tested OK!
426
+ * '~Yes' means mostly working but still some minor issues (See issue #7).
427
+ * '?' _should_ work but are untested.
428
+ * 'Planned' are not there yet and some work and much testing are needed.
429
+ * 'N/A' entries reflect the fact that Rubinius does not run under Windows.
430
+ * 'Maybe' entries are not on the radar now, but maybe later.
431
+
432
+ There is clearly a lot of work to do.
422
433
 
423
434
  ## Contributing
424
435
 
436
+ All participation is welcomed. There are two fabulous plans to choose from:
437
+
425
438
  #### Plan A
426
439
 
427
440
  1. Fork it ( https://github.com/PeterCamilleri/mini_readline/fork )
@@ -434,11 +447,7 @@ welcomed!!!**
434
447
  #### Plan B
435
448
 
436
449
  Go to the GitHub repository and raise an issue calling attention to some
437
- aspect that could use some TLC or a suggestion or an idea.
438
-
439
-
440
- ## License
441
-
442
- The gem is available as open source under the terms of the MIT License. Please
443
- see LICENSE.txt for further details.
450
+ aspect that could use some TLC or a suggestion or an idea. Please see
451
+ ( https://github.com/PeterCamilleri/mini_readline/issues )
444
452
 
453
+ This is a low pressure environment. All are welcome!
@@ -29,9 +29,7 @@ module MiniReadline
29
29
  :initial => "", #The initial text for the entry.
30
30
  #An empty string for none.
31
31
 
32
- :term => nil, #Filled in by raw_term.rb
32
+ :term => nil} #Filled in by raw_term.rb
33
33
  #MiniReadline::RawTerm
34
34
 
35
- :debug => false #Used during development only.
36
- }
37
35
  end
@@ -5,7 +5,9 @@ require 'rbconfig'
5
5
  #* raw_term.rb - Platform determination for raw terminal access.
6
6
  module MiniReadline
7
7
 
8
+ # :stopdoc:
8
9
  host_os = RbConfig::CONFIG['host_os']
10
+ # :startdoc:
9
11
 
10
12
  #What operating platform is in effect?
11
13
  TERM_PLATFORM =
@@ -44,7 +44,7 @@ module MiniReadline
44
44
  define_singleton_method(:kbhit) { kbhit_proc.call }
45
45
 
46
46
  beep_proc = Win32API.new("user32", "MessageBeep", ['L'], '0')
47
- define_singleton_method(:beep) { beep_proc.call(0) }
47
+ define_singleton_method(:beep) { beep_proc.call }
48
48
 
49
49
  set_cursor_posn_proc = Win32API.new("kernel32",
50
50
  "SetConsoleCursorPosition",
@@ -8,10 +8,6 @@ module MiniReadline
8
8
 
9
9
  #An unmapped key was pressed. Beep!
10
10
  def unmapped(keyboard_args)
11
- if @options[:debug]
12
- puts keyboard_args.inspect
13
- end
14
-
15
11
  @term.beep
16
12
  end
17
13
  end
@@ -1,4 +1,4 @@
1
1
  module MiniReadline
2
2
  #The current version of the mini_readline gem.
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  Intermediate Range Ballistic Missile.
18
18
  }.gsub(/\s+/, ' ').strip
19
19
 
20
- spec.homepage = "https://github.com/PeterCamilleri/mini_readline"
20
+ spec.homepage = "http://teuthida-technologies.com/"
21
21
  spec.license = "MIT"
22
22
 
23
23
  spec.files = `git ls-files`.split($/)
data/sire.rb CHANGED
@@ -3,14 +3,15 @@
3
3
 
4
4
  require 'pp'
5
5
 
6
- if ARGV[0] == 'old'
7
- require 'readline'
8
- $old = true
9
-
10
- class MiniReadlineEOI < StandardError
11
- end
6
+ #Some SIRE control variables.
7
+ $sire_done = false
8
+ $sire_binding = binding
9
+ $sire_old = (ARGV[0] == 'old') || defined?(Readline)
12
10
 
13
- puts "\nOption(old). Loaded the standard readline gem. Version #{Readline::VERSION}"
11
+ if $sire_old
12
+ require 'readline'
13
+ class MiniReadlineEOI < StandardError; end #Compatibility stub.
14
+ puts "\nLoaded the standard readline gem. Version #{Readline::VERSION}"
14
15
  elsif ARGV[0] == 'local'
15
16
  require './lib/mini_readline'
16
17
  puts "\nOption(local). Loaded mini_readline from the local code folder. Version #{MiniReadline::VERSION}"
@@ -49,25 +50,20 @@ class Object
49
50
  result
50
51
  end
51
52
  end
52
- end
53
53
 
54
- class SIRE
55
- #Set up the interactive session.
56
- def initialize
57
- @_done = false
58
- end
54
+ private
59
55
 
60
56
  #Quit the interactive session.
61
- def q
62
- @_done = true
57
+ def quit
58
+ $sire_done = true
63
59
  puts
64
60
  "Quit command."
65
61
  end
66
62
 
67
63
  #Get a mapped keystroke.
68
- def g
69
- if $old
70
- print 'Not supported by old readline.'
64
+ def get_mapped
65
+ if $sire_old
66
+ puts 'Not supported by old readline.'
71
67
  else
72
68
  print 'Press a key:'
73
69
  MiniReadline::BASE_OPTIONS[:term].get_mapped_keystroke
@@ -82,36 +78,24 @@ class SIRE
82
78
  end
83
79
  end
84
80
 
85
- #Execute a single line.
86
- def exec_line(line)
87
- result = eval line
88
- pp result unless line.length == 0
89
-
90
- rescue Interrupt => e
91
- puts "\nExecution Interrupted!"
92
- puts "\n#{e.class} detected: #{e}\n"
93
- puts e.backtrace
94
- puts "\n"
81
+ end
95
82
 
96
- rescue Exception => e
97
- puts "\n#{e.class} detected: #{e}\n"
98
- puts e.backtrace
99
- puts
100
- end
83
+ #The SIRE class contains the simplistic R.E.P.L.
84
+ class SIRE
101
85
 
102
86
  #Run the interactive session.
103
87
  def run_sire
104
- unless $old
88
+ unless $sire_old
105
89
  MiniReadline::BASE_OPTIONS[:auto_complete] = true
106
90
  MiniReadline::BASE_OPTIONS[:eoi_detect] = true
107
91
  end
108
92
 
109
93
  puts
110
94
  puts "Welcome to a Simple Interactive Ruby Environment\n"
111
- puts "Use the command 'q' to quit.\n\n"
95
+ puts "Use the command 'quit' to exit.\n\n"
112
96
 
113
- until @_done
114
- exec_line(Readline.readline("SIRE>", true))
97
+ until $sire_done
98
+ exec_line(get_line)
115
99
  end
116
100
 
117
101
  puts "\n\n"
@@ -120,6 +104,40 @@ class SIRE
120
104
  puts "\n"
121
105
  end
122
106
 
107
+ private
108
+
109
+ #Get a line of input from the user.
110
+ def get_line
111
+ initial_input = Readline.readline("SIRE>", true)
112
+ get_extra_input(initial_input)
113
+ end
114
+
115
+ #Get any continuations of the inputs
116
+ def get_extra_input(str)
117
+ if /\\\s*$/ =~ str
118
+ get_extra_input($PREMATCH + "\n" + Readline.readline("SIRE\\", true))
119
+ else
120
+ str
121
+ end
122
+ end
123
+
124
+ #Execute a single line.
125
+ def exec_line(line)
126
+ result = $sire_binding.eval(line)
127
+ pp result unless line.length == 0
128
+
129
+ rescue Interrupt => e
130
+ puts "\nExecution Interrupted!"
131
+ puts "\n#{e.class} detected: #{e}\n"
132
+ puts e.backtrace
133
+ puts "\n"
134
+
135
+ rescue Exception => e
136
+ puts "\n#{e.class} detected: #{e}\n"
137
+ puts e.backtrace
138
+ puts
139
+ end
140
+
123
141
  end
124
142
 
125
143
  if __FILE__ == $0
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.7.0
4
+ version: 0.7.1
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-11-01 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -135,7 +135,7 @@ files:
135
135
  - reek.txt
136
136
  - sire.rb
137
137
  - tests/mini_readline_tests.rb
138
- homepage: https://github.com/PeterCamilleri/mini_readline
138
+ homepage: http://teuthida-technologies.com/
139
139
  licenses:
140
140
  - MIT
141
141
  metadata: {}