GRAYBYTE WORDPRESS FILE MANAGER9308

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/alt/ruby18/lib64/ruby/site_ruby/1.8/rubygems/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/alt/ruby18/lib64/ruby/site_ruby/1.8/rubygems//old_format.rb
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

require 'rubygems'

##
# The format class knows the guts of the RubyGem .gem file format and provides
# the capability to read gem files

class Gem::OldFormat

  attr_accessor :spec, :file_entries, :gem_path

  ##
  # Constructs an instance of a Format object, representing the gem's data
  # structure.
  #
  # gem:: [String] The file name of the gem

  def initialize(gem_path)
    require 'fileutils'
    require 'zlib'
    Gem.load_yaml

    @gem_path = gem_path
  end

  ##
  # Reads the named gem file and returns a Format object, representing the
  # data from the gem file
  #
  # file_path:: [String] Path to the gem file

  def self.from_file_by_path(file_path)
    unless File.exist?(file_path)
      raise Gem::Exception, "Cannot load gem file [#{file_path}]"
    end

    File.open(file_path, 'rb') do |file|
      from_io(file, file_path)
    end
  end

  ##
  # Reads a gem from an io stream and returns a Format object, representing
  # the data from the gem file
  #
  # io:: [IO] Stream from which to read the gem

  def self.from_io(io, gem_path="(io)")
    format = self.new(gem_path)
    skip_ruby(io)
    format.spec = read_spec(io)
    format.file_entries = []
    read_files_from_gem(io) do |entry, file_data|
      format.file_entries << [entry, file_data]
    end
    format
  end

  private

  ##
  # Skips the Ruby self-install header.  After calling this method, the
  # IO index will be set after the Ruby code.
  #
  # file:: [IO] The IO to process (skip the Ruby code)

  def self.skip_ruby(file)
    end_seen = false
    loop {
      line = file.gets
      if(line == nil || line.chomp == "__END__") then
        end_seen = true
        break
      end
    }

    if end_seen == false then
      raise Gem::Exception.new("Failed to find end of ruby script while reading gem")
    end
  end

  ##
  # Reads the specification YAML from the supplied IO and constructs
  # a Gem::Specification from it.  After calling this method, the
  # IO index will be set after the specification header.
  #
  # file:: [IO] The IO to process

  def self.read_spec(file)
    yaml = ''

    read_until_dashes file do |line|
      yaml << line
    end

    Gem::Specification.from_yaml yaml
  rescue YAML::Error => e
    raise Gem::Exception, "Failed to parse gem specification out of gem file"
  rescue ArgumentError => e
    raise Gem::Exception, "Failed to parse gem specification out of gem file"
  end

  ##
  # Reads lines from the supplied IO until a end-of-yaml (---) is
  # reached
  #
  # file:: [IO] The IO to process
  # block:: [String] The read line

  def self.read_until_dashes(file)
    while((line = file.gets) && line.chomp.strip != "---") do
      yield line
    end
  end

  ##
  # Reads the embedded file data from a gem file, yielding an entry
  # containing metadata about the file and the file contents themselves
  # for each file that's archived in the gem.
  # NOTE: Many of these methods should be extracted into some kind of
  # Gem file read/writer
  #
  # gem_file:: [IO] The IO to process

  def self.read_files_from_gem(gem_file)
    errstr = "Error reading files from gem"
    header_yaml = ''
    begin
      self.read_until_dashes(gem_file) do |line|
        header_yaml << line
      end
      header = YAML.load(header_yaml)
      raise Gem::Exception, errstr unless header

      header.each do |entry|
        file_data = ''
        self.read_until_dashes(gem_file) do |line|
          file_data << line
        end
        yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
      end
    rescue Zlib::DataError
      raise Gem::Exception, errstr
    end
  end

end


