# File lib/rubygems/installer.rb, line 250
    def shebang_default(spec, install_dir, bin_file_name)
      path = File.join(install_dir, "gems", spec.full_name, spec.bindir, bin_file_name)
      File.open(path, "rb") do |file|
        first_line = file.readlines("\n").first 
        path_to_ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
        if first_line =~ /^#!/
          # Preserve extra words on shebang line, like "-w".  Thanks RPA.
          shebang = first_line.sub(/\A\#!\s*\S*ruby\S*/, "#!" + path_to_ruby)
        else
          # Create a plain shebang line.
          shebang = "#!" + path_to_ruby
        end
        return shebang.strip  # Avoid nasty ^M issues.
      end
    end