Commits

Lin Jen-Shin  committed d3efc64

umm... looks working, but does not do what i want

  • Participants
  • Parent commits f8c50f9

Comments (0)

Files changed (8)

+pkg
+*.rbc
+# readline_line_buffer_insert
+
+by Lin Jen-Shin ([godfat](http://godfat.org))
+
+## LINKS:
+
+* [github](https://github.com/godfat/readline_line_buffer_insert)
+* [rubygems](http://rubygems.org/gems/readline_line_buffer_insert)
+
+## DESCRIPTION:
+
+a
+
+b
+
+## REQUIREMENTS:
+
+## INSTALLATION:
+
+    gem install readline_line_buffer_insert
+
+## SYNOPSIS:
+
+
+## LICENSE:
+
+Apache License 2.0
+
+Copyright (c) 2011, Lin Jen-Shin (godfat)
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+<http://www.apache.org/licenses/LICENSE-2.0>
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+require "#{dir = File.dirname(__FILE__)}/task/gemgem"
+Gemgem.dir = dir
+
+($LOAD_PATH << File.expand_path("#{Gemgem.dir}/lib")).uniq!
+
+desc 'Generate gemspec'
+task 'gem:spec' do
+  Gemgem.spec = Gemgem.create do |s|
+    require 'readline_buffer_insert/version'
+    s.name    = 'readline_buffer_insert'
+    s.version = ReadlineBufferInsert::VERSION
+
+    s.extensions = 'ext/readline_buffer_insert_ext/extconf.rb'
+    %w[].each{ |g| s.add_runtime_dependency(g) }
+    %w[].each{ |g| s.add_development_dependency(g) }
+  end
+
+  Gemgem.write
+end

File ext/readline_buffer_insert_ext/extconf.rb

+
+require 'mkmf'
+dir_config('readline')
+have_library('readline')
+
+if have_header('readline/readline.h')
+  create_makefile 'readline_buffer_insert_ext'
+else
+  abort '--without-readline'
+end

File ext/readline_buffer_insert_ext/readline_buffer_insert_ext.c

+
+#ifdef HAVE_READLINE_READLINE_H
+#include "ruby.h"
+#include <errno.h>
+#include <stdio.h>
+#include <readline/readline.h>
+
+static VALUE readline_buffer_insert_ext(VALUE self, VALUE str){
+  rb_secure(4);
+  StringValue(str);
+  rl_insert_text(RSTRING_PTR(str));
+  return rb_locale_str_new_cstr(rl_line_buffer);
+}
+
+void Init_readline_buffer_insert_ext() {
+  rb_define_singleton_method(rb_const_get(rb_cObject, rb_intern("Readline")),
+    "line_buffer_insert",
+    readline_buffer_insert_ext, 1);
+}
+
+#endif

File lib/readline_buffer_insert.rb

+
+require 'readline'
+require 'readline_buffer_insert_ext'

File lib/readline_buffer_insert/version.rb

+
+module ReadlineBufferInsert
+  VERSION = '1.0.0'
+end

File readline_buffer_insert.gemspec

+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+  s.name = %q{readline_buffer_insert}
+  s.version = "1.0.0"
+
+  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+  s.authors = [%q{Lin Jen-Shin (godfat)}]
+  s.date = %q{2011-08-18}
+  s.description = %q{a
+
+b}
+  s.email = [%q{godfat (XD) godfat.org}]
+  s.extensions = [%q{ext/readline_buffer_insert_ext/extconf.rb}]
+  s.files = [
+  %q{.gitignore},
+  %q{.gitmodules},
+  %q{README},
+  %q{Rakefile},
+  %q{ext/readline_buffer_insert_ext/extconf.rb},
+  %q{ext/readline_buffer_insert_ext/readline_buffer_insert_ext.c},
+  %q{lib/readline_buffer_insert.rb},
+  %q{lib/readline_buffer_insert/version.rb},
+  %q{task/.gitignore},
+  %q{task/gemgem.rb}]
+  s.homepage = %q{https://github.com/godfat/readline_buffer_insert}
+  s.rdoc_options = [
+  %q{--main},
+  %q{README}]
+  s.require_paths = [%q{lib}]
+  s.rubygems_version = %q{1.8.7}
+  s.summary = %q{a}
+
+  if s.respond_to? :specification_version then
+    s.specification_version = 3
+
+    if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+    else
+    end
+  else
+  end
+end