[Rubygems-developers] Adjusting Shebang in gem files

Jim Weirich jim at weirichhouse.org
Fri Sep 22 12:47:39 EDT 2006

Jim Freeze wrote:
> Hello all:
> I am working on a patch to rubygems that allows the user
> to specify a shebang that is valid for a heterogeneous installation
> of gems (multi OS env). Basically, this means that the path to ruby is
> not specified explicitly in the shebang, but is set to:
>   #!/usr/bin/env ruby

I have no problem with making this the default shebang line.  However, 
in reviewing the code for writing the current shebang line, it seems 
that we carefully preserve any command line switches from the original 
code base (e.g. the -w flag).

If I recall correctly, ruby command line switches are not passed to Ruby 
when using the env version of the shebang line (indeed, any switches 
found there will be passed to env, not Ruby).

So, the question is, how should this be handled?  If the original code 
passes switches, should we:

(1) ignore them
(2) fallback to the current style of shebang.

Prehaps it would be better to keep the current default so that switches 
are preserved by default, and only use the env version if requested.


-- Jim Weirich

More information about the Rubygems-developers mailing list