summaryrefslogtreecommitdiff
path: root/tool/redmine-backporter.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-20 04:09:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-20 04:09:24 +0000
commitaa6b7b0701a683c7457bdd9ff3e5732be19a8f59 (patch)
treec52a57d50360bb6610a43f929eff915bee040a86 /tool/redmine-backporter.rb
parent87bb3275aaefdda20a7b558c9e9d53c6d4694bbe (diff)
redmine-backporter.rb: try Readline
* tool/redmine-backporter.rb (readline): try Readline.readline if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/redmine-backporter.rb')
-rwxr-xr-xtool/redmine-backporter.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index 46346b3..5ebc4df 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -8,6 +8,12 @@ require 'stringio'
require 'strscan'
require 'optparse'
require 'pp'
+begin
+ require 'readline'
+rescue LoadError
+else
+ include Readline
+end
VERSION = '0.0.1'
@@ -195,7 +201,7 @@ def more(sio)
end
end
-def readline(prompt = '')
+def Readline.readline(prompt = '')
console = IO.console
console.binmode
ly, lx = console.winsize
@@ -226,7 +232,7 @@ def readline(prompt = '')
line << c
end
end
-end
+end unless defined?(Readline.readline)
def mergeinfo
`svn propget svn:mergeinfo #{RUBY_REPO_PATH}`
@@ -266,7 +272,7 @@ puts "Backporter #{VERSION}".color(bold: true) + " for #{TARGET_VERSION}"
@changesets = nil
while true
begin
- l = readline '> '
+ l = Readline.readline '> '
rescue Interrupt
break
end