ruby-win32/lib/ruby/site_ruby/1.8/rubygems/installer.rb
##
# Reads the file index and extracts each file into the gem directory.
#
# Ensures that files can't be installed outside the gem directory.
Reads the file index and extracts each file into the gem directory.
Ensures that files can't be installed outside the gem directory.
Reads the file index and extracts each file into the gem directory . Ensures that files can ' t be installed outside the gem directory .
def extract_files
    expand_and_validate_gem_dir
    raise ArgumentError, "format required to extract from" if @format.nil?
    @format.file_entries.each do |entry, file_data|
      path = entry['path'].untaint
      if path =~ /\A\// then 
        raise Gem::InstallError,
              "attempt to install file into #{entry['path'].inspect}"
      end
      path = File.expand_path File.join(@gem_dir, path)
      if path !~ /\A#{Regexp.escape @gem_dir}/ then
        msg = "attempt to install file into %p under %p" %
                [entry['path'], @gem_dir]
        raise Gem::InstallError, msg
      end
      FileUtils.mkdir_p File.dirname(path)
      File.open(path, "wb") do |out|
        out.write file_data
      end
      say path if Gem.configuration.really_verbose
    end
  end
def extract_files expand_and_validate_gem_dir raise ArgumentError , "format required to extract from" if @format . nil? @format . file_entries . each do | entry , file_data | path = entry [ 'path' ] . untaint if path =~ / \A \/ / then raise Gem :: InstallError , "attempt to install file into #{entry['path'].inspect}" end path = File . expand_path File . join ( @gem_dir , path ) if path !~ / \A #{ Regexp . escape @gem_dir } / then msg = "attempt to install file into %p under %p" % [ entry [ 'path' ] , @gem_dir ] raise Gem :: InstallError , msg end FileUtils . mkdir_p File . dirname ( path ) File . open ( path , "wb" ) do | out | out . write file_data end say path if Gem . configuration . really_verbose end end
Reads the file index and extracts each file into the gem directory.
Reads the file index and extracts each file into the gem directory .
# for extra sanity