Merge Ruby 1.9 fixes from evaryont/master

This commit is contained in:
Ryan Tomayko 2010-04-02 16:02:22 -07:00
commit 889fcb286b

View File

@ -14,7 +14,7 @@ require 'fileutils'
# Write usage message to stdout and exit. # Write usage message to stdout and exit.
def usage(stream=$stderr, status=1) def usage(stream=$stderr, status=1)
stream.puts File.read(__FILE__). stream.puts File.readlines(__FILE__).
grep(/^#\//). grep(/^#\//).
map { |line| line.sub(/^#. ?/, '') }. map { |line| line.sub(/^#. ?/, '') }.
join join
@ -35,8 +35,8 @@ options = {}
ARGV.options { |o| ARGV.options { |o|
o.program_name = File.basename($0) o.program_name = File.basename($0)
o.on("-o", "--output=DIR") { |dir| output_dir = dir } o.on("-o", "--output=DIR") { |dir| output_dir = dir }
o.on("-l", "--language=LANG") { |lang| options[:language] = lang } o.on("-l", "--language=LANG") { |lang| options[:language] = lang }
o.on("-c", "--comment-chars=CHARS") { |chars| options[:comment_chars] = Regexp.escape(chars) } o.on("-c", "--comment-chars=CHARS") { |chars| options[:comment_chars] = Regexp.escape(chars) }
o.on_tail("-h", "--help") { usage($stdout, 0) } o.on_tail("-h", "--help") { usage($stdout, 0) }
o.parse! o.parse!
} or abort_with_note } or abort_with_note