Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rubygems/package.rb
  • rubygems/package/f_sync_dir.rb
  • rubygems/package/tar_header.rb
  • rubygems/package/tar_input.rb
  • rubygems/package/tar_output.rb
  • rubygems/package/tar_reader.rb
  • rubygems/package/tar_writer.rb

Class/Module Index [+]

Quicksearch

Gem::Package

Public Class Methods

open(io, mode = "r", signer = nil, &block) click to toggle source
 
               # File rubygems/package.rb, line 49
def self.open(io, mode = "r", signer = nil, &block)
  tar_type = case mode
             when 'r' then TarInput
             when 'w' then TarOutput
             else
               raise "Unknown Package open mode"
             end

  tar_type.open(io, signer, &block)
end
            
pack(src, destname, signer = nil) click to toggle source
 
               # File rubygems/package.rb, line 60
def self.pack(src, destname, signer = nil)
  TarOutput.open(destname, signer) do |outp|
    dir_class.chdir(src) do
      outp.metadata = (file_class.read("RPA/metadata") rescue nil)
      find_class.find('.') do |entry|
        case
        when file_class.file?(entry)
          entry.sub!(%r{\./}, "")
          next if entry =~ /\ARPA\//
          stat = File.stat(entry)
          outp.add_file_simple(entry, stat.mode, stat.size) do |os|
            file_class.open(entry, "rb") do |f|
              os.write(f.read(4096)) until f.eof?
            end
          end
        when file_class.dir?(entry)
          entry.sub!(%r{\./}, "")
          next if entry == "RPA"
          outp.mkdir(entry, file_class.stat(entry).mode)
        else
          raise "Don't know how to pack this yet!"
        end
      end
    end
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus