readline-ext 0.1.0.pre.1 → 0.1.3

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
  SHA256:
3
- metadata.gz: 719cc7ad5bbe4bd0a68a42ba14005e7c9b7154c9ead53e64cbacf16084de3114
4
- data.tar.gz: f23ed1855284a9c5f0ad6f437ab10aaa8cf89ee4a0f3d23731208594e980a7cc
3
+ metadata.gz: e7ef47bdc0570592b4225202723bac94a77a8e9241788a653feb88342e53e47e
4
+ data.tar.gz: a5cb072d9541e2e89e241a7730a52ec7a308150913d1afb525ef5f6cd0f76593
5
5
  SHA512:
6
- metadata.gz: e1124ee4bb9ad489fc22c90e70cf19e8042fab60b35314946206e910616fee33333c0c0d563b561dab79257d203951c181a40783dca41d524e3cffea0b9f11af
7
- data.tar.gz: 17376eb9e48669a6bedb90c22077b1bb9d1b464505d068455eee88d847b2e106b630ece4ae2e6bbe46a0e24670cd8f5d854c499dbefc83ed5036a57961116446
6
+ metadata.gz: f8508983cb9d56dbd7ba0c97e252d4f12b72aa3a2b274b74059fcf63cfdbf4cf155499b3d588d4a630db3a1aea88c4ef9456af797e1f3eb86b53e8ecbd79acc8
7
+ data.tar.gz: a801951ab7067e4e218ef4b3fe478abef45909ef6168c08137ad722542c1865e8131dc8da2cc485055d2865b6f886d88751a79d8e190fe58f81025f2e50df7b5
@@ -0,0 +1,34 @@
1
+ name: build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: build (${{ matrix.ruby }} / ${{ matrix.os }})
8
+ strategy:
9
+ matrix:
10
+ ruby: [ '3.0', 2.7, 2.6, 2.5, head ]
11
+ os: [ ubuntu-latest, macos-latest ]
12
+ runs-on: ${{ matrix.os }}
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - name: Install libedit
16
+ run: sudo apt-get install -q libedit-dev libedit2
17
+ if: startsWith(matrix.os, 'ubuntu')
18
+ - name: Install libedit
19
+ run: brew install libedit
20
+ if: startsWith(matrix.os, 'macos')
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ - name: Install dependencies
26
+ run: |
27
+ bundle install
28
+ gem install reline --pre
29
+ - name: Run test
30
+ run: rake compile test
31
+ - name: Run test with libedit enabled
32
+ run: rake clobber compile test -- --enable-libedit
33
+ - name: Run test with libedit disabled
34
+ run: rake clobber compile test -- --disable-libedit
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /Gemfile.lock
10
+ ext/readline/depend
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
1
  # Readline
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/readline`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ The Readline module provides interface for GNU Readline.
4
+ This module defines a number of methods to facilitate completion
5
+ and accesses input history from the Ruby interpreter.
6
+ This module supported Edit Line(libedit) too.
7
+ libedit is compatible with GNU Readline.
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
9
+ - [GNU Readline](http://www.gnu.org/directory/readline.html)
10
+ - [libedit](http://www.thrysoee.dk/editline/)
11
+
12
+ See RDoc for Readline module.
6
13
 
7
14
  ## Installation
8
15
 
@@ -22,7 +29,20 @@ Or install it yourself as:
22
29
 
23
30
  ## Usage
24
31
 
25
- TODO: Write usage instructions here
32
+ ```ruby
33
+ require "readline"
34
+ while buf = Readline.readline("> ", true)
35
+ p buf
36
+ end
37
+ ```
38
+
39
+ ```ruby
40
+ require "readline"
41
+ while buf = Readline.readline("> ", true)
42
+ p Readline::HISTORY.to_a
43
+ print("-> ", buf, "\n")
44
+ end
45
+ ```
26
46
 
27
47
  ## Development
28
48
 
@@ -32,4 +52,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
52
 
33
53
  ## Contributing
34
54
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/hsbt/readline.
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/readline-ext.
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
+ require "rake/extensiontask"
4
+ require "fileutils"
3
5
 
4
6
  Rake::TestTask.new(:test) do |t|
5
7
  t.libs << "test"
@@ -7,4 +9,12 @@ Rake::TestTask.new(:test) do |t|
7
9
  t.test_files = FileList["test/**/test_*.rb"]
8
10
  end
9
11
 
10
- task :default => :test
12
+ Rake::ExtensionTask.new("readline")
13
+
14
+ task :default => [:compile, :test]
15
+
16
+ task :build => :make_gem_depend
17
+
18
+ task :make_gem_depend do
19
+ FileUtils.copy_file("ext/readline/depend-gem", "ext/readline/depend")
20
+ end
@@ -0,0 +1,4 @@
1
+ # AUTOGENERATED DEPENDENCIES START
2
+ readline.o: $(RUBY_EXTCONF_H)
3
+ readline.o: readline.c
4
+ # AUTOGENERATED DEPENDENCIES END
@@ -109,5 +109,4 @@ unless readline.have_type("rl_hook_func_t*")
109
109
  $defs << "-Drl_hook_func_t=Function"
110
110
  end
111
111
 
112
- $INCFLAGS << " -I$(top_srcdir)"
113
112
  create_makefile("readline")
@@ -78,7 +78,7 @@ static ID id_special_prefixes;
78
78
  #ifndef HAVE_RL_USERNAME_COMPLETION_FUNCTION
79
79
  # define rl_username_completion_function username_completion_function
80
80
  #else
81
- char *rl_username_completion_function(const char *, int);
81
+ RUBY_EXTERN char *rl_username_completion_function(const char *, int);
82
82
  #endif
83
83
  #ifndef HAVE_RL_COMPLETION_MATCHES
84
84
  # define rl_completion_matches completion_matches
@@ -95,7 +95,6 @@ static char **readline_attempted_completion_function(const char *text,
95
95
 
96
96
  #define OutputStringValue(str) do {\
97
97
  StringValueCStr(str);\
98
- rb_check_safe_obj(str);\
99
98
  (str) = rb_str_conv_enc((str), rb_enc_get(str), rb_locale_encoding());\
100
99
  } while (0)\
101
100
 
@@ -690,7 +689,7 @@ readline_s_insert_text(VALUE self, VALUE str)
690
689
  #endif
691
690
 
692
691
  #if defined(HAVE_RL_DELETE_TEXT)
693
- int rl_delete_text(int, int);
692
+ RUBY_EXTERN int rl_delete_text(int, int);
694
693
  static const char *
695
694
  str_subpos(const char *ptr, const char *end, long beg, long *sublen, rb_encoding *enc)
696
695
  {
@@ -1149,7 +1148,7 @@ readline_s_get_screen_size(VALUE self)
1149
1148
  #endif
1150
1149
 
1151
1150
  #ifdef HAVE_RL_VI_EDITING_MODE
1152
- int rl_vi_editing_mode(int, int);
1151
+ RUBY_EXTERN int rl_vi_editing_mode(int, int);
1153
1152
  /*
1154
1153
  * call-seq:
1155
1154
  * Readline.vi_editing_mode -> nil
@@ -1188,7 +1187,7 @@ readline_s_vi_editing_mode_p(VALUE self)
1188
1187
  #endif
1189
1188
 
1190
1189
  #ifdef HAVE_RL_EMACS_EDITING_MODE
1191
- int rl_emacs_editing_mode(int, int);
1190
+ RUBY_EXTERN int rl_emacs_editing_mode(int, int);
1192
1191
  /*
1193
1192
  * call-seq:
1194
1193
  * Readline.emacs_editing_mode -> nil
@@ -1382,7 +1381,7 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
1382
1381
  * Raises NotImplementedError if the using readline library does not support.
1383
1382
  */
1384
1383
  static VALUE
1385
- readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
1384
+ readline_s_get_basic_word_break_characters(VALUE self)
1386
1385
  {
1387
1386
  if (rl_basic_word_break_characters == NULL)
1388
1387
  return Qnil;
@@ -1437,7 +1436,7 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
1437
1436
  * Raises NotImplementedError if the using readline library does not support.
1438
1437
  */
1439
1438
  static VALUE
1440
- readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
1439
+ readline_s_get_completer_word_break_characters(VALUE self)
1441
1440
  {
1442
1441
  if (rl_completer_word_break_characters == NULL)
1443
1442
  return Qnil;
@@ -1552,7 +1551,7 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
1552
1551
  * Raises NotImplementedError if the using readline library does not support.
1553
1552
  */
1554
1553
  static VALUE
1555
- readline_s_get_basic_quote_characters(VALUE self, VALUE str)
1554
+ readline_s_get_basic_quote_characters(VALUE self)
1556
1555
  {
1557
1556
  if (rl_basic_quote_characters == NULL)
1558
1557
  return Qnil;
@@ -1608,7 +1607,7 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
1608
1607
  * Raises NotImplementedError if the using readline library does not support.
1609
1608
  */
1610
1609
  static VALUE
1611
- readline_s_get_completer_quote_characters(VALUE self, VALUE str)
1610
+ readline_s_get_completer_quote_characters(VALUE self)
1612
1611
  {
1613
1612
  if (rl_completer_quote_characters == NULL)
1614
1613
  return Qnil;
@@ -1662,7 +1661,7 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
1662
1661
  * Raises NotImplementedError if the using readline library does not support.
1663
1662
  */
1664
1663
  static VALUE
1665
- readline_s_get_filename_quote_characters(VALUE self, VALUE str)
1664
+ readline_s_get_filename_quote_characters(VALUE self)
1666
1665
  {
1667
1666
  if (rl_filename_quote_characters == NULL)
1668
1667
  return Qnil;
@@ -1673,7 +1672,7 @@ readline_s_get_filename_quote_characters(VALUE self, VALUE str)
1673
1672
  #endif
1674
1673
 
1675
1674
  #ifdef HAVE_RL_REFRESH_LINE
1676
- int rl_refresh_line(int, int);
1675
+ RUBY_EXTERN int rl_refresh_line(int, int);
1677
1676
  /*
1678
1677
  * call-seq:
1679
1678
  * Readline.refresh_line -> nil
@@ -1919,8 +1918,11 @@ username_completion_proc_call(VALUE self, VALUE str)
1919
1918
  return result;
1920
1919
  }
1921
1920
 
1921
+ #ifdef HAVE_RL_CATCH_SIGNALS
1922
+ RUBY_EXTERN int rl_catch_signals;
1923
+ #endif
1922
1924
  #ifdef HAVE_RL_CLEAR_SIGNALS
1923
- int rl_clear_signals(void);
1925
+ RUBY_EXTERN int rl_clear_signals(void);
1924
1926
  #endif
1925
1927
 
1926
1928
  #undef rb_intern
@@ -2061,7 +2063,7 @@ Init_readline(void)
2061
2063
  * The history buffer. It extends Enumerable module, so it behaves
2062
2064
  * just like an array.
2063
2065
  * For example, gets the fifth content that the user input by
2064
- * HISTORY[4].
2066
+ * <code>HISTORY[4]</code>.
2065
2067
  */
2066
2068
  rb_define_const(mReadline, "HISTORY", history);
2067
2069
 
@@ -2089,6 +2091,7 @@ Init_readline(void)
2089
2091
  #if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY
2090
2092
  if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION,
2091
2093
  strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) {
2094
+ prepare_readline();
2092
2095
  add_history("1");
2093
2096
  if (history_get(history_get_offset_func(0)) == NULL) {
2094
2097
  history_get_offset_func = history_get_offset_0;
data/readline-ext.gemspec CHANGED
@@ -1,21 +1,26 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "readline-ext"
3
- spec.version = "0.1.0.pre.1"
3
+ spec.version = "0.1.3"
4
4
  spec.authors = ["Yukihiro Matsumoto"]
5
5
  spec.email = ["matz@ruby-lang.org"]
6
6
 
7
7
  spec.summary = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
8
8
  spec.description = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
9
9
  spec.homepage = "https://github.com/ruby/readline-ext"
10
- spec.license = "BSD-2-Clause"
10
+ spec.licenses = ["Ruby", "BSD-2-Clause"]
11
+ spec.extensions = %w[ext/readline/extconf.rb]
11
12
 
12
13
  spec.metadata["homepage_uri"] = spec.homepage
13
14
  spec.metadata["source_code_uri"] = spec.homepage
14
15
 
15
16
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
16
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ `git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
18
  end
