Changing the default extension of Ruby

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)

Where? In what environment? What for?

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

– Matma R.

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

On Sun, Oct 7, 2012 at 12:02 PM, Ghassen SMIDA [email protected]
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.

Hassan is quite correct

On 10/09/2012 07:32 AM, Nathan A. 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. :wink:

-Jeremy

On Tue, Oct 9, 2012 at 10:37 AM, Ghassen SMIDA [email protected]
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.

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 B. wrote in post #1079109:

On 10/09/2012 07:32 AM, Nathan A. 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. :wink:

-Jeremy