diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-13 15:48:21 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-08-17 23:43:22 -0400 |
commit | 10fb9743f55354ceb72e445fed67b16555d879a2 (patch) | |
tree | afb68f01bcdc0c5e66a251630a2e0424cb7b9eda /lib | |
parent | ac7b13838aa1314964405a2586f2769d0cb041b4 (diff) | |
download | bundler-10fb9743f55354ceb72e445fed67b16555d879a2.tar.gz |
Add a compatibility guard that prints friendly errors on bundler 2+
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler.rb | 1 | ||||
-rw-r--r-- | lib/bundler/compatibility_guard.rb | 14 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 1 | ||||
-rw-r--r-- | lib/bundler/shared_helpers.rb | 1 |
4 files changed, 17 insertions, 0 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 2da2db29c9..a587f1e430 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" require "bundler/vendored_fileutils" require "pathname" diff --git a/lib/bundler/compatibility_guard.rb b/lib/bundler/compatibility_guard.rb new file mode 100644 index 0000000000..6e40a119d1 --- /dev/null +++ b/lib/bundler/compatibility_guard.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require "rubygems" +require "bundler/version" + +if Bundler::VERSION.split(".").first.to_i >= 2 + if Gem::Version.new(Object::RUBY_VERSION) < Gem::Version.new("2.0.0") + abort "Bundler 2 requires Ruby 2+. Either install bundler 1 or update to a supported Ruby version." + end + + if Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.0.0") + abort "Bundler 2 requires RubyGems 2+. Either install bundler 1 or update to a supported RubyGems version." + end +end diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 8462dd9cc1..f5e3a8c157 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" # Allows for declaring a Gemfile inline in a ruby script, optionally installing # any gems that aren't already installed on the user's system. diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 5d3956abc1..bc4c1c1d88 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +require "bundler/compatibility_guard" require "pathname" require "rubygems" |