Forum: Ruby Changing the default extension of Ruby

Posted by Ghassen SMIDA (gsmida)
on 2012-10-07 20:40
Hi,

I would like to change the default extension for the ruby interpreter to
be .pl instead of .rb (I know that's the perl default extension)
Posted by Bartosz DziewoƄski (matmarex)
on 2012-10-07 20:54
(Received via mailing list)
Where? In what environment? What for?

You've really not given enough information to help you.

-- Matma Rex
Posted by Ghassen SMIDA (gsmida)
on 2012-10-07 21:02
I'm developing Ruby under Windows. My web host is running under linux
and supports Ruby interpreting but with one condition that the extension
is .pl not .rb and that's the reason.
So if I use a gem (which almost the case) I need that the files'
extension of this gem (including the links between files) to become .pl
to successfully run from my web host so that's why I'm starting here
because may be if I change the main config for the ruby interpreter that
when creating a rails project for example it take that in consideration.
Of course any other suggestion are welcome (anyone that I can do with
the host's conditions)
-- Ghassen SMIDA
Posted by Hassan Schroeder (Guest)
on 2012-10-07 21:22
(Received via mailing list)
On Sun, Oct 7, 2012 at 12:02 PM, Ghassen SMIDA <lists@ruby-forum.com> 
wrote:
> I'm developing Ruby under Windows. My web host is running under linux
> and supports Ruby interpreting but with one condition that the extension
> is .pl not .rb and that's the reason.

That's ridiculous. Find yourself a real web host.
Posted by Nathan Ahmed (Guest)
on 2012-10-09 14:33
(Received via mailing list)
Hassan is quite correct
Posted by Jeremy Bopp (Guest)
on 2012-10-09 17:09
(Received via mailing list)
On 10/09/2012 07:32 AM, Nathan Ahmed wrote:
>
> Hassan is quite correct

While I agree on this point, I suspect that the workaround may actually
be pretty simple.  More than likely, this is a scenario where the script
is running as a CGI script.  If so, the only .rb files that need special
attention are the ones directly executed in that mode by the web server.

It should be sufficient to rename those CGI scripts with a .pl extension
and ensure that the shebang line is set correctly in each of them to run
them with a Ruby interpreter.  Files being required in by those scripts
shouldn't need any extension change since the Ruby interpreter is in
control of loading them, not the web server.

For the Windows development environment, it should be easy enough to set
the file association for .pl files to be run by a Ruby interpreter.
That will allow relatively easy testing of the CGI scripts under Windows
without renaming them to have the .rb extension.  This is pretty ugly to
do though and may lead to confusion later if you ever need to install
Perl interpreter.

All that said, it shouldn't be a difficult matter for the hosting
provider to modify the web server configuration to allow running .rb
files as CGI scripts.  If the hosting provider balks at doing so while
allowing you to hack around and use a Ruby interpreter under the covers,
you should probably consider carefully if you really want trust with any
meaningful operation.

Just my $0.02. ;-)

-Jeremy
Posted by Ghassen SMIDA (gsmida)
on 2012-10-09 19:37
Thank you for responding but changing the web host is not a solution
because I've got many other advantages for that price there is no
provider and I already paid a year of subscription (it's a well known
one) but if I find a solution for this and for running rails on it
becomes the paradise.

Jeremy Bopp wrote in post #1079109:
> On 10/09/2012 07:32 AM, Nathan Ahmed wrote:
>>
>> Hassan is quite correct
>
> While I agree on this point, I suspect that the workaround may actually
> be pretty simple.  More than likely, this is a scenario where the script
> is running as a CGI script.  If so, the only .rb files that need special
> attention are the ones directly executed in that mode by the web server.
>
> It should be sufficient to rename those CGI scripts with a .pl extension
> and ensure that the shebang line is set correctly in each of them to run
> them with a Ruby interpreter.  Files being required in by those scripts
> shouldn't need any extension change since the Ruby interpreter is in
> control of loading them, not the web server.
>
> For the Windows development environment, it should be easy enough to set
> the file association for .pl files to be run by a Ruby interpreter.
> That will allow relatively easy testing of the CGI scripts under Windows
> without renaming them to have the .rb extension.  This is pretty ugly to
> do though and may lead to confusion later if you ever need to install
> Perl interpreter.
>
> All that said, it shouldn't be a difficult matter for the hosting
> provider to modify the web server configuration to allow running .rb
> files as CGI scripts.  If the hosting provider balks at doing so while
> allowing you to hack around and use a Ruby interpreter under the covers,
> you should probably consider carefully if you really want trust with any
> meaningful operation.
>
> Just my $0.02. ;-)
>
> -Jeremy
Posted by Hassan Schroeder (Guest)
on 2012-10-10 04:30
(Received via mailing list)
On Tue, Oct 9, 2012 at 10:37 AM, Ghassen SMIDA <lists@ruby-forum.com> 
wrote:
> Thank you for responding but changing the web host is not a solution
> because I've got many other advantages for that price there is no
> provider and I already paid a year of subscription (it's a well known
> one) but if I find a solution for this and for running rails on it
> becomes the paradise.

If your time is worth nothing, spending it trying to work around a
brain-dead hosting company policy is a real bargain.

Much better than using your time making your clients successful.

Best of luck.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.