orichalcum 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ == This is a Really Cool Ruby Thing
2
+ === ( That deserves better documentation than this. )
@@ -0,0 +1,60 @@
1
+ require 'readline'
2
+ require 'dl/import'
3
+
4
+ #This really locks text-interpreter down to Linux, maybe Unix-like
5
+ #platforms, I'm thinking. A more flexible way of doing this would rock,
6
+ #regardless of length.
7
+ module Readline
8
+ begin
9
+ extend DL::Importable
10
+ found_libreadline = false
11
+ ls_so_dirs = [
12
+ %w{lib},
13
+ %w{usr lib},
14
+ %w{usr local lib}
15
+ ].each{|path| path.unshift("")}
16
+
17
+ begin
18
+ File::open("/etc/ld.so.conf", "r") do |ld_so_conf|
19
+ ld_so_conf.each do |line|
20
+ unless /^#/ =~ line or /^%s*$/ =~ line
21
+ ls_so_dirs << line.chomp.split(File::Separator)
22
+ end
23
+ end
24
+ end
25
+ rescue Exception
26
+ end
27
+
28
+ libreadline_names = %w{libreadline.so libreadline.dylib libreadline.dll}
29
+
30
+ libreadline_paths = ls_so_dirs.inject([]) do |list, dir|
31
+ list + libreadline_names.map do |name|
32
+ File::join(*(dir + [name]))
33
+ end
34
+ end
35
+
36
+ libreadline_paths.each do |path|
37
+ begin
38
+ dlload path
39
+ RLLB = symbol("rl_line_buffer")
40
+ found_libreadline = true
41
+ break
42
+ rescue RuntimeError
43
+ end
44
+ end
45
+
46
+ raise RuntimeError,"couldn't find libreadline" unless found_libreadline
47
+
48
+ def self.line_buffer
49
+ p = RLLB.ptr
50
+ if p.nil?
51
+ return p
52
+ else
53
+ return p.to_s
54
+ end
55
+ end
56
+ rescue RuntimeError => rte
57
+ warn "Couldn't find libreadline - tab-completion will be unpredictable at best."
58
+ warn "The problem was: " + rte.message
59
+ end
60
+ end
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: orichalcum
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.5.0
7
+ date: 2008-03-10 00:00:00 -07:00
8
+ summary: A wrapper for readline, with a little extra features, and more compatibility
9
+ require_paths:
10
+ - lib
11
+ email: nyarly@gmail.com
12
+ homepage:
13
+ rubyforge_project:
14
+ description: Readline is a really useful library for textual user interfaces. Unfortunately, the Ruby interface has very limited functionality. This gem adds access to the full line buffer during completion. The biggest milestone before 1.0 is to similarly wrap jline for jRuby, and do it such that client code doesn't need to determine it's platform ahead of time.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message: Another tidy package brought to you by Judson
29
+ authors:
30
+ - Judson Lester
31
+ files:
32
+ - lib/compatible-readline
33
+ - lib/compatible-readline/readline.rb
34
+ - doc/README
35
+ test_files: []
36
+
37
+ rdoc_options:
38
+ - --inline-source
39
+ - --main
40
+ - doc/README
41
+ - --title
42
+ - orichalcum-0.5.0 RDoc
43
+ extra_rdoc_files:
44
+ - doc/README
45
+ executables: []
46
+
47
+ extensions: []
48
+
49
+ requirements: []
50
+
51
+ dependencies: []
52
+