From 4f01b28d95cef783dcd589d0c90f09b2aef6c600 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 14 Mar 2019 21:25:24 +0900 Subject: Removed psyched_yaml because the modern version of Ruby don't need it. --- lib/bundler.rb | 7 +++---- lib/bundler/plugin/index.rb | 4 ++-- lib/bundler/rubygems_integration.rb | 4 ++-- lib/bundler/settings.rb | 4 ++-- spec/bundler/bundler_spec.rb | 2 +- spec/bundler/psyched_yaml_spec.rb | 9 --------- spec/spec_helper.rb | 2 +- spec/support/hax.rb | 2 +- 8 files changed, 12 insertions(+), 22 deletions(-) delete mode 100644 spec/bundler/psyched_yaml_spec.rb diff --git a/lib/bundler.rb b/lib/bundler.rb index 1887457c77..f5e85c9f02 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -562,12 +562,11 @@ EOF 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 diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index 46189e871a..3a0e58fa23 100644 --- a/lib/bundler/plugin/index.rb +++ b/lib/bundler/plugin/index.rb @@ -139,7 +139,7 @@ module Bundler data = index_f.read - require_relative "psyched_yaml" + require "yaml" index = YAML.load(data) @commands.merge!(index["commands"]) @@ -162,7 +162,7 @@ module Bundler "sources" => @sources, } - require_relative "psyched_yaml" + require "yaml" SharedHelpers.filesystem_access(index_file) do |index_f| FileUtils.mkdir_p(index_f.dirname) File.open(index_f, "w") {|f| f.puts YAML.dump(index) } diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 7549c592f1..a64b193148 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -119,7 +119,7 @@ module Bundler end def configuration - require_relative "psyched_yaml" + require "yaml" Gem.configuration rescue Gem::SystemExitException, LoadError => e Bundler.ui.error "#{e.class}: #{e.message}" @@ -267,7 +267,7 @@ module Bundler 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." diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 203e5e8f7b..6c30925d21 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -352,7 +352,7 @@ module Bundler return unless file SharedHelpers.filesystem_access(file) do |p| FileUtils.mkdir_p(p.dirname) - require_relative "psyched_yaml" + require "yaml" p.open("w") {|f| f.write(YAML.dump(hash)) } end end @@ -392,7 +392,7 @@ module Bundler SharedHelpers.filesystem_access(config_file, :read) do |file| valid_file = file.exist? && !file.size.zero? return {} unless valid_file - require_relative "psyched_yaml" + require "yaml" YAML.load file.read end end diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb index 8a4ce729ed..16f8e0fafe 100644 --- a/spec/bundler/bundler_spec.rb +++ b/spec/bundler/bundler_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Bundler do 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) diff --git a/spec/bundler/psyched_yaml_spec.rb b/spec/bundler/psyched_yaml_spec.rb deleted file mode 100644 index d5d68c5cc3..0000000000 --- a/spec/bundler/psyched_yaml_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "bundler/psyched_yaml" - -RSpec.describe "Bundler::YamlLibrarySyntaxError" do - it "is raised on YAML parse errors" do - expect { YAML.parse "{foo" }.to raise_error(Bundler::YamlLibrarySyntaxError) - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3f12b27547..d58e42f791 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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" diff --git a/spec/support/hax.rb b/spec/support/hax.rb index 74daccc9db..cc19b72fab 100644 --- a/spec/support/hax.rb +++ b/spec/support/hax.rb @@ -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 -- cgit v1.2.1