From: Alexey Verkhovsky Date: 2005-08-19T16:30:02+09:00 Subject: Re: RedCloth .... PILES of warnings when I require it ... Gavin Kistner wrote: > On Aug 18, 2005, at 11:29 PM, Jeff Wood wrote: > >> Reading your mail further, I tried the same using require_gem >> 'RedCloth' and don't get all of those messages, why should that make >> a difference? > > > I'm guessing that you have redcloth installed both as a gem and as a > library, and that it is being required from both locations, and the > second require is redefining the constants. Guessing. Heavily. > Aha! I know, I know! Case-insensitive Windows file system strikes again, and this time it bites RubyGems in the stern. Amusing :) try require'redcloth' instead (note the lower case!), and see for yourself. This is a RubyGems bug. To reproduce: 1. Take fresh Ruby install (must be on Windows) 2. Install RubyGems 3. Install RedCloth by gem install redcloth 4. Modify \ruby\lib\ruby\gems\1.8\gems\RedCloth3.0.3\redcloth.rb by adding puts 'HERE' in the beginning. 5. ruby -w -e "require 'RedCloth'" C:\>ruby -w -e "require 'RedCloth'" HERE HERE c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/redcloth.rb:612: warning: ambiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/redcloth.rb:832: warning: ambiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/redcloth.rb:1037: warning: amiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/redcloth.rb:815: warning: method redefined; discarding old inline_markdown_link c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:612: warning: ambiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:832: warning: ambiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:1037: warning: amiguous first argument; put parentheses or even spaces c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:169: warning: already initialized constant VERSION c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:170: warning: already initialized constant DEFAULT_RULES c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:242: warning: metod redefined; discarding old initialize c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:254: warning: metod redefined; discarding old to_html c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:311: warning: already initialized constant TEXTILE_TAGS c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:324: warning: already initialized constant A_HLGN c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:325: warning: already initialized constant A_VLGN c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:326: warning: already initialized constant C_CLAS c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:327: warning: already initialized constant C_LNGE c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:328: warning: already initialized constant C_STYL c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:329: warning: already initialized constant S_CSPN c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:330: warning: already initialized constant S_RSPN c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:331: warning: already initialized constant A c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:332: warning: already initialized constant S c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:333: warning: already initialized constant C c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:335: warning: already initialized constant PUNCT c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:336: warning: already initialized constant HYPERLINK c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:342: warning: already initialized constant SIMPLE_HTML_TAGS c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:364: warning: already initialized constant GLYPHS c:/ruby/lib/ruby/gems/1.8/gems/RedCloth-3.0.3/lib/RedCloth.rb:371: warning: alre this causes redcloth.rb to be loaded twice - first from ruby/lib/ Alex