rubyinstaller-build 0.1.0
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 +7 -0
- data/.github/ISSUE_TEMPLATE.md +8 -0
- data/.gitignore +12 -0
- data/.yardopts +7 -0
- data/CHANGELOG-2.4.md +166 -0
- data/CHANGELOG-2.5.md +87 -0
- data/CHANGELOG-2.6.md +62 -0
- data/CHANGELOG-2.7.md +22 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +25 -0
- data/README.md +114 -0
- data/Rakefile +164 -0
- data/appveyor-key.asc.asc +61 -0
- data/appveyor.yml +141 -0
- data/docker/Dockerfile +50 -0
- data/docker/Rakefile +22 -0
- data/gems/rubyinstaller-build.yaml +2 -0
- data/lib/devkit.rb +3 -0
- data/lib/ruby_installer.rb +3 -0
- data/lib/ruby_installer/build.rb +23 -0
- data/lib/ruby_installer/build/ca_cert_file.rb +66 -0
- data/lib/ruby_installer/build/colors.rb +45 -0
- data/lib/ruby_installer/build/components/01_msys2.rb +97 -0
- data/lib/ruby_installer/build/components/02_pacman_update.rb +35 -0
- data/lib/ruby_installer/build/components/03_dev_tools.rb +68 -0
- data/lib/ruby_installer/build/components/base.rb +58 -0
- data/lib/ruby_installer/build/components_installer.rb +53 -0
- data/lib/ruby_installer/build/dll_directory.rb +97 -0
- data/lib/ruby_installer/build/erb_compiler.rb +61 -0
- data/lib/ruby_installer/build/gem_version.rb +5 -0
- data/lib/ruby_installer/build/gems.rb +74 -0
- data/lib/ruby_installer/build/msys2_installation.rb +280 -0
- data/lib/ruby_installer/build/openstruct.rb +29 -0
- data/lib/ruby_installer/build/release.rb +120 -0
- data/lib/ruby_installer/build/singleton.rb +45 -0
- data/lib/ruby_installer/build/task.rb +20 -0
- data/lib/ruby_installer/build/utils.rb +110 -0
- data/lib/ruby_installer/runtime.rb +18 -0
- data/lib/ruby_installer/runtime/ridk.rb +195 -0
- data/packages/ri-msys/Rakefile +72 -0
- data/packages/ri-msys/recipes/sandbox/70-add-msys2-installation.rake +18 -0
- data/packages/ri/Rakefile +60 -0
- data/recipes/archive-7z/10-define-variables.rake +2 -0
- data/recipes/archive-7z/70-create-archive.rake +10 -0
- data/recipes/archive-7z/90-define-main-task.rake +2 -0
- data/recipes/installer-inno/10-define-variables.rake +2 -0
- data/recipes/installer-inno/50-generate-filelist.rake +28 -0
- data/recipes/installer-inno/60-generate-iss-file.rake +8 -0
- data/recipes/installer-inno/70-run-iscc.rake +19 -0
- data/recipes/installer-inno/90-define-main-task.rake +2 -0
- data/recipes/installer-inno/events.iss +88 -0
- data/recipes/installer-inno/images/fake.bmp +0 -0
- data/recipes/installer-inno/images/wizard-large.bmp +0 -0
- data/recipes/installer-inno/images/wizard-logo.bmp +0 -0
- data/recipes/installer-inno/ri_gui.iss +286 -0
- data/recipes/installer-inno/rubyinstaller.iss.erb +157 -0
- data/recipes/installer-inno/util.iss +271 -0
- data/recipes/msys2/10-define-variables.rake +6 -0
- data/recipes/msys2/30-download-msys2-base.rake +4 -0
- data/recipes/msys2/40-extract-msys2-base.rake +9 -0
- data/recipes/msys2/50-init-msys.rake +8 -0
- data/recipes/msys2/50-install-components.rake +19 -0
- data/recipes/msys2/90-define-main-task.rake +2 -0
- data/recipes/sandbox/10-define-variables.rake +6 -0
- data/recipes/sandbox/20-add-runtime-files.rake +15 -0
- data/recipes/sandbox/20-define-import-files.rake +16 -0
- data/recipes/sandbox/20-define-import-readline.rake +28 -0
- data/recipes/sandbox/20-extend-irb.rake +13 -0
- data/recipes/sandbox/40-fix-rake-shebang.rake +6 -0
- data/recipes/sandbox/40-generate-rake-cmd.rake +7 -0
- data/recipes/sandbox/40-generate-version-file.rake +20 -0
- data/recipes/sandbox/50-do-import-files.rake +17 -0
- data/recipes/sandbox/50-gather-sandbox-files.rake +6 -0
- data/recipes/sandbox/60-define-gem-wrappers.rake +5 -0
- data/recipes/sandbox/60-side-by-side-assembly.rake +81 -0
- data/recipes/sandbox/70-add-gem-bin-wrappers.rake +10 -0
- data/recipes/sandbox/70-install-gems.rake +11 -0
- data/recipes/sandbox/80-copy-msys-files.rake +8 -0
- data/recipes/sandbox/90-define-main-task.rake +2 -0
- data/recipes/sandbox/LICENSE.txt +24 -0
- data/recipes/sandbox/rubyinstaller-2.3.4-x64.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.3.4-x86.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.3.4.files +43 -0
- data/recipes/sandbox/rubyinstaller-2.4.10-x64.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.4.10-x86.files +4 -0
- data/recipes/sandbox/rubyinstaller-2.4.10.files +44 -0
- data/recipes/sandbox/rubyinstaller-2.5.8-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.5.8-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.5.8.files +33 -0
- data/recipes/sandbox/rubyinstaller-2.6.6-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.6.6-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.6.6.files +35 -0
- data/recipes/sandbox/rubyinstaller-2.7.1-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.7.1-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-2.7.1.files +35 -0
- data/recipes/sandbox/rubyinstaller-head-x64.files +6 -0
- data/recipes/sandbox/rubyinstaller-head-x86.files +6 -0
- data/recipes/sandbox/rubyinstaller-head.files +35 -0
- data/recipes/unpack/10-define-variables.rake +5 -0
- data/recipes/unpack/20-define-msys-packages.rake +1 -0
- data/recipes/unpack/30-add-ri2-repo-to-msys.rake +41 -0
- data/recipes/unpack/50-install-msys-packages.rake +28 -0
- data/recipes/unpack/90-define-main-task.rake +2 -0
- data/recipes/unpack/appveyor-repo-key.asc +29 -0
- data/resources/files/irbrc_predefiner.rb +21 -0
- data/resources/files/operating_system.rb +21 -0
- data/resources/files/readline.rb +17 -0
- data/resources/files/reline.rb +437 -0
- data/resources/files/reline/ansi.rb +177 -0
- data/resources/files/reline/config.rb +297 -0
- data/resources/files/reline/general_io.rb +75 -0
- data/resources/files/reline/history.rb +56 -0
- data/resources/files/reline/key_actor.rb +7 -0
- data/resources/files/reline/key_actor/base.rb +7 -0
- data/resources/files/reline/key_actor/emacs.rb +517 -0
- data/resources/files/reline/key_actor/vi_command.rb +518 -0
- data/resources/files/reline/key_actor/vi_insert.rb +517 -0
- data/resources/files/reline/key_stroke.rb +53 -0
- data/resources/files/reline/kill_ring.rb +113 -0
- data/resources/files/reline/line_editor.rb +2231 -0
- data/resources/files/reline/unicode.rb +527 -0
- data/resources/files/reline/unicode/east_asian_width.rb +1145 -0
- data/resources/files/reline/version.rb +3 -0
- data/resources/files/reline/windows.rb +273 -0
- data/resources/files/ridk.cmd +39 -0
- data/resources/files/ridk.ps1 +26 -0
- data/resources/files/ridk_use/ridk.cmd +13 -0
- data/resources/files/ridk_use/ridk.ps1 +17 -0
- data/resources/files/ridk_use/ridk_use.rb +221 -0
- data/resources/files/setrbvars.cmd +14 -0
- data/resources/icons/ruby-doc.ico +0 -0
- data/resources/ssl/README-SSL.md +37 -0
- data/resources/ssl/c_rehash.rb +167 -0
- data/resources/ssl/cacert.pem +4105 -0
- data/rubyinstaller-build.gemspec +28 -0
- metadata +226 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
bin/erb
|
|
2
|
+
bin/erb.cmd
|
|
3
|
+
bin/gem
|
|
4
|
+
bin/gem.cmd
|
|
5
|
+
bin/irb
|
|
6
|
+
bin/irb.cmd
|
|
7
|
+
bin/libffi-7.dll
|
|
8
|
+
bin/libgdbm-6.dll
|
|
9
|
+
bin/libgdbm_compat-4.dll
|
|
10
|
+
bin/libgmp-10.dll
|
|
11
|
+
bin/libiconv-2.dll
|
|
12
|
+
bin/libintl-8.dll
|
|
13
|
+
bin/libssp-0.dll
|
|
14
|
+
bin/libyaml-0-2.dll
|
|
15
|
+
bin/rake
|
|
16
|
+
bin/rake.cmd
|
|
17
|
+
bin/rdoc
|
|
18
|
+
bin/rdoc.cmd
|
|
19
|
+
bin/ri
|
|
20
|
+
bin/ri.cmd
|
|
21
|
+
bin/ruby.exe
|
|
22
|
+
bin/rubyw.exe
|
|
23
|
+
bin/zlib1.dll
|
|
24
|
+
include/ruby-2.5.0
|
|
25
|
+
lib/engines-1_1/capi.dll
|
|
26
|
+
lib/engines-1_1/padlock.dll
|
|
27
|
+
lib/pkgconfig/ruby-2.5.pc
|
|
28
|
+
lib/ruby/2.5.0
|
|
29
|
+
lib/ruby/gems/2.5.0
|
|
30
|
+
lib/ruby/site_ruby/2.5.0
|
|
31
|
+
lib/ruby/vendor_ruby/2.5.0
|
|
32
|
+
share/doc/ruby/html/
|
|
33
|
+
share/ri/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
bin/bundle.cmd
|
|
2
|
+
bin/bundler.cmd
|
|
3
|
+
bin/erb
|
|
4
|
+
bin/erb.cmd
|
|
5
|
+
bin/gem
|
|
6
|
+
bin/gem.cmd
|
|
7
|
+
bin/irb
|
|
8
|
+
bin/irb.cmd
|
|
9
|
+
bin/libffi-7.dll
|
|
10
|
+
bin/libgdbm-6.dll
|
|
11
|
+
bin/libgdbm_compat-4.dll
|
|
12
|
+
bin/libgmp-10.dll
|
|
13
|
+
bin/libiconv-2.dll
|
|
14
|
+
bin/libintl-8.dll
|
|
15
|
+
bin/libssp-0.dll
|
|
16
|
+
bin/libyaml-0-2.dll
|
|
17
|
+
bin/rake
|
|
18
|
+
bin/rake.cmd
|
|
19
|
+
bin/rdoc
|
|
20
|
+
bin/rdoc.cmd
|
|
21
|
+
bin/ri
|
|
22
|
+
bin/ri.cmd
|
|
23
|
+
bin/ruby.exe
|
|
24
|
+
bin/rubyw.exe
|
|
25
|
+
bin/zlib1.dll
|
|
26
|
+
include/ruby-2.6.0
|
|
27
|
+
lib/engines-1_1/capi.dll
|
|
28
|
+
lib/engines-1_1/padlock.dll
|
|
29
|
+
lib/pkgconfig/ruby-2.6.pc
|
|
30
|
+
lib/ruby/2.6.0
|
|
31
|
+
lib/ruby/gems/2.6.0
|
|
32
|
+
lib/ruby/site_ruby/2.6.0
|
|
33
|
+
lib/ruby/vendor_ruby/2.6.0
|
|
34
|
+
share/doc/ruby/html/
|
|
35
|
+
share/ri/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
bin/bundle.cmd
|
|
2
|
+
bin/bundler.cmd
|
|
3
|
+
bin/erb
|
|
4
|
+
bin/erb.cmd
|
|
5
|
+
bin/gem
|
|
6
|
+
bin/gem.cmd
|
|
7
|
+
bin/irb
|
|
8
|
+
bin/irb.cmd
|
|
9
|
+
bin/libffi-7.dll
|
|
10
|
+
bin/libgdbm-6.dll
|
|
11
|
+
bin/libgdbm_compat-4.dll
|
|
12
|
+
bin/libgmp-10.dll
|
|
13
|
+
bin/libiconv-2.dll
|
|
14
|
+
bin/libintl-8.dll
|
|
15
|
+
bin/libssp-0.dll
|
|
16
|
+
bin/libyaml-0-2.dll
|
|
17
|
+
bin/rake
|
|
18
|
+
bin/rake.cmd
|
|
19
|
+
bin/rdoc
|
|
20
|
+
bin/rdoc.cmd
|
|
21
|
+
bin/ri
|
|
22
|
+
bin/ri.cmd
|
|
23
|
+
bin/ruby.exe
|
|
24
|
+
bin/rubyw.exe
|
|
25
|
+
bin/zlib1.dll
|
|
26
|
+
include/ruby-2.7.0
|
|
27
|
+
lib/engines-1_1/capi.dll
|
|
28
|
+
lib/engines-1_1/padlock.dll
|
|
29
|
+
lib/pkgconfig/ruby-2.7.pc
|
|
30
|
+
lib/ruby/2.7.0
|
|
31
|
+
lib/ruby/gems/2.7.0
|
|
32
|
+
lib/ruby/site_ruby/2.7.0
|
|
33
|
+
lib/ruby/vendor_ruby/2.7.0
|
|
34
|
+
share/doc/ruby/html/
|
|
35
|
+
share/ri/
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
bin/bundle.cmd
|
|
2
|
+
bin/bundler.cmd
|
|
3
|
+
bin/erb
|
|
4
|
+
bin/erb.cmd
|
|
5
|
+
bin/gem
|
|
6
|
+
bin/gem.cmd
|
|
7
|
+
bin/irb
|
|
8
|
+
bin/irb.cmd
|
|
9
|
+
bin/libffi-7.dll
|
|
10
|
+
bin/libgdbm-6.dll
|
|
11
|
+
bin/libgdbm_compat-4.dll
|
|
12
|
+
bin/libgmp-10.dll
|
|
13
|
+
bin/libiconv-2.dll
|
|
14
|
+
bin/libintl-8.dll
|
|
15
|
+
bin/libssp-0.dll
|
|
16
|
+
bin/libyaml-0-2.dll
|
|
17
|
+
bin/rake
|
|
18
|
+
bin/rake.cmd
|
|
19
|
+
bin/rdoc
|
|
20
|
+
bin/rdoc.cmd
|
|
21
|
+
bin/ri
|
|
22
|
+
bin/ri.cmd
|
|
23
|
+
bin/ruby.exe
|
|
24
|
+
bin/rubyw.exe
|
|
25
|
+
bin/zlib1.dll
|
|
26
|
+
include/ruby-2.8.0
|
|
27
|
+
lib/engines-1_1/capi.dll
|
|
28
|
+
lib/engines-1_1/padlock.dll
|
|
29
|
+
lib/pkgconfig/ruby-2.8.pc
|
|
30
|
+
lib/ruby/2.8.0
|
|
31
|
+
lib/ruby/gems/2.8.0
|
|
32
|
+
lib/ruby/site_ruby/2.8.0
|
|
33
|
+
lib/ruby/vendor_ruby/2.8.0
|
|
34
|
+
share/doc/ruby/html/
|
|
35
|
+
share/ri/
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
self.unpackdir = "recipes/unpack/ruby-#{package.rubyver}-#{package.arch}"
|
|
2
|
+
self.unpackdirmgw = File.join(unpackdir, package.mingwdir)
|
|
3
|
+
self.unpackdir_abs = File.expand_path(unpackdir, package.rootdir)
|
|
4
|
+
self.ruby_exe = "#{unpackdirmgw}/bin/ruby.exe"
|
|
5
|
+
self.repo_added = "recipes/unpack/ri2-repo-added"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
self.install_packages = [package.pacman_ruby]
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
directory File.dirname(self.repo_added)
|
|
2
|
+
file self.repo_added => [File.dirname(self.repo_added)] do |t|
|
|
3
|
+
msys_path = RubyInstaller::Build.msys2_installation.msys_path
|
|
4
|
+
pacman_conf = File.join(msys_path, "/etc/pacman.conf")
|
|
5
|
+
|
|
6
|
+
unless File.read(pacman_conf) =~ /^\[ci\.ri2\]/
|
|
7
|
+
File.open(pacman_conf, "a+") do |fd|
|
|
8
|
+
fd.puts
|
|
9
|
+
fd.puts "# Added for RubyInstaller2 packaging by #{__FILE__}"
|
|
10
|
+
fd.puts <<-EOT
|
|
11
|
+
[ci.ri2]
|
|
12
|
+
Server = http://dl.bintray.com/larskanis/rubyinstaller2-packages
|
|
13
|
+
EOT
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Import our key into the local pacman signature key database.
|
|
18
|
+
key = File.read(File.expand_path("../appveyor-repo-key.asc", __FILE__))
|
|
19
|
+
cmd = "gpg --homedir /etc/pacman.d/gnupg --verbose --batch --import - 2>&1"
|
|
20
|
+
# cmd = "bash pacman-key --add -"
|
|
21
|
+
$stderr.puts cmd.to_s
|
|
22
|
+
io = IO.popen(cmd, "w+")
|
|
23
|
+
io.puts key
|
|
24
|
+
io.close_write
|
|
25
|
+
loop do
|
|
26
|
+
l = io.gets
|
|
27
|
+
$stderr.puts "gpg: #{l.inspect}"
|
|
28
|
+
break l if !l || l=~/imported|processed/i
|
|
29
|
+
end
|
|
30
|
+
# In docker container gpg often doesn't terminate, so that we don't wait for that it has been closed
|
|
31
|
+
# io.close
|
|
32
|
+
raise "pacman-key failed: #{res}" if $?.exitstatus!=0
|
|
33
|
+
|
|
34
|
+
# Sign the imported key, so that it's trusted.
|
|
35
|
+
sh "sh -c 'pacman-key --lsign-key BE8BF1C5'"
|
|
36
|
+
|
|
37
|
+
# Download the new package database.
|
|
38
|
+
sh "pacman -Sy"
|
|
39
|
+
|
|
40
|
+
touch t.name
|
|
41
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
file ruby_exe => [self.repo_added] do
|
|
2
|
+
# pacman doesn't work on automount paths (/c/path), so that we
|
|
3
|
+
# mount to /tmp
|
|
4
|
+
pmrootdir = "/tmp/rubyinstaller/ruby-#{package.rubyver}-#{package.arch}"
|
|
5
|
+
mkdir_p File.join(ENV['RI_DEVKIT'], pmrootdir)
|
|
6
|
+
mkdir_p unpackdir
|
|
7
|
+
rm_rf unpackdir
|
|
8
|
+
%w[var/cache/pacman/pkg var/lib/pacman].each do |dir|
|
|
9
|
+
mkdir_p File.join(unpackdir, dir)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
msys_sh <<-EOT
|
|
13
|
+
mount #{unpackdir_abs.inspect} #{pmrootdir.inspect} &&
|
|
14
|
+
pacman --root #{pmrootdir.inspect} -Sy &&
|
|
15
|
+
pacman --root #{pmrootdir.inspect} --noconfirm -S #{install_packages.map(&:inspect).join(" ")}
|
|
16
|
+
umount #{pmrootdir.inspect}
|
|
17
|
+
EOT
|
|
18
|
+
|
|
19
|
+
begin
|
|
20
|
+
# For some reason pacman-5.2.1 generates package files, that prohibit changing files after installation.
|
|
21
|
+
# Resetting the permissions the hard way fixes this, so that we can touch ruby.exe .
|
|
22
|
+
sh "takeown /R /F \"#{unpackdir.gsub("/","\\")}\" >NUL"
|
|
23
|
+
sh "icacls \"#{unpackdir.gsub("/","\\")}\" /inheritance:r /grant BUILTIN\\Users:F /T /Q"
|
|
24
|
+
rescue => err
|
|
25
|
+
$stderr.puts "ignoring error while adjusting permissions: #{err} (#{err.class})"
|
|
26
|
+
end
|
|
27
|
+
touch ruby_exe
|
|
28
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
2
|
+
|
|
3
|
+
mQENBFlFUekBCADWxSUmTv7lemKTNY4k+QUL8FP2xSe9mo5pcSjyuHZE85B9JtdG
|
|
4
|
+
bbkahLrITemMoW4Z4KbtsGRN/owb26rok0y0apYXlDcki+T+8Wnu1Soz+pC6FIvZ
|
|
5
|
+
Q/m5pu7Sw9Vm3UI8+UvKGEfpAwD2MZ7as6xsN5sMM6MDddBYMoGJOxELFtoDBd+b
|
|
6
|
+
1nyBXMn+iDSu8NeyxBA5/6X93PTFAX24iO3TtgYi/PnE7nrFq7UDVLcHeoO4vgJg
|
|
7
|
+
RCgw55ev6/T3QuAFsfAlde8ppAZX2izxshk8zfz31Z+YjsGgdvUV++DY1lt8W5b1
|
|
8
|
+
/jnO+tjXjdl7DX4BI0gOvoUWy+Qx5BY7aztXABEBAAG0IGFwcHZleW9yIHJpMiBw
|
|
9
|
+
YWNrYWdlIHNpZ25pbmcga2V5iQE+BBMBAgAoBQJZRVHpAhsDBQkSzAMABgsJCAcD
|
|
10
|
+
AgYVCAIJCgsEFgIDAQIeAQIXgAAKCRD5i4SEvovxxddnB/9HjTKn55SW6ICHnZJT
|
|
11
|
+
8ZqFnVTnGKHlMZ6aSlEAzcHWsaqtVtXCRFDV1BXjxTf/Y0kNaHmjJFsop3Kg2Ye6
|
|
12
|
+
mKlx4dMQ7NT1+CJOyN8OXuGsjySnX6igXxaQ+EAHCcgEHIvPOVkgFWwS8ZXK3hQC
|
|
13
|
+
q8uiPF1a5ZZo5V0GW9MljQjAIBt+t0StC8CEcsIkH+yjfxxL60CujdP64wIMcavA
|
|
14
|
+
/970dkPn7Yw8gzsCT8CVpDkeB8xpkG37vRerPeXDv5P9Ty4vqD5dC2fAGy4siPef
|
|
15
|
+
SXnMjDs378r/wUKHPCUckweCY1sH0KXzXRI++N2MROFYwG87ktjcI2hlPbSaaFUl
|
|
16
|
+
kH16uQENBFlFUekBCADpN0twy6t6l8TK4SGQpPwHVlApku92hhLMrLYHY4q6Dblz
|
|
17
|
+
O6UrHcpCRf1hFVIGdoOxRcWGDOxptqEYsxC5twTYmTCBwp5GgaBwVTtOgZ9+xIxj
|
|
18
|
+
SGzCaTdlZwXwno7EhVuzQkEUU6dhPRxf3/zOjy+EEHpGkGVk/F15lC7V8C2Kt6wc
|
|
19
|
+
oTSC8ayYKze/RPUPO98UC0SaMl+rc9/AivQk5rR9OQk2P/zhrdGShiz3CBXIypUN
|
|
20
|
+
hvSeebZd46duTBcChpxECXPOzFeVda0h3EgzwubEupYfIPBa23RgL+n+Lxh0V95R
|
|
21
|
+
f4GSnNU9CEcRbodXNuPcddlVIX8CipBFD7wW/31DABEBAAGJASUEGAECAA8FAllF
|
|
22
|
+
UekCGwwFCRLMAwAACgkQ+YuEhL6L8cV8BAf+MWurz5fAJCkNdhD+Nm0lY7XZib6u
|
|
23
|
+
CgsyT4y41IhOkRJEv3uScDNIF4rdlLZfct8txe4Gd55bsHdfCdMNUV93CcaswRGk
|
|
24
|
+
CKY0W4ABrWV9El0fsp/7qO6o3tEC1EjdIsjrePJm92ZXGA7TmY5Ewt4gPOF3huwa
|
|
25
|
+
gKC7I43ctH9fAr1q70dIkj2OJcCDhf0jJRPgg9xvKTYygNKRikjVeTGiVlEWd0w1
|
|
26
|
+
QBO4kjamUXxg45D9bORToFBIiTkUXYHeM20jSgxvYf/rSH68+NRnPTMIGcUXm4Yp
|
|
27
|
+
AnSYaRoNSL948BSp+WuQ29ootda2SsfyRK3w4e93+gVzcvwzDXwfEU8sxw==
|
|
28
|
+
=R3Ib
|
|
29
|
+
-----END PGP PUBLIC KEY BLOCK-----
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'irb'
|
|
2
|
+
|
|
3
|
+
irbrc_file = IRB.enum_for(:rc_file_generators).first.call(IRB::IRBRC_EXT)
|
|
4
|
+
|
|
5
|
+
if irbrc_file && !File.exist?(irbrc_file)
|
|
6
|
+
File.write irbrc_file, <<-EOT
|
|
7
|
+
require 'irb/ext/save-history'
|
|
8
|
+
require 'irb/completion'
|
|
9
|
+
IRB.conf[:SAVE_HISTORY] = 200
|
|
10
|
+
EOT
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Try to convert .irb_history from locale to UTF-8, if it isn't encoded properly.
|
|
14
|
+
# This is for transition from CP* encodings of RbReadline to UTF-8 or Reline.
|
|
15
|
+
history_file = IRB.rc_file("_history")
|
|
16
|
+
if File.exist?(history_file) && !(hist=File.read(history_file, encoding: 'utf-8')).valid_encoding?
|
|
17
|
+
hist = hist.encode('utf-8', Encoding.find("locale"))
|
|
18
|
+
if hist.valid_encoding?
|
|
19
|
+
File.write(history_file, hist)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "ruby_installer/runtime"
|
|
2
|
+
|
|
3
|
+
RubyInstaller::Runtime.enable_dll_search_paths
|
|
4
|
+
|
|
5
|
+
Gem.pre_install do |gem_installer|
|
|
6
|
+
RubyInstaller::Runtime.enable_msys_apps(for_gem_install: true) unless gem_installer.spec.extensions.empty?
|
|
7
|
+
|
|
8
|
+
if !gem_installer.options || !gem_installer.options[:ignore_dependencies] || gem_installer.options[:bundler_expected_checksum]
|
|
9
|
+
[['msys2_dependencies' , :install_packages ],
|
|
10
|
+
['msys2_mingw_dependencies', :install_mingw_packages]].each do |metakey, func|
|
|
11
|
+
|
|
12
|
+
if deps=gem_installer.spec.metadata[metakey]
|
|
13
|
+
begin
|
|
14
|
+
RubyInstaller::Runtime.msys2_installation.send(func, deps.split(" "), verbose: Gem.configuration.verbose)
|
|
15
|
+
rescue RubyInstaller::Runtime::Msys2Installation::CommandError => err
|
|
16
|
+
Gem.ui.say(err.to_s)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
if RUBY_VERSION < "2.5"
|
|
2
|
+
class String
|
|
3
|
+
def grapheme_clusters
|
|
4
|
+
chars
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Array
|
|
9
|
+
alias any_wo_arg? any?
|
|
10
|
+
def any?(obj=nil, &block)
|
|
11
|
+
obj ? any_wo_arg? { |o| o==obj } : any_wo_arg?(&block)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
require 'reline' unless defined? Reline
|
|
17
|
+
Readline = Reline
|
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
require 'io/console'
|
|
2
|
+
require 'timeout'
|
|
3
|
+
require 'forwardable'
|
|
4
|
+
require 'reline/version'
|
|
5
|
+
require 'reline/config'
|
|
6
|
+
require 'reline/key_actor'
|
|
7
|
+
require 'reline/key_stroke'
|
|
8
|
+
require 'reline/line_editor'
|
|
9
|
+
require 'reline/history'
|
|
10
|
+
|
|
11
|
+
module Reline
|
|
12
|
+
FILENAME_COMPLETION_PROC = nil
|
|
13
|
+
USERNAME_COMPLETION_PROC = nil
|
|
14
|
+
|
|
15
|
+
Key = Struct.new('Key', :char, :combined_char, :with_meta)
|
|
16
|
+
CursorPos = Struct.new(:x, :y)
|
|
17
|
+
|
|
18
|
+
class Core
|
|
19
|
+
ATTR_READER_NAMES = %i(
|
|
20
|
+
completion_append_character
|
|
21
|
+
basic_word_break_characters
|
|
22
|
+
completer_word_break_characters
|
|
23
|
+
basic_quote_characters
|
|
24
|
+
completer_quote_characters
|
|
25
|
+
filename_quote_characters
|
|
26
|
+
special_prefixes
|
|
27
|
+
completion_proc
|
|
28
|
+
output_modifier_proc
|
|
29
|
+
prompt_proc
|
|
30
|
+
auto_indent_proc
|
|
31
|
+
pre_input_hook
|
|
32
|
+
dig_perfect_match_proc
|
|
33
|
+
).each(&method(:attr_reader))
|
|
34
|
+
|
|
35
|
+
attr_accessor :config
|
|
36
|
+
attr_accessor :key_stroke
|
|
37
|
+
attr_accessor :line_editor
|
|
38
|
+
attr_accessor :ambiguous_width
|
|
39
|
+
attr_accessor :last_incremental_search
|
|
40
|
+
attr_reader :output
|
|
41
|
+
|
|
42
|
+
def initialize
|
|
43
|
+
self.output = STDOUT
|
|
44
|
+
yield self
|
|
45
|
+
@completion_quote_character = nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def encoding
|
|
49
|
+
Reline::IOGate.encoding
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def completion_append_character=(val)
|
|
53
|
+
if val.nil?
|
|
54
|
+
@completion_append_character = nil
|
|
55
|
+
elsif val.size == 1
|
|
56
|
+
@completion_append_character = val.encode(Reline::IOGate.encoding)
|
|
57
|
+
elsif val.size > 1
|
|
58
|
+
@completion_append_character = val[0].encode(Reline::IOGate.encoding)
|
|
59
|
+
else
|
|
60
|
+
@completion_append_character = nil
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def basic_word_break_characters=(v)
|
|
65
|
+
@basic_word_break_characters = v.encode(Reline::IOGate.encoding)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def completer_word_break_characters=(v)
|
|
69
|
+
@completer_word_break_characters = v.encode(Reline::IOGate.encoding)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def basic_quote_characters=(v)
|
|
73
|
+
@basic_quote_characters = v.encode(Reline::IOGate.encoding)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def completer_quote_characters=(v)
|
|
77
|
+
@completer_quote_characters = v.encode(Reline::IOGate.encoding)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def filename_quote_characters=(v)
|
|
81
|
+
@filename_quote_characters = v.encode(Reline::IOGate.encoding)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def special_prefixes=(v)
|
|
85
|
+
@special_prefixes = v.encode(Reline::IOGate.encoding)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def completion_case_fold=(v)
|
|
89
|
+
@config.completion_ignore_case = v
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def completion_case_fold
|
|
93
|
+
@config.completion_ignore_case
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def completion_quote_character
|
|
97
|
+
@completion_quote_character
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def completion_proc=(p)
|
|
101
|
+
raise ArgumentError unless p.respond_to?(:call)
|
|
102
|
+
@completion_proc = p
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def output_modifier_proc=(p)
|
|
106
|
+
raise ArgumentError unless p.respond_to?(:call)
|
|
107
|
+
@output_modifier_proc = p
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def prompt_proc=(p)
|
|
111
|
+
raise ArgumentError unless p.respond_to?(:call)
|
|
112
|
+
@prompt_proc = p
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def auto_indent_proc=(p)
|
|
116
|
+
raise ArgumentError unless p.respond_to?(:call)
|
|
117
|
+
@auto_indent_proc = p
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def pre_input_hook=(p)
|
|
121
|
+
@pre_input_hook = p
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def dig_perfect_match_proc=(p)
|
|
125
|
+
raise ArgumentError unless p.respond_to?(:call)
|
|
126
|
+
@dig_perfect_match_proc = p
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def input=(val)
|
|
130
|
+
raise TypeError unless val.respond_to?(:getc) or val.nil?
|
|
131
|
+
if val.respond_to?(:getc)
|
|
132
|
+
if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
|
|
133
|
+
Reline::ANSI.input = val
|
|
134
|
+
elsif Reline::IOGate == Reline::GeneralIO
|
|
135
|
+
Reline::GeneralIO.input = val
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def output=(val)
|
|
141
|
+
raise TypeError unless val.respond_to?(:write) or val.nil?
|
|
142
|
+
@output = val
|
|
143
|
+
if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
|
|
144
|
+
Reline::ANSI.output = val
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def vi_editing_mode
|
|
149
|
+
config.editing_mode = :vi_insert
|
|
150
|
+
nil
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def emacs_editing_mode
|
|
154
|
+
config.editing_mode = :emacs
|
|
155
|
+
nil
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def vi_editing_mode?
|
|
159
|
+
config.editing_mode_is?(:vi_insert, :vi_command)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def emacs_editing_mode?
|
|
163
|
+
config.editing_mode_is?(:emacs)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def get_screen_size
|
|
167
|
+
Reline::IOGate.get_screen_size
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
|
|
171
|
+
unless confirm_multiline_termination
|
|
172
|
+
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
|
|
173
|
+
end
|
|
174
|
+
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
|
|
175
|
+
|
|
176
|
+
whole_buffer = line_editor.whole_buffer.dup
|
|
177
|
+
whole_buffer.taint if RUBY_VERSION < '2.7'
|
|
178
|
+
if add_hist and whole_buffer and whole_buffer.chomp("\n").size > 0
|
|
179
|
+
Reline::HISTORY << whole_buffer
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
line_editor.reset_line if line_editor.whole_buffer.nil?
|
|
183
|
+
whole_buffer
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def readline(prompt = '', add_hist = false)
|
|
187
|
+
inner_readline(prompt, add_hist, false)
|
|
188
|
+
|
|
189
|
+
line = line_editor.line.dup
|
|
190
|
+
line.taint if RUBY_VERSION < '2.7'
|
|
191
|
+
if add_hist and line and line.chomp("\n").size > 0
|
|
192
|
+
Reline::HISTORY << line.chomp("\n")
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
line_editor.reset_line if line_editor.line.nil?
|
|
196
|
+
line
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
private def inner_readline(prompt, add_hist, multiline, &confirm_multiline_termination)
|
|
200
|
+
if ENV['RELINE_STDERR_TTY']
|
|
201
|
+
$stderr.reopen(ENV['RELINE_STDERR_TTY'], 'w')
|
|
202
|
+
$stderr.sync = true
|
|
203
|
+
$stderr.puts "Reline is used by #{Process.pid}"
|
|
204
|
+
end
|
|
205
|
+
otio = Reline::IOGate.prep
|
|
206
|
+
|
|
207
|
+
may_req_ambiguous_char_width
|
|
208
|
+
line_editor.reset(prompt, encoding: Reline::IOGate.encoding)
|
|
209
|
+
if multiline
|
|
210
|
+
line_editor.multiline_on
|
|
211
|
+
if block_given?
|
|
212
|
+
line_editor.confirm_multiline_termination_proc = confirm_multiline_termination
|
|
213
|
+
end
|
|
214
|
+
else
|
|
215
|
+
line_editor.multiline_off
|
|
216
|
+
end
|
|
217
|
+
line_editor.output = output
|
|
218
|
+
line_editor.completion_proc = completion_proc
|
|
219
|
+
line_editor.completion_append_character = completion_append_character
|
|
220
|
+
line_editor.output_modifier_proc = output_modifier_proc
|
|
221
|
+
line_editor.prompt_proc = prompt_proc
|
|
222
|
+
line_editor.auto_indent_proc = auto_indent_proc
|
|
223
|
+
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
|
|
224
|
+
line_editor.pre_input_hook = pre_input_hook
|
|
225
|
+
line_editor.rerender
|
|
226
|
+
|
|
227
|
+
unless config.test_mode
|
|
228
|
+
config.read
|
|
229
|
+
config.reset_default_key_bindings
|
|
230
|
+
Reline::IOGate::RAW_KEYSTROKE_CONFIG.each_pair do |key, func|
|
|
231
|
+
config.add_default_key_binding(key, func)
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
begin
|
|
236
|
+
loop do
|
|
237
|
+
read_io(config.keyseq_timeout) { |inputs|
|
|
238
|
+
inputs.each { |c|
|
|
239
|
+
line_editor.input_key(c)
|
|
240
|
+
line_editor.rerender
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
break if line_editor.finished?
|
|
244
|
+
end
|
|
245
|
+
Reline::IOGate.move_cursor_column(0)
|
|
246
|
+
rescue StandardError => e
|
|
247
|
+
line_editor.finalize
|
|
248
|
+
Reline::IOGate.deprep(otio)
|
|
249
|
+
raise e
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
line_editor.finalize
|
|
253
|
+
Reline::IOGate.deprep(otio)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Keystrokes of GNU Readline will timeout it with the specification of
|
|
257
|
+
# "keyseq-timeout" when waiting for the 2nd character after the 1st one.
|
|
258
|
+
# If the 2nd character comes after 1st ESC without timeout it has a
|
|
259
|
+
# meta-property of meta-key to discriminate modified key with meta-key
|
|
260
|
+
# from multibyte characters that come with 8th bit on.
|
|
261
|
+
#
|
|
262
|
+
# GNU Readline will wait for the 2nd character with "keyseq-timeout"
|
|
263
|
+
# milli-seconds but wait forever after 3rd characters.
|
|
264
|
+
private def read_io(keyseq_timeout, &block)
|
|
265
|
+
buffer = []
|
|
266
|
+
loop do
|
|
267
|
+
c = Reline::IOGate.getc
|
|
268
|
+
buffer << c
|
|
269
|
+
result = key_stroke.match_status(buffer)
|
|
270
|
+
case result
|
|
271
|
+
when :matched
|
|
272
|
+
expanded = key_stroke.expand(buffer).map{ |expanded_c|
|
|
273
|
+
Reline::Key.new(expanded_c, expanded_c, false)
|
|
274
|
+
}
|
|
275
|
+
block.(expanded)
|
|
276
|
+
break
|
|
277
|
+
when :matching
|
|
278
|
+
if buffer.size == 1
|
|
279
|
+
begin
|
|
280
|
+
succ_c = nil
|
|
281
|
+
Timeout.timeout(keyseq_timeout / 1000.0) {
|
|
282
|
+
succ_c = Reline::IOGate.getc
|
|
283
|
+
}
|
|
284
|
+
rescue Timeout::Error # cancel matching only when first byte
|
|
285
|
+
block.([Reline::Key.new(c, c, false)])
|
|
286
|
+
break
|
|
287
|
+
else
|
|
288
|
+
if key_stroke.match_status(buffer.dup.push(succ_c)) == :unmatched
|
|
289
|
+
if c == "\e".ord
|
|
290
|
+
block.([Reline::Key.new(succ_c, succ_c | 0b10000000, true)])
|
|
291
|
+
else
|
|
292
|
+
block.([Reline::Key.new(c, c, false), Reline::Key.new(succ_c, succ_c, false)])
|
|
293
|
+
end
|
|
294
|
+
break
|
|
295
|
+
else
|
|
296
|
+
Reline::IOGate.ungetc(succ_c)
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
end
|
|
300
|
+
when :unmatched
|
|
301
|
+
if buffer.size == 1 and c == "\e".ord
|
|
302
|
+
read_escaped_key(keyseq_timeout, c, block)
|
|
303
|
+
else
|
|
304
|
+
expanded = buffer.map{ |expanded_c|
|
|
305
|
+
Reline::Key.new(expanded_c, expanded_c, false)
|
|
306
|
+
}
|
|
307
|
+
block.(expanded)
|
|
308
|
+
end
|
|
309
|
+
break
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
private def read_escaped_key(keyseq_timeout, c, block)
|
|
315
|
+
begin
|
|
316
|
+
escaped_c = nil
|
|
317
|
+
Timeout.timeout(keyseq_timeout / 1000.0) {
|
|
318
|
+
escaped_c = Reline::IOGate.getc
|
|
319
|
+
}
|
|
320
|
+
rescue Timeout::Error # independent ESC
|
|
321
|
+
block.([Reline::Key.new(c, c, false)])
|
|
322
|
+
else
|
|
323
|
+
if escaped_c.nil?
|
|
324
|
+
block.([Reline::Key.new(c, c, false)])
|
|
325
|
+
elsif escaped_c >= 128 # maybe, first byte of multi byte
|
|
326
|
+
block.([Reline::Key.new(c, c, false), Reline::Key.new(escaped_c, escaped_c, false)])
|
|
327
|
+
elsif escaped_c == "\e".ord # escape twice
|
|
328
|
+
block.([Reline::Key.new(c, c, false), Reline::Key.new(c, c, false)])
|
|
329
|
+
else
|
|
330
|
+
block.([Reline::Key.new(escaped_c, escaped_c | 0b10000000, true)])
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
private def may_req_ambiguous_char_width
|
|
336
|
+
@ambiguous_width = 2 if Reline::IOGate == Reline::GeneralIO or STDOUT.is_a?(File)
|
|
337
|
+
return if ambiguous_width
|
|
338
|
+
Reline::IOGate.move_cursor_column(0)
|
|
339
|
+
begin
|
|
340
|
+
output.write "\u{25bd}"
|
|
341
|
+
rescue Encoding::UndefinedConversionError
|
|
342
|
+
# LANG=C
|
|
343
|
+
@ambiguous_width = 1
|
|
344
|
+
else
|
|
345
|
+
@ambiguous_width = Reline::IOGate.cursor_pos.x
|
|
346
|
+
end
|
|
347
|
+
Reline::IOGate.move_cursor_column(0)
|
|
348
|
+
Reline::IOGate.erase_after_cursor
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
extend Forwardable
|
|
353
|
+
extend SingleForwardable
|
|
354
|
+
|
|
355
|
+
#--------------------------------------------------------
|
|
356
|
+
# Documented API
|
|
357
|
+
#--------------------------------------------------------
|
|
358
|
+
|
|
359
|
+
(Core::ATTR_READER_NAMES).each { |name|
|
|
360
|
+
def_single_delegators :core, "#{name}", "#{name}="
|
|
361
|
+
}
|
|
362
|
+
def_single_delegators :core, :input=, :output=
|
|
363
|
+
def_single_delegators :core, :vi_editing_mode, :emacs_editing_mode
|
|
364
|
+
def_single_delegators :core, :readline
|
|
365
|
+
def_single_delegators :core, :completion_case_fold, :completion_case_fold=
|
|
366
|
+
def_single_delegators :core, :completion_quote_character
|
|
367
|
+
def_instance_delegators self, :readline
|
|
368
|
+
private :readline
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
#--------------------------------------------------------
|
|
372
|
+
# Undocumented API
|
|
373
|
+
#--------------------------------------------------------
|
|
374
|
+
|
|
375
|
+
# Testable in original
|
|
376
|
+
def_single_delegators :core, :get_screen_size
|
|
377
|
+
def_single_delegators :line_editor, :eof?
|
|
378
|
+
def_instance_delegators self, :eof?
|
|
379
|
+
def_single_delegators :line_editor, :delete_text
|
|
380
|
+
def_single_delegator :line_editor, :line, :line_buffer
|
|
381
|
+
def_single_delegator :line_editor, :byte_pointer, :point
|
|
382
|
+
def_single_delegator :line_editor, :byte_pointer=, :point=
|
|
383
|
+
|
|
384
|
+
def self.insert_text(*args, &block)
|
|
385
|
+
line_editor.insert_text(*args, &block)
|
|
386
|
+
self
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
# Untestable in original
|
|
390
|
+
def_single_delegator :line_editor, :rerender, :redisplay
|
|
391
|
+
def_single_delegators :core, :vi_editing_mode?, :emacs_editing_mode?
|
|
392
|
+
def_single_delegators :core, :ambiguous_width
|
|
393
|
+
def_single_delegators :core, :last_incremental_search
|
|
394
|
+
def_single_delegators :core, :last_incremental_search=
|
|
395
|
+
|
|
396
|
+
def_single_delegators :core, :readmultiline
|
|
397
|
+
def_instance_delegators self, :readmultiline
|
|
398
|
+
private :readmultiline
|
|
399
|
+
|
|
400
|
+
def self.encoding_system_needs
|
|
401
|
+
self.core.encoding
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def self.core
|
|
405
|
+
@core ||= Core.new { |core|
|
|
406
|
+
core.config = Reline::Config.new
|
|
407
|
+
core.key_stroke = Reline::KeyStroke.new(core.config)
|
|
408
|
+
core.line_editor = Reline::LineEditor.new(core.config, Reline::IOGate.encoding)
|
|
409
|
+
|
|
410
|
+
core.basic_word_break_characters = " \t\n`><=;|&{("
|
|
411
|
+
core.completer_word_break_characters = " \t\n`><=;|&{("
|
|
412
|
+
core.basic_quote_characters = '"\''
|
|
413
|
+
core.completer_quote_characters = '"\''
|
|
414
|
+
core.filename_quote_characters = ""
|
|
415
|
+
core.special_prefixes = ""
|
|
416
|
+
}
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
def self.line_editor
|
|
420
|
+
core.line_editor
|
|
421
|
+
end
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
|
425
|
+
require 'reline/windows'
|
|
426
|
+
if Reline::Windows.msys_tty?
|
|
427
|
+
require 'reline/ansi'
|
|
428
|
+
Reline::IOGate = Reline::ANSI
|
|
429
|
+
else
|
|
430
|
+
Reline::IOGate = Reline::Windows
|
|
431
|
+
end
|
|
432
|
+
else
|
|
433
|
+
require 'reline/ansi'
|
|
434
|
+
Reline::IOGate = Reline::ANSI
|
|
435
|
+
end
|
|
436
|
+
Reline::HISTORY = Reline::History.new(Reline.core.config)
|
|
437
|
+
require 'reline/general_io'
|