Bug #3071 ยป rgems.patch
| lib/rdoc.rb | ||
|---|---|---|
|
METHOD_MODIFIERS = GENERAL_MODIFIERS +
|
||
|
%w[arg args yield yields notnew not-new not_new doc]
|
||
|
def self.yamler # :nodoc:
|
||
|
@yamler ||=
|
||
|
begin
|
||
|
require 'psych'
|
||
|
Psych
|
||
|
rescue LoadError
|
||
|
require 'yaml'
|
||
|
YAML
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| lib/rdoc/ri/descriptions.rb | ||
|---|---|---|
|
require 'yaml'
|
||
|
begin
|
||
|
require 'psych'
|
||
|
rescue LoadError
|
||
|
require 'yaml'
|
||
|
end
|
||
|
require 'rdoc/markup/fragments'
|
||
|
require 'rdoc/ri'
|
||
| ... | ... | |
|
end
|
||
|
def self.deserialize(from)
|
||
|
YAML.load(from)
|
||
|
RDoc.yamler.load(from)
|
||
|
end
|
||
|
def <=>(other)
|
||
| lib/rdoc/ri/driver.rb | ||
|---|---|---|
|
require 'optparse'
|
||
|
require 'yaml'
|
||
|
require 'rdoc/ri'
|
||
|
require 'rdoc/ri/paths'
|
||
| lib/rubygems.rb | ||
|---|---|---|
|
YAML_SPEC_DIR = 'quick/'
|
||
|
def self.yamler # :nodoc:
|
||
|
@yamler ||=
|
||
|
begin
|
||
|
require 'psych'
|
||
|
Psych
|
||
|
rescue LoadError
|
||
|
require 'yaml'
|
||
|
YAML
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
module Kernel
|
||
| lib/rubygems/builder.rb | ||
|---|---|---|
|
# spec:: [Gem::Specification] The specification instance
|
||
|
def initialize(spec)
|
||
|
require "yaml"
|
||
|
require "rubygems/package"
|
||
|
require "rubygems/security"
|
||
| ... | ... | |
|
def write_package
|
||
|
open @spec.file_name, 'wb' do |gem_io|
|
||
|
Gem::Package.open gem_io, 'w', @signer do |pkg|
|
||
|
pkg.metadata = @spec.to_yaml
|
||
|
pkg.metadata = Gem.yamler.dump @spec
|
||
|
@spec.files.each do |file|
|
||
|
next if File.directory? file
|
||
| lib/rubygems/commands/mirror_command.rb | ||
|---|---|---|
|
require 'yaml'
|
||
|
require 'zlib'
|
||
|
require 'rubygems/command'
|
||
| ... | ... | |
|
raise "Config file #{config_file} not found" unless File.exist? config_file
|
||
|
mirrors = YAML.load_file config_file
|
||
|
mirrors = Gem.yamler.load_file config_file
|
||
|
raise "Invalid config file #{config_file}" unless mirrors.respond_to? :each
|
||
| lib/rubygems/commands/owner_command.rb | ||
|---|---|---|
|
end
|
||
|
with_response response do |resp|
|
||
|
owners = YAML.load resp.body
|
||
|
owners = Gem.yamler.load resp.body
|
||
|
say "Owners for gem: #{name}"
|
||
|
owners.each do |owner|
|
||
| lib/rubygems/commands/specification_command.rb | ||
|---|---|---|
|
require 'yaml'
|
||
|
require 'rubygems/command'
|
||
|
require 'rubygems/local_remote_options'
|
||
|
require 'rubygems/version_option'
|
||
| ... | ... | |
|
say case options[:format]
|
||
|
when :ruby then s.to_ruby
|
||
|
when :marshal then Marshal.dump s
|
||
|
else s.to_yaml
|
||
|
else Gem.yamler.dump s
|
||
|
end
|
||
|
say "\n"
|
||
| lib/rubygems/config_file.rb | ||
|---|---|---|
|
dirname = File.dirname(credentials_path)
|
||
|
Dir.mkdir(dirname) unless File.exists?(dirname)
|
||
|
require 'yaml'
|
||
|
File.open(credentials_path, 'w') do |f|
|
||
|
f.write config.to_yaml
|
||
|
f.write Gem.yamler.dump config
|
||
|
end
|
||
|
@rubygems_api_key = api_key
|
||
| ... | ... | |
|
def load_file(filename)
|
||
|
return {} unless filename and File.exists?(filename)
|
||
|
begin
|
||
|
require 'yaml'
|
||
|
YAML.load(File.read(filename))
|
||
|
Gem.yamler.load(File.read(filename))
|
||
|
rescue ArgumentError
|
||
|
warn "Failed to load #{config_file_name}"
|
||
|
rescue Errno::EACCES
|
||
| ... | ... | |
|
yaml_hash[key.to_s] = value
|
||
|
end
|
||
|
yaml_hash.to_yaml
|
||
|
Gem.yamler.dump yaml_hash
|
||
|
end
|
||
|
# Writes out this config file, replacing its source.
|
||
|
def write
|
||
|
require 'yaml'
|
||
|
open config_file_name, 'w' do |io|
|
||
|
io.write to_yaml
|
||
|
end
|
||
| lib/rubygems/indexer.rb | ||
|---|---|---|
|
spec_file_name = "#{original_name}.gemspec.rz"
|
||
|
yaml_name = File.join @quick_dir, spec_file_name
|
||
|
yaml_zipped = Gem.deflate spec.to_yaml
|
||
|
yaml_zipped = Gem.deflate Gem.yamler.dump spec
|
||
|
open yaml_name, 'wb' do |io| io.write yaml_zipped end
|
||
|
progress.updated original_name
|
||
| ... | ... | |
|
gems = index.sort_by { |name, gemspec| gemspec.sort_obj }
|
||
|
gems.each do |original_name, gemspec|
|
||
|
yaml = gemspec.to_yaml.gsub(/^/, ' ')
|
||
|
yaml = Gem.yamler.dump(gemspec).gsub(/^/, ' ')
|
||
|
yaml = yaml.sub(/\A ---/, '') # there's a needed extra ' ' here
|
||
|
io.print " #{original_name}:"
|
||
|
io.puts yaml
|
||
| lib/rubygems/old_format.rb | ||
|---|---|---|
|
require 'rubygems'
|
||
|
require 'fileutils'
|
||
|
require 'yaml'
|
||
|
require 'zlib'
|
||
|
##
|
||
| ... | ... | |
|
self.read_until_dashes(gem_file) do |line|
|
||
|
header_yaml << line
|
||
|
end
|
||
|
header = YAML.load(header_yaml)
|
||
|
header = Gem.yamler.load(header_yaml)
|
||
|
raise Gem::Exception, errstr unless header
|
||
|
header.each do |entry|
|
||
| lib/rubygems/package.rb | ||
|---|---|---|
|
require 'fileutils'
|
||
|
require 'find'
|
||
|
require 'stringio'
|
||
|
require 'yaml'
|
||
|
require 'zlib'
|
||
|
require 'rubygems/security'
|
||
| lib/rubygems/server.rb | ||
|---|---|---|
|
require 'webrick'
|
||
|
require 'yaml'
|
||
|
require 'zlib'
|
||
|
require 'erb'
|
||
| ... | ... | |
|
res.body << Gem.deflate(Marshal.dump(specs.first))
|
||
|
else # deprecated YAML format
|
||
|
res['content-type'] = 'application/x-deflate'
|
||
|
res.body << Gem.deflate(specs.first.to_yaml)
|
||
|
res.body << Gem.deflate(Gem.yamler.dump(specs.first))
|
||
|
end
|
||
|
else
|
||
|
raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
|
||
| ... | ... | |
|
res['date'] = File.stat(@spec_dir).mtime
|
||
|
index = @source_index.to_yaml
|
||
|
index = Gem.yamler.dump @source_index
|
||
|
if req.path =~ /Z$/ then
|
||
|
res['content-type'] = 'application/x-deflate'
|
||
| lib/rubygems/source_index.rb | ||
|---|---|---|
|
if name =~ /Marshal/ then
|
||
|
return Marshal.load(spec_data)
|
||
|
else
|
||
|
return YAML.load(spec_data)
|
||
|
return Gem.yamler.load(spec_data)
|
||
|
end
|
||
|
rescue => e
|
||
|
if Gem.configuration.really_verbose then
|
||
| ... | ... | |
|
begin
|
||
|
yaml_uri = source_uri + "quick/#{spec_name}.gemspec.rz"
|
||
|
zipped = fetcher.fetch_path yaml_uri
|
||
|
return YAML.load(unzip(zipped))
|
||
|
return Gem.yamler.load(unzip(zipped))
|
||
|
rescue => ex
|
||
|
@fetch_error = ex
|
||
|
if Gem.configuration.really_verbose then
|
||
| lib/rubygems/specification.rb | ||
|---|---|---|
|
def self.from_yaml(input)
|
||
|
input = normalize_yaml_input input
|
||
|
spec = YAML.load input
|
||
|
spec = Gem.yamler.load input
|
||
|
if spec && spec.class == FalseClass then
|
||
|
raise Gem::EndOfYAMLException
|
||
| ... | ... | |
|
}
|
||
|
end
|
||
|
def to_yaml(opts = {}) # :nodoc:
|
||
|
def encode_with coder # :nodoc:
|
||
|
mark_version
|
||
|
attributes = @@attributes.map { |name,| name.to_s }.sort
|
||
|
attributes = attributes - %w[name version platform]
|
||
|
yaml = YAML.quick_emit object_id, opts do |out|
|
||
|
out.map taguri, to_yaml_style do |map|
|
||
|
map.add 'name', @name
|
||
|
map.add 'version', @version
|
||
|
platform = case @original_platform
|
||
|
when nil, '' then
|
||
|
'ruby'
|
||
|
when String then
|
||
|
@original_platform
|
||
|
else
|
||
|
@original_platform.to_s
|
||
|
end
|
||
|
map.add 'platform', platform
|
||
|
coder.add 'name', @name
|
||
|
coder.add 'version', @version
|
||
|
attributes.each do |name|
|
||
|
map.add name, instance_variable_get("@#{name}")
|
||
|
end
|
||
|
platform = case @original_platform
|
||
|
when nil, '' then
|
||
|
'ruby'
|
||
|
when String then
|
||
|
@original_platform
|
||
|
else
|
||
|
@original_platform.to_s
|
||
|
end
|
||
|
coder.add 'platform', platform
|
||
|
attributes.each do |name|
|
||
|
coder.add name, instance_variable_get("@#{name}")
|
||
|
end
|
||
|
end
|
||
|
def to_yaml(opts = {}) # :nodoc:
|
||
|
return super unless 'YAML' == Gem.yamler.name
|
||
|
yaml = Gem.yamler.quick_emit object_id, opts do |out|
|
||
|
out.map taguri, to_yaml_style do |map|
|
||
|
encode_with map
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def init_with coder # :nodoc:
|
||
|
yaml_initialize coder.tag, coder.map
|
||
|
end
|
||
|
def yaml_initialize(tag, vals) # :nodoc:
|
||
|
vals.each do |ivar, val|
|
||
|
instance_variable_set "@#{ivar}", val
|
||
| test/rubygems/gemutilities.rb | ||
|---|---|---|
|
require 'rubygems'
|
||
|
end
|
||
|
require 'fileutils'
|
||
|
begin
|
||
|
gem 'minitest', '>= 1.3.1'
|
||
|
require 'minitest/unit'
|
||
|
rescue Gem::LoadError
|
||
|
warn "Install minitest gem >= 1.3.1"
|
||
|
raise
|
||
|
end
|
||
|
require 'minitest/autorun'
|
||
|
require 'tmpdir'
|
||
|
require 'uri'
|
||
|
require 'rubygems/package'
|
||
|
require 'rubygems/test_utilities'
|
||
|
require 'pp'
|
||
|
require 'yaml'
|
||
|
begin
|
||
|
gem 'rdoc'
|
||
| ... | ... | |
|
Gem.pre_uninstall do |uninstaller|
|
||
|
@pre_uninstall_hook_arg = uninstaller
|
||
|
end
|
||
|
Object.class_eval %q{
|
||
|
alias tmp_to_yaml to_yaml
|
||
|
def to_yaml( opts = {} )
|
||
|
YAML::quick_emit( self, opts ) do |out|
|
||
|
out.map( taguri, to_yaml_style ) do |map|
|
||
|
to_yaml_properties.each do |m|
|
||
|
map.add( m[1..-1], instance_variable_get( m ) )
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
}
|
||
|
end
|
||
|
def teardown
|
||
|
Object.class_eval %q{
|
||
|
alias to_yaml tmp_to_yaml
|
||
|
}
|
||
|
Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY
|
||
|
Gem::ConfigMap[:arch] = @orig_arch
|
||
| test/rubygems/test_gem_commands_specification_command.rb | ||
|---|---|---|
|
@cmd.execute
|
||
|
end
|
||
|
assert_equal "foo", YAML.load(@ui.output)
|
||
|
assert_equal "foo", Gem.yamler.load(@ui.output)
|
||
|
end
|
||
|
def test_execute_marshal
|
||
| test/rubygems/test_gem_gemcutter_utilities.rb | ||
|---|---|---|
|
assert @fetcher.last_request["authorization"]
|
||
|
assert_match %r{Signed in.}, @sign_in_ui.output
|
||
|
credentials = YAML.load_file Gem.configuration.credentials_path
|
||
|
credentials = Gem.yamler.load_file Gem.configuration.credentials_path
|
||
|
assert_equal api_key, credentials[:rubygems_api_key]
|
||
|
end
|
||
| ... | ... | |
|
assert @fetcher.last_request["authorization"]
|
||
|
assert_match %r{Signed in.}, @sign_in_ui.output
|
||
|
credentials = YAML.load_file Gem.configuration.credentials_path
|
||
|
credentials = Gem.yamler.load_file Gem.configuration.credentials_path
|
||
|
assert_equal api_key, credentials[:rubygems_api_key]
|
||
|
end
|
||
| ... | ... | |
|
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
|
||
|
assert_match %r{Signed in.}, @sign_in_ui.output
|
||
|
credentials = YAML.load_file Gem.configuration.credentials_path
|
||
|
credentials = Gem.yamler.load_file Gem.configuration.credentials_path
|
||
|
assert_equal api_key, credentials[:rubygems_api_key]
|
||
|
assert_equal other_api_key, credentials[:other_api_key]
|
||
|
end
|
||
| test/rubygems/test_gem_indexer.rb | ||
|---|---|---|
|
yaml_path = File.join @tempdir, 'yaml'
|
||
|
dump_path = File.join @tempdir, "Marshal.#{@marshal_version}"
|
||
|
yaml_index = YAML.load_file yaml_path
|
||
|
yaml_index = Gem.yamler.load_file yaml_path
|
||
|
dump_index = Marshal.load Gem.read_binary(dump_path)
|
||
|
dump_index.each do |_,gem|
|
||
| test/rubygems/test_gem_server.rb | ||
|---|---|---|
|
assert @res['date']
|
||
|
assert_equal 'application/x-deflate', @res['content-type']
|
||
|
spec = YAML.load Gem.inflate(@res.body)
|
||
|
spec = Gem.yamler.load Gem.inflate(@res.body)
|
||
|
assert_equal 'a', spec.name
|
||
|
assert_equal Gem::Version.new(1), spec.version
|
||
|
end
|
||
| ... | ... | |
|
assert @res['date']
|
||
|
assert_equal 'application/x-deflate', @res['content-type']
|
||
|
spec = YAML.load Gem.inflate(@res.body)
|
||
|
spec = Gem.yamler.load Gem.inflate(@res.body)
|
||
|
assert_equal 'a', spec.name
|
||
|
assert_equal Gem::Version.new(1), spec.version
|
||
|
assert_equal Gem::Platform.local, spec.platform
|
||
| ... | ... | |
|
assert @res['date']
|
||
|
assert_equal 'application/x-deflate', @res['content-type']
|
||
|
spec = YAML.load Gem.inflate(@res.body)
|
||
|
spec = Gem.yamler.load Gem.inflate(@res.body)
|
||
|
assert_equal 'a', spec.name
|
||
|
assert_equal Gem::Version.new(1), spec.version
|
||
|
end
|
||
| ... | ... | |
|
si = Gem::SourceIndex.new
|
||
|
si.add_specs @a1, @a2
|
||
|
assert_equal si, YAML.load(@res.body)
|
||
|
assert_equal si, Gem.yamler.load(@res.body)
|
||
|
end
|
||
|
def test_yaml_Z
|
||
| ... | ... | |
|
si = Gem::SourceIndex.new
|
||
|
si.add_specs @a1, @a2
|
||
|
assert_equal si, YAML.load(Gem.inflate(@res.body))
|
||
|
assert_equal si, Gem.yamler.load(Gem.inflate(@res.body))
|
||
|
end
|
||
|
def util_listen
|
||
| test/rubygems/test_gem_specification.rb | ||
|---|---|---|
|
require_relative 'gemutilities'
|
||
|
require 'stringio'
|
||
|
require 'rubygems/specification'
|
||
|
require 'date'
|
||
|
class TestGemSpecification < RubyGemTestCase
|
||
| ... | ... | |
|
def test_to_yaml
|
||
|
yaml_str = @a1.to_yaml
|
||
|
same_spec = YAML.load(yaml_str)
|
||
|
same_spec = Gem.yamler.load(yaml_str)
|
||
|
assert_equal @a1, same_spec
|
||
|
end
|
||
| ... | ... | |
|
@a1.platform = Gem::Platform.local
|
||
|
yaml_str = @a1.to_yaml
|
||
|
same_spec = YAML.load(yaml_str)
|
||
|
same_spec = Gem.yamler.load(yaml_str)
|
||
|
assert_equal Gem::Platform.local, same_spec.platform
|
||
| ... | ... | |
|
yaml_str = @a1.to_yaml
|
||
|
same_spec = YAML.load(yaml_str)
|
||
|
same_spec = Gem.yamler.load(yaml_str)
|
||
|
assert_equal Gem::Platform.new('powerpc-darwin7'), same_spec.platform
|
||
|
assert_equal 'powerpc-darwin7.9.0', same_spec.original_platform
|
||