[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 22:48:18
root / root
0755
commands
--
March 03 2024 22:48:18
root / root
0755
ext
--
March 03 2024 22:48:18
root / root
0755
package
--
March 03 2024 22:48:18
root / root
0755
ssl_certs
--
March 03 2024 22:48:18
root / root
0755
builder.rb
2.215 KB
December 05 2019 22:13:01
root / root
0644
command.rb
12.462 KB
December 05 2019 22:13:01
root / root
0644
command_manager.rb
4.668 KB
December 05 2019 22:13:01
root / root
0644
config_file.rb
9.688 KB
December 05 2019 22:13:01
root / root
0644
custom_require.rb
1.827 KB
December 05 2019 22:13:01
root / root
0644
defaults.rb
2.652 KB
December 05 2019 22:13:01
root / root
0644
dependency.rb
6.435 KB
December 05 2019 22:13:01
root / root
0644
dependency_installer.rb
9.939 KB
December 05 2019 22:13:01
root / root
0644
dependency_list.rb
5.585 KB
December 05 2019 22:13:01
root / root
0644
deprecate.rb
1.808 KB
December 05 2019 22:13:01
root / root
0644
doc_manager.rb
5.547 KB
December 05 2019 22:13:01
root / root
0644
errors.rb
0.774 KB
December 05 2019 22:13:01
root / root
0644
exceptions.rb
2.337 KB
December 05 2019 22:13:01
root / root
0644
ext.rb
0.37 KB
December 05 2019 22:13:01
root / root
0644
format.rb
1.958 KB
December 05 2019 22:13:01
root / root
0644
gem_openssl.rb
2.24 KB
December 05 2019 22:13:01
root / root
0644
gem_path_searcher.rb
4.572 KB
December 05 2019 22:13:01
root / root
0644
gem_runner.rb
2.379 KB
December 05 2019 22:13:01
root / root
0644
gemcutter_utilities.rb
1.856 KB
December 05 2019 22:13:01
root / root
0644
indexer.rb
16.928 KB
December 05 2019 22:13:01
root / root
0644
install_update_options.rb
3.867 KB
December 05 2019 22:13:01
root / root
0644
installer.rb
17.017 KB
December 05 2019 22:13:01
root / root
0644
installer_test_case.rb
3.104 KB
December 05 2019 22:13:01
root / root
0644
local_remote_options.rb
3.358 KB
December 05 2019 22:13:01
root / root
0644
mock_gem_ui.rb
1.05 KB
December 05 2019 22:13:01
root / root
0644
old_format.rb
3.688 KB
December 05 2019 22:13:01
root / root
0644
package.rb
2.152 KB
December 05 2019 22:13:01
root / root
0644
package_task.rb
3.793 KB
December 05 2019 22:13:01
root / root
0644
path_support.rb
1.502 KB
December 05 2019 22:13:01
root / root
0644
platform.rb
5.551 KB
December 05 2019 22:13:01
root / root
0644
psych_additions.rb
0.243 KB
December 05 2019 22:13:01
root / root
0644
psych_tree.rb
0.671 KB
December 05 2019 22:13:01
root / root
0644
remote_fetcher.rb
13.783 KB
December 05 2019 22:13:01
root / root
0644
require_paths_builder.rb
0.563 KB
December 05 2019 22:13:01
root / root
0644
requirement.rb
5.006 KB
December 05 2019 22:13:01
root / root
0644
security.rb
28.834 KB
December 05 2019 22:13:01
root / root
0644
server.rb
21.927 KB
December 05 2019 22:13:01
root / root
0644
source_index.rb
11.005 KB
December 05 2019 22:13:01
root / root
0644
spec_fetcher.rb
7.173 KB
December 05 2019 22:13:01
root / root
0644
specification.rb
54.831 KB
December 05 2019 22:13:01
root / root
0644
syck_hack.rb
2.019 KB
December 05 2019 22:13:01
root / root
0644
test_case.rb
23.216 KB
December 05 2019 22:13:01
root / root
0644
test_utilities.rb
3.469 KB
December 05 2019 22:13:01
root / root
0644
text.rb
1.226 KB
December 05 2019 22:13:01
root / root
0644
uninstaller.rb
6.77 KB
December 05 2019 22:13:01
root / root
0644
user_interaction.rb
11.225 KB
December 05 2019 22:13:01
root / root
0644
validator.rb
4.646 KB
December 05 2019 22:13:01
root / root
0644
version.rb
10.188 KB
December 05 2019 22:13:01
root / root
0644
version_option.rb
1.589 KB
December 05 2019 22:13:01
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF