    # File lib/rubygems/installer.rb, line 60
      def initialize(gem, options={})
        @gem = gem

        options = {
          :force => false,
          :install_dir => Gem.dir,
          :exec_format => false,
          :env_shebang => false,
          :bin_dir => nil
        }.merge options

        @env_shebang = options[:env_shebang]
        @force = options[:force]
        gem_home = options[:install_dir]
        @gem_home = Pathname.new(gem_home).expand_path
        @ignore_dependencies = options[:ignore_dependencies]
        @format_executable = options[:format_executable]
        @security_policy = options[:security_policy]
        @wrappers = options[:wrappers]
        @bin_dir = options[:bin_dir]
        @development = options[:development]

        begin
          @format = Gem::Format.from_file_by_path @gem, @security_policy
        rescue Gem::Package::FormatError
          raise Gem::InstallError, "invalid gem format for #{@gem}"
        end

        @spec = @format.spec

        @gem_dir = File.join(@gem_home, "gems", @spec.full_name).untaint
      end