Replacement for using rdoc

According to this post , RDoc :: usage is currently not available in ruby ​​1.9. Are there any good replacements?

I would be interested to know what is available from the standard installation, as well as what is available from gemstones.

+4
source share
3 answers

I like OptionParser (the article mentions that RDoc::usage is useful to complement).

It seems that all 1.9 errors have been fixed .

+4
source

In requesting function 2713 , the developer of rdoc stated that he would not add rdoc / usage or any similar function back to rdoc, saying that OptionParser should be used instead.

+2
source

We use OptionParser for all new scripts, but had about 100+ that used RDoc. Instead of rewriting each of them, I wrote this method (BB is our company’s namespace, change it to whatever you like). It works great. The syntax is a little different, but its text helps, so we don't mind. Hope this helps!

Then I used sed to find all the scripts and modify them.

 grep -rl "RDoc::usage" * | xargs sed -i "/rdoc\/usage/ s/RDoc/BB/" grep -rl "BB::usage" * | xargs sed -i "/rdoc\/usage/ s/rdoc/lib\/bb/" 

-

 module BB def BB::usage( exit_code ) File::open( $0, 'r').readlines.each_with_index do | line, idx | next if idx == 0 if( line =~ /^#/ ) puts line.gsub(/^#\ ?/,'') else puts #RDoc adds extra line so we do too exit( exit_code ) end end end end 
+1
source

All Articles