summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-09-30 16:45:28 +0900
committerHomu <homu@barosl.com>2016-09-30 16:45:28 +0900
commit16fcbf7652c314b794a9d71a82655eda357a85fe (patch)
tree06f79c8a9b429679272cdab975b92fd927744f37
parent447d51949b5fc4da3678e5912b546394a5ced53a (diff)
parent7428308b952d8126c9b4389e26d5729437ff3cfd (diff)
downloadbundler-2-0-dev.tar.gz
Auto merge of #4916 - bundler:seg-remove-pysched-yaml, r=indirect2-0-dev
Remove psyched_yaml Closes #4825 See https://github.com/bundler/bundler/issues/4856
-rw-r--r--.rubocop_todo.yml2
-rw-r--r--lib/bundler.rb4
-rw-r--r--lib/bundler/psyched_yaml.rb27
-rw-r--r--lib/bundler/rubygems_integration.rb3
-rw-r--r--spec/bundler/psyched_yaml_spec.rb9
-rw-r--r--spec/install/gems/resolving_spec.rb2
-rw-r--r--spec/realworld/edgecases_spec.rb12
-rw-r--r--spec/spec_helper.rb1
8 files changed, 13 insertions, 47 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 686c189839..0f7cd7e958 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -17,7 +17,6 @@ Lint/Eval:
Lint/HandleExceptions:
Exclude:
- 'lib/bundler/installer.rb'
- - 'lib/bundler/psyched_yaml.rb'
- 'lib/bundler/vendored_persistent.rb'
# Offense count: 1
@@ -122,7 +121,6 @@ Style/ConditionalAssignment:
- 'lib/bundler/cli/platform.rb'
- 'lib/bundler/dsl.rb'
- 'lib/bundler/lazy_specification.rb'
- - 'lib/bundler/psyched_yaml.rb'
- 'lib/bundler/rubygems_integration.rb'
- 'lib/bundler/source/git.rb'
- 'lib/bundler/source/rubygems.rb'
diff --git a/lib/bundler.rb b/lib/bundler.rb
index a32ab723db..c0fe257486 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -386,10 +386,8 @@ module Bundler
private
def eval_yaml_gemspec(path, contents)
- # If the YAML is invalid, Syck raises an ArgumentError, and Psych
- # raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
Gem::Specification.from_yaml(contents)
- rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
+ rescue Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
eval_gemspec(path, contents)
end
diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb
deleted file mode 100644
index 69d2ae78c5..0000000000
--- a/lib/bundler/psyched_yaml.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# frozen_string_literal: true
-# Psych could be a gem, so try to ask for it
-begin
- gem "psych"
-rescue LoadError
-end if defined?(gem)
-
-# Psych could be in the stdlib
-# but it's too late if Syck is already loaded
-begin
- require "psych" unless defined?(Syck)
-rescue LoadError
- # Apparently Psych wasn't available. Oh well.
-end
-
-# At least load the YAML stdlib, whatever that may be
-require "yaml" unless defined?(YAML.dump)
-
-module Bundler
- # On encountering invalid YAML,
- # Psych raises Psych::SyntaxError
- if defined?(::Psych::SyntaxError)
- YamlLibrarySyntaxError = ::Psych::SyntaxError
- else # Syck raises ArgumentError
- YamlLibrarySyntaxError = ::ArgumentError
- end
-end
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index ef29b1b8a8..b59966e9ce 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -80,13 +80,12 @@ module Bundler
end
def configuration
- require "bundler/psyched_yaml"
Gem.configuration
rescue Gem::SystemExitException, LoadError => e
Bundler.ui.error "#{e.class}: #{e.message}"
Bundler.ui.trace e
raise
- rescue YamlLibrarySyntaxError => e
+ rescue Psych::SyntaxError => e
raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \
"usually located in ~/.gemrc, contains invalid YAML syntax.")
end
diff --git a/spec/bundler/psyched_yaml_spec.rb b/spec/bundler/psyched_yaml_spec.rb
deleted file mode 100644
index 4b7715b482..0000000000
--- a/spec/bundler/psyched_yaml_spec.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-# frozen_string_literal: true
-require "spec_helper"
-require "bundler/psyched_yaml"
-
-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/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index d6f83a20d9..c0b9f672a4 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -118,7 +118,7 @@ describe "bundle install with gem sources" do
gem 'require_ruby'
G
- expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
+ expect(out).to_not match(/Gem::(InstallError|RuntimeRequirementNotMetError): require_ruby requires Ruby version > 9000/)
end
end
end
diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb
index 740bb3f4fc..ae04505277 100644
--- a/spec/realworld/edgecases_spec.rb
+++ b/spec/realworld/edgecases_spec.rb
@@ -48,8 +48,16 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
gem 'capybara', '~> 2.2.0'
gem 'rack-cache', '1.2.0' # last version that works on Ruby 1.9
G
- bundle :lock
- expect(lockfile).to include("rails (3.2.22.4)")
+ bundle! :lock
+ rails_version = ruby(<<-R)
+ require 'rubygems'
+ require 'bundler'
+ fetcher = Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(URI('https://rubygems.org')))
+ index = fetcher.specs(%w(rails), nil)
+ rails = index.search(Gem::Dependency.new("rails", "~> 3.0")).last
+ puts rails.version
+ R
+ expect(lockfile).to include("rails (#{rails_version})")
expect(lockfile).to include("capybara (2.2.1)")
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c9359012fd..f98ff8c6b8 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -2,7 +2,6 @@
$:.unshift File.expand_path("..", __FILE__)
$:.unshift File.expand_path("../../lib", __FILE__)
-require "bundler/psyched_yaml"
require "fileutils"
require "uri"
require "digest/sha1"