18
19
  spec.bindir = "exe"
19
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
21
  spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rake-compiler"
21
26
  end
metadata CHANGED
@@ -1,24 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readline-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yukihiro Matsumoto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-30 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake-compiler
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'
13
55
  description: Provides an interface for GNU Readline and Edit Line (libedit).
14
56
  email:
15
57
  - matz@ruby-lang.org
16
58
  executables: []
17
- extensions: []
59
+ extensions:
60
+ - ext/readline/extconf.rb
18
61
  extra_rdoc_files: []
19
62
  files:
63
+ - ".github/workflows/test.yml"
20
64
  - ".gitignore"
21
- - ".travis.yml"
22
65
  - Gemfile
23
66
  - LICENSE.txt
24
67
  - README.md
@@ -28,17 +71,18 @@ files:
28
71
  - ext/readline/.gitignore
29
72
  - ext/readline/README
30
73
  - ext/readline/README.ja
31
- - ext/readline/depend
74
+ - ext/readline/depend-gem
32
75
  - ext/readline/extconf.rb
33
76
  - ext/readline/readline.c
34
77
  - readline-ext.gemspec
35
78
  homepage: https://github.com/ruby/readline-ext
36
79
  licenses:
80
+ - Ruby
37
81
  - BSD-2-Clause
