Warnings when using RedCloth and Rake

S

Stephan Kämper

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. :)

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
 
J

Jim Weirich

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.
 
S

Stephan Kämper

Jim said:
Stephan Kämper said:


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. :)

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

Happy rubying

Stephan
 
S

Shashank Date

Stephan Kämper said:
Learn something new everyday: That would mean the WinXP command line
interpreter handles the #! line. I should have noticed the "C:/..."
part... <blush/> ;-)

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

Stephan Kämper

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

Well... I actually do. :)

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? ;-) ) was completely new to me.

Sorry for getting a bit off-topic.

Happy rubying

Stephan
 
S

Shashank Date

Stephan Kämper said:
Well... I actually do. :)
But the #! functionality (or is it a cmd.exe
bug? ;-) ) 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.
 
N

nobu.nokada

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? ;-) ) 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.
 
S

Stephan Kämper

Hi Shashank,

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

Shashank said:
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
 
E

Eric Hodel

--mhOzvPhkurUs4vA9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hey wait! Just a moment... Did I read somewhere that Ruby itself=20
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= =20
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

--=20
Eric Hodel - (e-mail address removed) - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04


--mhOzvPhkurUs4vA9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFA2Z7/MypVHHlsnwQRAk2vAKCYMU0CNwMES23nvh8rZubcon26rACfYttH
B4lYOAeOPoz9Z3t0cYKBjCc=
=qRCy
-----END PGP SIGNATURE-----

--mhOzvPhkurUs4vA9--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top