[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

http://www.rubyonrails.org/show/GettingStartedWithRails

Bil Kleb

10/4/2004 7:21:00 PM

FWIW, I found the following a little awkward, given that these
are instructions for a Ruby application:

Note to Linux users: You can modify the necessary files with GNU sed
from the rails/ directory with the following command:

$ sed -i '/^#!/{s,local/,,}' public/dispatch.{cgi,fcgi,rb}

I.e., why isn't this a ruby command instead of sed?

Regards,
--
Bil Kleb, Hampton, Virginia


5 Answers

David Heinemeier Hansson

10/4/2004 7:53:00 PM

0

> I.e., why isn't this a ruby command instead of sed?

That's the wonderful power of the wikis. You perceive this as a bug and
with the Edit link at the bottom of the page, you have the power to
change it! So I expect to see a new revision of that page edited by Bil
Kleb shortly ;)

P.S.: Thanks for the good talks in Virginia. Let's work something out
that can get your team out of the Cold Fusion dark and into the Ruby on
Rails light ;)
--
David Heinemeier Hansson,
http://www.rubyon... -- Web-application framework for Ruby
http://www.in... -- A No-Step-Three Wiki in Ruby
http://www.basec... -- Web-based Project Management
http://www.loudthi... -- Broadcasting Brain
http://www.next... -- Development & Consulting Services



Bil Kleb

10/5/2004 10:13:00 PM

0

David Heinemeier Hansson wrote:
>Bil wrote:
>> I.e., why isn't this a ruby command instead of sed?
>>
>> $ sed -i '/^#!/{s,local/,,}' public/dispatch.{cgi,fcgi,rb}
>
> That's the wonderful power of the wikis. You perceive this as a bug and
> with the Edit link at the bottom of the page, you have the power to
> change it! So I expect to see a new revision of that page edited by Bil
> Kleb shortly ;)

I would, but let the truth be known: My command-line ruby is so poor that
my sed equivalent is too Perl:

ruby -pi -e \$_.sub\!\(/^\(#\!.*\)local\\\//,\'\\\1\'\) public/dispatch.{rb,cgi,fcgi}

due to trouble with getting '\1' inside the argument to -e when using bash.

The following is cleaner but does not follow the sed command's behavior
and is still too Perlish for my tastes:

ruby -pi -e '$_.sub!(/local\//,"") if $_=~/^#!/' public/dispatch.{rb,cgi,fcgi}

Anyone?

--
Bil, Hampton, Virginia




Ara.T.Howard

10/5/2004 10:59:00 PM

0

Andrew Johnson

10/5/2004 11:36:00 PM

0

On Wed, 6 Oct 2004 07:12:30 +0900, Bil Kleb <Bil.Kleb@NASA.Gov> wrote:

> The following is cleaner but does not follow the sed command's behavior
> and is still too Perlish for my tastes:
>
> ruby -pi -e '$_.sub!(/local\//,"") if $_=~/^#!/' public/dispatch.{rb,cgi,fcgi}
>
> Anyone?

How about:

ruby -pi -e '~/^#!/&&$_[/local\//]=""' files

andrew

Ara.T.Howard

10/5/2004 11:38:00 PM

0