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

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

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 :wink:

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 :wink:

···

--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services

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 :wink:

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

perhaps

   ruby -p -ibak -e '$_.sub! %r|^(#!.*)local/|, "\\1"' public/dispatch.{rb,cgi,fcgi}

??

-a

···

On Wed, 6 Oct 2004, Bil Kleb wrote:

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 :wink:

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?

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================

How about:

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

andrew

···

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?

wow - you win!

-a

···

On Tue, 5 Oct 2004, Andrew Johnson wrote:

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

--

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
A flower falls, even though we love it;
and a weed grows, even though we do not love it. --Dogen

===============================================================================