readline-ext 0.1.0 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c49bd4a1ba265ca14013a16f07d2e032a515d5e7096b50ad5d5ba9c8266c724
4
- data.tar.gz: bfd4f4d2122fe5d15c013294be1366db43b7532e6d3b138d0332e7c1b58f6b3d
3
+ metadata.gz: 56227f779fa87781e2c47322cf5350a253fc1ddf957b881689c0e35978e7e8b1
4
+ data.tar.gz: a7a646daa7b7876a3cf486e24c1e034b28f147580ccb326146aa21175e106a5e
5
5
  SHA512:
6
- metadata.gz: 3ccd3b9bb607f041bd202038c1d88e735140b110e205497676934fb56627f5954750d77aaa08ff5c78ae25f1f47174a45edbe1b99aee367fcebd1cd4f9a5897b
7
- data.tar.gz: 8f50874cfa969ac18ee564dacfd1acb720cc7512d70ad7a06960b3c201395751828bdb703f6dd3aa6805d753c3fa6446ed3f1f39b3cf148916bb276a415f9a25
6
+ metadata.gz: 06c1d284870cdc606ccc553d52f44b237595c31563d2a4b411f25c23eb2b022c726c04b1614ce9b25dab56dbee0110aadade6aa5b4ef8fa342020a61b2de6ef2
7
+ data.tar.gz: 9eb01c2e2f76c3bbd2dafbda1bd10f384d89312adeb66b59f30524b4c33e92578be5447d8e74a7530eadf4343596d3fa291604e3d599b2644220d450f2f41d1f
@@ -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
@@ -689,14 +689,13 @@ readline_s_insert_text(VALUE self, VALUE str)
689
689
  #endif
690
690
 
691
691
  #if defined(HAVE_RL_DELETE_TEXT)
692
- int rl_delete_text(int, int);
692
+ RUBY_EXTERN int rl_delete_text(int, int);
693
693
  static const char *
694
694
  str_subpos(const char *ptr, const char *end, long beg, long *sublen, rb_encoding *enc)
695
695
  {
696
696
  VALUE str = rb_enc_str_new_static(ptr, end-ptr, enc);
697
697
  OBJ_FREEZE(str);
698
698
  ptr = rb_str_subpos(str, beg, sublen);
699
- rb_gc_force_recycle(str);
700
699
  return ptr;
701
700
  }
702
701
 
@@ -1148,7 +1147,7 @@ readline_s_get_screen_size(VALUE self)
1148
1147
  #endif
1149
1148
 
1150
1149
  #ifdef HAVE_RL_VI_EDITING_MODE
1151
- int rl_vi_editing_mode(int, int);
1150
+ RUBY_EXTERN int rl_vi_editing_mode(int, int);
1152
1151
  /*
1153
1152
  * call-seq:
1154
1153
  * Readline.vi_editing_mode -> nil
@@ -1187,7 +1186,7 @@ readline_s_vi_editing_mode_p(VALUE self)
1187
1186
  #endif
1188
1187
 
1189
1188
  #ifdef HAVE_RL_EMACS_EDITING_MODE
1190
- int rl_emacs_editing_mode(int, int);
1189
+ RUBY_EXTERN int rl_emacs_editing_mode(int, int);
1191
1190
  /*
1192
1191
  * call-seq:
1193
1192
  * Readline.emacs_editing_mode -> nil
@@ -1672,7 +1671,7 @@ readline_s_get_filename_quote_characters(VALUE self)
1672
1671
  #endif
1673
1672
 
1674
1673
  #ifdef HAVE_RL_REFRESH_LINE
1675
- int rl_refresh_line(int, int);
1674
+ RUBY_EXTERN int rl_refresh_line(int, int);
1676
1675
  /*
1677
1676
  * call-seq:
1678
1677
  * Readline.refresh_line -> nil
@@ -1918,8 +1917,11 @@ username_completion_proc_call(VALUE self, VALUE str)
1918
1917
  return result;
1919
1918
  }
1920
1919
 
1920
+ #ifdef HAVE_RL_CATCH_SIGNALS
1921
+ RUBY_EXTERN int rl_catch_signals;
1922
+ #endif
1921
1923
  #ifdef HAVE_RL_CLEAR_SIGNALS
1922
- int rl_clear_signals(void);
1924
+ RUBY_EXTERN int rl_clear_signals(void);
1923
1925
  #endif
1924
1926
 
1925
1927
  #undef rb_intern
@@ -2060,7 +2062,7 @@ Init_readline(void)
2060
2062
  * The history buffer. It extends Enumerable module, so it behaves
2061
2063
  * just like an array.
2062
2064
  * For example, gets the fifth content that the user input by
2063
- * HISTORY[4].
2065
+ * <code>HISTORY[4]</code>.
2064
2066
  */
2065
2067
  rb_define_const(mReadline, "HISTORY", history);
2066
2068
 
@@ -2088,6 +2090,7 @@ Init_readline(void)
2088
2090
  #if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY
2089
2091
  if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION,
2090
2092
  strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) {
2093
+ prepare_readline();
2091
2094
  add_history("1");
2092
2095
  if (history_get(history_get_offset_func(0)) == NULL) {
2093
2096
  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"
3
+ spec.version = "0.1.4"
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
4
+ version: 0.1.4
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-12-25 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-12-24 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,18 +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
- - ext/readline/readline-ext.gemspec
34
76
  - ext/readline/readline.c
35
77
  - readline-ext.gemspec
36
78
  homepage: https://github.com/ruby/readline-ext
37
79
  licenses:
80
+ - Ruby
38
81
  - BSD-2-Clause
39
82
  metadata:
40
83
  homepage_uri: https://github.com/ruby/readline-ext
41
84
  source_code_uri: https://github.com/ruby/readline-ext
42
- post_install_message:
85
+ post_install_message:
43
86
  rdoc_options: []
44
87
  require_paths:
45
88
  - lib
@@ -54,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
97
  - !ruby/object:Gem::Version
55
98
  version: '0'
56
99
  requirements: []
57
- rubygems_version: 3.0.6
58
- signing_key:
100
+ rubygems_version: 3.3.2
101
+ signing_key:
59
102
  specification_version: 4
60
103
  summary: Provides an interface for GNU Readline and Edit Line (libedit).
61
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
@@ -1,21 +0,0 @@
1
- Gem::Specification.new do |spec|
2
- spec.name = "readline-ext"
3
- spec.version = "0.1.0"
4
- spec.authors = ["Yukihiro Matsumoto"]
5
- spec.email = ["matz@ruby-lang.org"]
6
-
7
- spec.summary = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
8
- spec.description = %q{Provides an interface for GNU Readline and Edit Line (libedit).}
9
- spec.homepage = "https://github.com/ruby/readline-ext"
10
- spec.license = "BSD-2-Clause"
11
-
12
- spec.metadata["homepage_uri"] = spec.homepage
13
- spec.metadata["source_code_uri"] = spec.homepage
14
-
15
- 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
- end
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
- end