In article <200211190104.gAJ14NH05620 / sharui.nakada.kanuma.tochigi.jp>,
 <nobu.nokada / softhome.net> wrote:
>Hi,
>
>At Tue, 19 Nov 2002 05:09:27 +0900,
>Phil Tomson wrote:
>> So my question is, does install.rb take care of this?  ie. for each script 
>> in your package's /bin directory does it prepend the #!<path_to_ruby> 
>> prior to installing the script?
>
>You mean setup package by Minero Aoki?  

Yes, that's the one.

>If so, that install.rb
>rewrites (not prepend) shebangs in scripts under /bin directory
>automatically according to --ruby-path command line option for
>config, and it's defaulted to ${bindir}/${ruby_install_name}.
>

I don't see the '#!/usr/bin/ruby' line being added to the scripts in the 
/bin directory.

When I run:

ruby install.rb setup

I see the following messages:

"
install.rb: entering setup phase...
---> bin
set #! line to "#!/usr/bin/ruby" for 
/home/phil/ruby_stuff/raa_exec/bin/raa_exec ...
rm -f raa_exec.tmp
<--- bin
install.rb: setup done.
"

So it looks like it's going to add the shebang, but when I look at the 
installed file it's not there...

....later...

Ok, I went off and did some investigation of the sourcecode and tried some 
things out.  Here's the scoop:

1) If you have no shebang at the top of a script in the bin directory 
you'll get now shebang+path_to_ruby_bin added.
2) if you have: '#!/usr/bin/env ruby'  for the first line of the script it 
will not be changed.
3) if you have: '#!ruby' it'll be expanded to: '#!/usr/bin/ruby'  (or 
whatever the actual path to your ruby executable is.)  Actually, it uses 
the following regex:  /\A\#!\s*\S*ruby\S*/
so I found that if I had: #!/usr/bin/ruby  and then ran config and setup 
with another version of Ruby that I have installed elsewhere it would get 
changed to (in this particular case):
#!/home/phil/ruby_1.7.3/bin/ruby 

So it seems to do what I would expect.  The reason why it didn't work 
initially was that I had: '#!/usr/bin/env ruby' or no shebang at all 
and install.rb doesn't change it (special cases).

Phil