[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

End of line style

Alexey Verkhovsky

1/16/2005 11:24:00 AM

Sorry for asking a somewhat silly question, but...

If I am working with some Ruby application that has to work from the
same ZIP file on Windows, Linux and OSX, and has to have shebang
comments working out of box on the atter two, what is the right
end-of-line style for such a scenario?

As far as I understand, Ruby itself would handle anything.
As for shebangs, sh on Linux would handle only "\n" and on OSX it would
handle anything (?) and on Windows there is no such concern.

It follows that end-of-line style must be Linux' "\n".

Is that correct?

--
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby... (moderator)
RForum: http://rforum.and... (co-author)
Instiki: http://i... (maintainer)



7 Answers

Florian Gross

1/16/2005 11:32:00 AM

0

Alexey Verkhovsky wrote:

> If I am working with some Ruby application that has to work from the
> same ZIP file on Windows, Linux and OSX, and has to have shebang
> comments working out of box on the atter two, what is the right
> end-of-line style for such a scenario?

AFAIK on Windows the shebang is ignored completely unless you are
running in an CGI environment.

Ruby itself does however extract the options from the shebang, I think
it does not care about \n vs. \r\n.

Also in the next version of Ruby trailing carriage returns on ARGV will
AFAIK be ignored.

I think right now it is probably safest to use \n. I'd also convert
newlines to \r\n for the Windows release, though.

Alexey Verkhovsky

1/16/2005 1:41:00 PM

0

Florian Gross wrote:

> I think right now it is probably safest to use \n. I'd also convert
> newlines to \r\n for the Windows release, though.

That would mean a separate release for Windows, which is precisely the
thing that I want to avoid.

A file with \n end-of-lines won't look good in notepad. I don't care
about this. Do you know any other particular reason for having \r\n
end-of-lines for Windows (as in "foo will not work otherwise"), or is it
purely "just because it's Windows-style"?

--
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby... (moderator)
RForum: http://rforum.and... (co-author)
Instiki: http://i... (maintainer)




Florian Gross

1/16/2005 2:02:00 PM

0

Alexey Verkhovsky wrote:

>> I think right now it is probably safest to use \n. I'd also convert
>> newlines to \r\n for the Windows release, though.
> That would mean a separate release for Windows, which is precisely the
> thing that I want to avoid.
>
> A file with \n end-of-lines won't look good in notepad. I don't care
> about this. Do you know any other particular reason for having \r\n
> end-of-lines for Windows (as in "foo will not work otherwise"), or is it
> purely "just because it's Windows-style"?

It's because it makes it easier for Windows developers to submit patches
back to you. Just a small point, but if you're going to automate the
whole release process anyway it ought not to be that much trouble to
have newlines of non-binary files converted to \r\n in the Windows
package. (Most software uses .zip archives instead of .tgz for Windows,
anyway.)

Alexey Verkhovsky

1/16/2005 2:21:00 PM

0

Florian Gross wrote:

> Alexey Verkhovsky wrote:
>
>>> I think right now it is probably safest to use \n. I'd also convert
>>> newlines to \r\n for the Windows release, though.
>>
>> That would mean a separate release for Windows, which is precisely
>> the thing that I want to avoid.
>>
>> A file with \n end-of-lines won't look good in notepad. I don't care
>> about this. Do you know any other particular reason for having \r\n
>> end-of-lines for Windows (as in "foo will not work otherwise"), or is
>> it purely "just because it's Windows-style"?
>
>
> It's because it makes it easier for Windows developers to submit
> patches back to you. Just a small point, but if you're going to
> automate the whole release process anyway it ought not to be that much
> trouble to have newlines of non-binary files converted to \r\n in the
> Windows package. (Most software uses .zip archives instead of .tgz for
> Windows, anyway.)

I don't know about that - never had any problem submitting patches from
Windows myself. I build them in one of two ways. Either from Cygwin, or
from Eclipse. Both deal with EOL styles transparently. Have you seen
problems of this sort?

Another question: actually, this application (Instiki) is packaged by
Rake::PackageTask. Perhaps Rake itself should be a bit smarter about this.

--
Best regards,

Alexey Verkhovsky

Ruby Forum: http://ruby... (moderator)
RForum: http://rforum.and... (co-author)
Instiki: http://i... (maintainer)



Sam Roberts

1/16/2005 2:24:00 PM

0

Quoteing alex@verk.info, on Sun, Jan 16, 2005 at 08:23:44PM +0900:
> Sorry for asking a somewhat silly question, but...
>
> If I am working with some Ruby application that has to work from the
> same ZIP file on Windows, Linux and OSX, and has to have shebang
> comments working out of box on the atter two, what is the right
> end-of-line style for such a scenario?
>
> As far as I understand, Ruby itself would handle anything.
> As for shebangs, sh on Linux would handle only "\n" and on OSX it would
> handle anything (?) and on Windows there is no such concern.

OS X is as unix is, the end of line char is NL, chars before are
considered part of the #! command.

Sam



Florian Gross

1/16/2005 2:43:00 PM

0

Alexey Verkhovsky wrote:

> I don't know about that - never had any problem submitting patches from
> Windows myself. I build them in one of two ways. Either from Cygwin, or
> from Eclipse. Both deal with EOL styles transparently. Have you seen
> problems of this sort?

Might depend on editors. Some convert newlines to native format on
saving. (And some don't even understand unix newlines at all meaning you
would have to convert manually.) That would confuse diff quite badly.
(There's the --strip-trailing-cr option, but at least I have to look it
up every time I use it...)

FACE

6/8/2008 4:41:00 PM

0

From "Freddie B" <paradoxer@wolfmail.com>, in uk.politics.misc on Sun, 8
Jun 2008 11:03:54 -0400 :

>
>"FACE" <AFaceInTheCrowd@today.net> wrote in message
>news:7obl4457kftr83tjtrffaf300afqrlsmem@4ax.com...
>> From "Freddie B" <paradoxer@wolfmail.com>, in uk.politics.misc on Sat, 7
>> Jun 2008 11:34:49 -0400 :
>>
>>>
>>>"FACE" <AFaceInTheCrowd@bellsouth.net> wrote in message
>>>news:1k7l449evd1mb8t46i5mt3br445oeo1781@4ax.com...
>>>>
>>>> Has anyone noticed that after, some say 7, faintings at Obama rallies
>>>> and
>>>> various media got on it as a possible PR act, it has not happened again?
>>>>
>>>> "Brother Love's traveling salvation show..........."
>>>>
>>>> FACE
>>>
>>>Maybe some are paid stooges? In any case, not as bad as the media hack
>>>plants BushCo paid to ask flattering questions, promote the war, etc. Have
>>>a
>>>sense of perspective.
>>>
>>
>> For a reasonable perspective, please provide cites of these transgressions
>> by "BushCO". No doubt the sources you provide will be non-partisan and
>> reputable..........
>>
>> FACE
>>
>
>How about almost everyone who used to work for BushCo and then wrote a book
>about it? (Richard Clarke, Scott McClellan, etc.) Really, there's so much
>out there you can step in it everywhere you walk ... If you just blow off
>all the news you don't like, how can you be convinced?
>BTW, what sources would *you* consider "non-partisan and reputable"?
>

In other words, you don;t actually have sources. No surprise.........

Reputable is AP, Reuters, UPI, AFP, BBC, NY Times, Washington Post, if you
can sense the credibility level there...................