Skip to content

Commit

Permalink
Don't depend on RDoc::Usage any more
Browse files Browse the repository at this point in the history
This was removed from Ruby 1.9 with no replacement. Since all it
does is print out a nice usage message, and since this is being
used internally by Textmate, AND since this code has not been touched
in 5 years, I think it's perfectly valid to simple hard-wire the
"usage" output and remove the dependency, so that you can reflow
comments when using Ruby 1.9.
  • Loading branch information
norman authored and infininight committed Aug 13, 2011
1 parent 421ef13 commit 286c8cf
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions Support/bin/rubywrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,23 @@
# With appropriate use of -r and -p RubyWrap should work for any language that
# distinguishes comments by some prefix. Languages that use "# " should work
# well out of the box.
#
# == Usage
#
# rubywrap.rb [<options>]
# Options:
# --prefix, -p <prefix> Use <prefix> as the comment prefix.
# --shortthreshold -s <n> Lines of length <= n are single line blocks.
# --cols, -c <n> How many columns to wrap to (default: 78)
# --tabsize, -t <n> How many spaces a tab is (default: 2)
# --no-rdoc-style, -n Do not use RDoc conventions.
# --retabify, -r Retabify output.
# --help, -h Display this help.
# --doc, -d Display full documentation.
# Reads commented code from stdin and outputs wrapped commented code to
# stdout.
#

require 'rdoc/usage'
$usage = <<-EOS
rubywrap.rb [<options>]
Options:
--prefix, -p <prefix> Use <prefix> as the comment prefix.
--shortthreshold -s <n> Lines of length <= n are single line blocks.
--cols, -c <n> How many columns to wrap to (default: 78)
--tabsize, -t <n> How many spaces a tab is (default: 2)
--no-rdoc-style, -n Do not use RDoc conventions.
--retabify, -r Retabify output.
--help, -h Display this help.
--doc, -d Display full documentation.
Reads commented code from stdin and outputs wrapped commented code to
stdout.
EOS

require 'getoptlong'

opts = GetoptLong.new(
Expand Down Expand Up @@ -172,13 +171,13 @@
when "--retabify"
$retabify = true
when "--help"
RDoc::usage("Usage")
print $usage; exit
when "--doc"
RDoc::usage
print $usage; exit
end
end
if ARGV.length != 0
RDoc::usage
print $usage; exit
end

# Add detabify, entabify to String class.
Expand Down

0 comments on commit 286c8cf

Please sign in to comment.