38
82
  metadata:
39
83
  homepage_uri: https://github.com/ruby/readline-ext
40
84
  source_code_uri: https://github.com/ruby/readline-ext
41
- post_install_message:
85
+ post_install_message:
42
86
  rdoc_options: []
43
87
  require_paths:
44
88
  - lib
@@ -49,12 +93,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
93
  version: '0'
50
94
  required_rubygems_version: !ruby/object:Gem::Requirement
51
95
  requirements:
52
- - - ">"
96
+ - - ">="
53
97
  - !ruby/object:Gem::Version
54
- version: 1.3.1
98
+ version: '0'
55
99
  requirements: []
56
- rubygems_version: 3.0.3
57
- signing_key:
100
+ rubygems_version: 3.3.0.dev
101
+ signing_key:
58
102
  specification_version: 4
59
103
  summary: Provides an interface for GNU Readline and Edit Line (libedit).
60
104
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2
data/ext/readline/depend DELETED
@@ -1,19 +0,0 @@
1
- # AUTOGENERATED DEPENDENCIES START
2
- readline.o: $(RUBY_EXTCONF_H)
3
- readline.o: $(arch_hdrdir)/ruby/config.h
4
- readline.o: $(hdrdir)/ruby.h
5
- readline.o: $(hdrdir)/ruby/assert.h
6
- readline.o: $(hdrdir)/ruby/backward.h
7
- readline.o: $(hdrdir)/ruby/defines.h
8
- readline.o: $(hdrdir)/ruby/encoding.h
9
- readline.o: $(hdrdir)/ruby/intern.h
10
- readline.o: $(hdrdir)/ruby/io.h
11
- readline.o: $(hdrdir)/ruby/missing.h
12
- readline.o: $(hdrdir)/ruby/onigmo.h
13
- readline.o: $(hdrdir)/ruby/oniguruma.h
14
- readline.o: $(hdrdir)/ruby/ruby.h
15
- readline.o: $(hdrdir)/ruby/st.h
16
- readline.o: $(hdrdir)/ruby/subst.h
17
- readline.o: $(hdrdir)/ruby/thread.h
18
- readline.o: readline.c
19
- # AUTOGENERATED DEPENDENCIES END