Warnings when using RedCloth and Rake

Hi all,

first of all thanks a lot for Rake and RedCloth, Jim and _why.
They are really a great help in my corrent work and a great pleasure to work with. :slight_smile:

However, I'm currently trying to figure out the answer to some questions:

- Why do I get the warnings mentioned below when using
聽聽聽Rake to build html files from RedCloth sources?
- Why do I get these warning in a non-Rake Ruby program
聽聽聽only when run with '-w' (display warnings)
- Where in Rake is '-w' set? Or, if it isn't set in Rake: Where
聽聽聽is it set?

I'm using Rake (version 0.4.0) (among other tasks) to 'compile' some RedCloth (version 2.0.11) sources to html files.

Now, I'm a bit worried about the warnings from RedCloth - looking like this:

c:/ruby/lib/ruby/site_ruby/1.8/RedCloth.rb:719: warning: instance variable @filter_html not initialized
c:/ruby/lib/ruby/site_ruby/1.8/RedCloth.rb:490: warning: instance variable @fold_lines not initialized
c:/ruby/lib/ruby/site_ruby/1.8/RedCloth.rb:375: warning: instance variable @filter_styles not initialized

I don't set any of the 'restrictions' mentioned in RedCloth's RDoc, and I don't run ruby (or rake for that matter) with '-w' (although I known I probably should).

Is there a way of setting RedCloth's restrictions to false explicitly somehow? They are set (to true) by passing appropriately named symbols to RedCloth.new. So, if no restrictions are passed these instance variables just won't come into exsitence.

Actually, I think that the warnings are a bit misleading here, as the instance variables are set if they should be - and otherwise they just don't exist (which is close enough to false or nil in this situation I think).

Wading through all these 'false alarms' is a bit tedious, when looking for the _real_ error messages.

Any help is greatly appreciated.

Happy rubying

Stephan

Stephan K盲mper said:

- Where in Rake is '-w' set? Or, if it isn't set in Rake: Where
   is it set?

It is set in the first line of the the main script invoked by the Rake
command.

路路路

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Jim Weirich wrote:

Stephan K盲mper said:

- Where in Rake is '-w' set? Or, if it isn't set in Rake: Where
  is it set?

It is set in the first line of the the main script invoked by the Rake
command.

Wow.
So, I could scan the library file of the same name for a long long time. :slight_smile:

Learn something new everyday: That would mean the WinXP command line interpreter handles the #! line. I should have noticed the "C:/..." part... <blush/> :wink:

Happy rubying

Stephan

"Stephan K盲mper" <Stephan.Kaemper@Schleswig-Holstein.de>

Learn something new everyday: That would mean the WinXP command line
interpreter handles the #! line. I should have noticed the "C:/..."
part... <blush/> :wink:

Which command line interpreter are you referring to ? Surely not cmd.exe ?
-- shanko

Shashank Date wrote:

"Stephan K盲mper" <Stephan.Kaemper@Schleswig-Holstein.de>

Learn something new everyday: That would mean the WinXP command line
interpreter handles the #! line. I should have noticed the "C:/..."
part... <blush/> :wink:

Which command line interpreter are you referring to ? Surely not cmd.exe ?
-- shanko

Well... I actually do. :slight_smile:

Running ruby/bin/rake with the '-w' included in the #! line produced a lot of warnings. After I removed the '-w' part from ruby/bin/rake.rb,
the HTML files were built without a warning.
So - that's the experimental evidence.

I neither knew nor noticed this before yesterday.

Now, with the assoc and ftype commands (in cooperation with the PATH and PATHEXT environment variables) I knew you could bind a certain file suffix to a file type (assoc) and associate a certain file type to a given executable (ftype). But the #! functionality (or is it a cmd.exe bug? :wink: ) was completely new to me.

Sorry for getting a bit off-topic.

Happy rubying

Stephan

"Stephan K盲mper" <Stephan.Kaemper@Schleswig-Holstein.de> wrote in message

> Which command line interpreter are you referring to ? Surely not cmd.exe

?

> -- shanko

Well... I actually do. :slight_smile:

<snip>

But the #! functionality (or is it a cmd.exe
bug? :wink: ) was completely new to me.

And so it is to me too :-0
It must be in combination with some thing, because when I do:

路路路

-----------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>type j.cmd
#!c:\ruby\bin\ruby
puts "Hello"

C:\>j.cmd

C:\>#!c:\ruby\bin\ruby
The filename, directory name, or volume label syntax is incorrect.

C:\>puts "Hello"
'puts' is not recognized as an internal or external command,
operable program or batch file.
------------------------------------------------

It doesn't seem to work ... or have I mis-read your statements?
-- shanko

Hi,

At Wed, 23 Jun 2004 19:58:12 +0900,
Stephan K盲mper wrote in [ruby-talk:104409]:

Now, with the assoc and ftype commands (in cooperation with the PATH and
PATHEXT environment variables) I knew you could bind a certain file
suffix to a file type (assoc) and associate a certain file type to a
given executable (ftype). But the #! functionality (or is it a cmd.exe
bug? :wink: ) was completely new to me.

Current ruby implementation takes options from the first line
if it starts withs /^#!\S+ruby/. It's a just feature inherited
from perl.

路路路

--
Nobu Nakada

Hi Shashank,

Hmmm, I'm getting more and more puzzled by this...

Shashank Date wrote:
> <snip>
>
>>But the #! functionality (or is it a cmd.exe
>>bug? :wink: ) was completely new to me.
>
> And so it is to me too :-0
> It must be in combination with some thing, because when I do:

8< snip --------

>
> It doesn't seem to work ... or have I mis-read your statements?
> -- shanko
>

Yes, you're right. Apparently it's not *only* the #! line...
Rename j.cmd to j.rb and your example should work again.

Using an unknown file suffix, say 'foobar' leads to a Windows dialog that complains about an unknown file type.

Another 'experiment': I changed the #! line so as to point to my editor and saved it with the Ruby suffix (.rb). And as I (at least to a certain extent) expected the editor was opened.

So my conclusions are:

- My guess that cmd.exe can handle the #! line obviously is wrong.
- The assoc/ftype settings do in fact determine which executable
聽聽聽is used to run/open the given file.
- Notwithstanding there's experimental evidence that changing
聽聽聽the #! line does change the behaviour.
聽聽聽As long as it's a Ruby file...

Hey wait! Just a moment... Did I read somewhere that Ruby itself interprets a #! line? (Hey, we just managed to get on-topic again...)

I faintly remember that Ruby could run Perl scripts if only they have a appropriate #! line. Is there anybody out there how could confirm this?

Happy rubying

Stephan

Hey wait! Just a moment... Did I read somewhere that Ruby itself
interprets a #! line? (Hey, we just managed to get on-topic again...)

You did.

I faintly remember that Ruby could run Perl scripts if only they have a
appropriate #! line. Is there anybody out there how could confirm this?

$ cat x.pl
#!/usr/bin/env ruby

puts RUBY_VERSION
$ ./x.pl
1.8.1

路路路

Stephan K?mper (Stephan.Kaemper@Schleswig-Holstein.de) wrote:

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04