Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,11 @@ def reset_rubygems!
private

def eval_yaml_gemspec(path, contents)
require_relative "bundler/psyched_yaml"
Kernel.send(:require, "yaml")

# If the YAML is invalid, Syck raises an ArgumentError, and Psych
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
# If the YAML is invalid, Psych raises a Psych::SyntaxError.
Gem::Specification.from_yaml(contents)
rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
rescue Psych::SyntaxError, Gem::EndOfYAMLException, Gem::Exception
eval_gemspec(path, contents)
end

Expand Down
8 changes: 4 additions & 4 deletions lib/bundler/plugin/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def load_index(index_file, global = false)

data = index_f.read

require_relative "../yaml_serializer"
index = YAMLSerializer.load(data)
require "yaml"
index = YAML.load(data)

@commands.merge!(index["commands"])
@hooks.merge!(index["hooks"])
Expand All @@ -162,10 +162,10 @@ def save_index
"sources" => @sources,
}

require_relative "../yaml_serializer"
require "yaml"
SharedHelpers.filesystem_access(index_file) do |index_f|
FileUtils.mkdir_p(index_f.dirname)
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
File.open(index_f, "w") {|f| f.puts YAML.dump(index) }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/rubygems_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def platforms
end

def configuration
require_relative "psyched_yaml"
require "yaml"
Gem.configuration
rescue Gem::SystemExitException, LoadError => e
Bundler.ui.error "#{e.class}: #{e.message}"
Expand Down Expand Up @@ -267,7 +267,7 @@ def with_build_args(args)

def spec_from_gem(path, policy = nil)
require "rubygems/security"
require_relative "psyched_yaml"
require "yaml"
gem_from_path(path, security_policies[policy]).spec
rescue Gem::Package::FormatError
raise GemspecError, "Could not read gem at #{path}. It may be corrupted."
Expand Down
8 changes: 4 additions & 4 deletions lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ def set_key(raw_key, value, hash, file)
return unless file
SharedHelpers.filesystem_access(file) do |p|
FileUtils.mkdir_p(p.dirname)
require_relative "yaml_serializer"
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
require "yaml"
p.open("w") {|f| f.write(YAML.dump(hash)) }
end
end

Expand Down Expand Up @@ -392,8 +392,8 @@ def load_config(config_file)
SharedHelpers.filesystem_access(config_file, :read) do |file|
valid_file = file.exist? && !file.size.zero?
return {} unless valid_file
require_relative "yaml_serializer"
YAMLSerializer.load file.read
require "yaml"
YAML.load file.read
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
context "with Psych as YAML::Engine" do
it "raises a GemspecError after YAML load throws Psych::SyntaxError" do
orig_yamler = YAML::ENGINE.yamler
YAML::ENGINE.yamler = "psych"
YAML::ENGINE.yamler = "yaml"

expect { subject }.to raise_error(Bundler::GemspecError)

Expand Down
9 changes: 0 additions & 9 deletions spec/bundler/psyched_yaml_spec.rb

This file was deleted.

194 changes: 0 additions & 194 deletions spec/bundler/yaml_serializer_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/commands/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
it "doesn't return quotes around values" do
bundle "config set foo '1'"
run "puts Bundler.settings.send(:global_config_file).read"
expect(out).to include('"1"')
expect(out).to include("'1'")
run "puts Bundler.settings[:foo]"
expect(out).to eq("1")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)

require "bundler/psyched_yaml"
require "yaml"
require "bundler/vendored_fileutils"
require "uri"
require "digest"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/hax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Object
begin
# this has to be done up front because psych will try to load a .jar
# if it thinks its on jruby
require "psych"
require "yaml"
rescue LoadError
nil
end
Expand Down