- Patch so that irb saves its history (bug 518584, ruby issue 1556)
This commit is contained in:
parent
35188975c5
commit
94f00da846
111
ruby-1.8head-irb-save-history.patch
Normal file
111
ruby-1.8head-irb-save-history.patch
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
Thu Jul 23 15:04:20 2009 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||||
|
|
||||||
|
ruby* lib/irb.rb, lib/irb/init.rb, lib/irb/ext/save-history.rb: add
|
||||||
|
ruby IRB::irb_at_exit. no use finalizer saving history. [ruby-dev-38563]
|
||||||
|
|
||||||
|
Index: lib/irb/ext/save-history.rb
|
||||||
|
===================================================================
|
||||||
|
--- lib/irb/ext/save-history.rb (revision 24225)
|
||||||
|
+++ lib/irb/ext/save-history.rb (revision 24254)
|
||||||
|
@@ -50,23 +50,24 @@
|
||||||
|
module HistorySavingAbility
|
||||||
|
include Readline
|
||||||
|
|
||||||
|
- def HistorySavingAbility.create_finalizer
|
||||||
|
- proc do
|
||||||
|
- if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
|
||||||
|
- if hf = IRB.conf[:HISTORY_FILE]
|
||||||
|
- file = File.expand_path(hf)
|
||||||
|
- end
|
||||||
|
- file = IRB.rc_file("_history") unless file
|
||||||
|
- open(file, 'w' ) do |f|
|
||||||
|
- hist = HISTORY.to_a
|
||||||
|
- f.puts(hist[-num..-1] || hist)
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
+# def HistorySavingAbility.create_finalizer
|
||||||
|
+# proc do
|
||||||
|
+# if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
|
||||||
|
+# if hf = IRB.conf[:HISTORY_FILE]
|
||||||
|
+# file = File.expand_path(hf)
|
||||||
|
+# end
|
||||||
|
+# file = IRB.rc_file("_history") unless file
|
||||||
|
+# open(file, 'w' ) do |f|
|
||||||
|
+# hist = HISTORY.to_a
|
||||||
|
+# f.puts(hist[-num..-1] || hist)
|
||||||
|
+# end
|
||||||
|
+# end
|
||||||
|
+# end
|
||||||
|
+# end
|
||||||
|
|
||||||
|
def HistorySavingAbility.extended(obj)
|
||||||
|
- ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
|
||||||
|
+# ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
|
||||||
|
+ IRB.conf[:AT_EXIT].push proc{obj.save_history}
|
||||||
|
obj.load_history
|
||||||
|
obj
|
||||||
|
end
|
||||||
|
@@ -80,6 +81,19 @@
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
+
|
||||||
|
+ def save_history
|
||||||
|
+ if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
|
||||||
|
+ if history_file = IRB.conf[:HISTORY_FILE]
|
||||||
|
+ history_file = File.expand_path(history_file)
|
||||||
|
+ end
|
||||||
|
+ history_file = IRB.rc_file("_history") unless history_file
|
||||||
|
+ open(history_file, 'w' ) do |f|
|
||||||
|
+ hist = HISTORY.to_a
|
||||||
|
+ f.puts(hist[-num..-1] || hist)
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
+ end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Index: lib/irb/init.rb
|
||||||
|
===================================================================
|
||||||
|
--- lib/irb/init.rb (revision 24225)
|
||||||
|
+++ lib/irb/init.rb (revision 24254)
|
||||||
|
@@ -114,6 +114,8 @@
|
||||||
|
# @CONF[:LC_MESSAGES] = "en"
|
||||||
|
@CONF[:LC_MESSAGES] = Locale.new
|
||||||
|
|
||||||
|
+ @CONF[:AT_EXIT] = []
|
||||||
|
+
|
||||||
|
@CONF[:DEBUG_LEVEL] = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
Index: lib/irb.rb
|
||||||
|
===================================================================
|
||||||
|
--- lib/irb.rb (revision 24225)
|
||||||
|
+++ lib/irb.rb (revision 24254)
|
||||||
|
@@ -65,13 +65,21 @@
|
||||||
|
trap("SIGINT") do
|
||||||
|
irb.signal_handle
|
||||||
|
end
|
||||||
|
-
|
||||||
|
- catch(:IRB_EXIT) do
|
||||||
|
- irb.eval_input
|
||||||
|
+
|
||||||
|
+ begin
|
||||||
|
+ catch(:IRB_EXIT) do
|
||||||
|
+ irb.eval_input
|
||||||
|
+ end
|
||||||
|
+ ensure
|
||||||
|
+ irb_at_exit
|
||||||
|
end
|
||||||
|
# print "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
+ def IRB.irb_at_exit
|
||||||
|
+ @CONF[:AT_EXIT].each{|hook| hook.call}
|
||||||
|
+ end
|
||||||
|
+
|
||||||
|
def IRB.irb_exit(irb, ret)
|
||||||
|
throw :IRB_EXIT, ret
|
||||||
|
end
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
Name: ruby
|
Name: ruby
|
||||||
Version: %{rubyver}%{?dotpatchlevel}
|
Version: %{rubyver}%{?dotpatchlevel}
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: Ruby or GPLv2
|
License: Ruby or GPLv2
|
||||||
URL: http://www.ruby-lang.org/
|
URL: http://www.ruby-lang.org/
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
@ -51,6 +51,8 @@ Patch28: ruby-1.8.6-p287-remove-ssl-rand-range.patch
|
|||||||
Patch29: ruby-always-use-i386.patch
|
Patch29: ruby-always-use-i386.patch
|
||||||
Patch30: ruby-openssl-1.0.patch
|
Patch30: ruby-openssl-1.0.patch
|
||||||
Patch31: ruby-1.8.6-p369-ri-gem_multipath.patch
|
Patch31: ruby-1.8.6-p369-ri-gem_multipath.patch
|
||||||
|
# Patch from ruby_1_8 branch
|
||||||
|
Patch32: ruby-1.8head-irb-save-history.patch
|
||||||
|
|
||||||
Summary: An interpreter of object-oriented scripting language
|
Summary: An interpreter of object-oriented scripting language
|
||||||
Group: Development/Languages
|
Group: Development/Languages
|
||||||
@ -182,6 +184,7 @@ pushd %{name}-%{arcver}
|
|||||||
%patch29 -p1
|
%patch29 -p1
|
||||||
%patch30 -p2
|
%patch30 -p2
|
||||||
%patch31 -p1
|
%patch31 -p1
|
||||||
|
%patch32 -p0
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -548,6 +551,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_emacs_sitestartdir}/ruby-mode-init.el
|
%{_emacs_sitestartdir}/ruby-mode-init.el
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Oct 25 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.8.6.383-3
|
||||||
|
- Patch so that irb saves its history (bug 518584, ruby issue 1556)
|
||||||
|
|
||||||
* Sat Oct 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.8.6.383-2
|
* Sat Oct 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1.8.6.383-2
|
||||||
- Update to 1.8.6 patchlevel 383 (bug 520063)
|
- Update to 1.8.6 patchlevel 383 (bug 520063)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user