summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-06-22 17:35:25 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-06-23 18:41:36 -0500
commite008a1aa7bf18fadb8783e7d03ac61c2abab9a21 (patch)
tree02b3243df38af593710df83f8908cc77ddf8a812
parent3821b16cd72d634032aa5526f5aaa2e5858193fc (diff)
downloadbundler-e008a1aa7bf18fadb8783e7d03ac61c2abab9a21.tar.gz
Print the first batch of major deprecation warnings
-rwxr-xr-xexe/bundle_ruby6
-rw-r--r--lib/bundler.rb1
-rw-r--r--lib/bundler/dsl.rb2
-rw-r--r--lib/bundler/shared_helpers.rb9
-rw-r--r--spec/other/bundle_ruby_spec.rb16
5 files changed, 13 insertions, 21 deletions
diff --git a/exe/bundle_ruby b/exe/bundle_ruby
index 49767304e2..847708c3ea 100755
--- a/exe/bundle_ruby
+++ b/exe/bundle_ruby
@@ -3,14 +3,12 @@
Signal.trap("INT") { exit 1 }
+require "bundler/errors"
require "bundler/ruby_version"
require "bundler/ruby_dsl"
require "bundler/shared_helpers"
module Bundler
- class GemfileError < RuntimeError; end
- class GemfileEvalError < GemfileError; end
-
class Dsl
include RubyDsl
@@ -44,7 +42,7 @@ module Bundler
end
end
-STDERR.puts "Warning: bundle_ruby will be deprecated in Bundler 2.0.0."
+Bundler::SharedHelpers.major_deprecation("the bundle_ruby executable has been removed in favor of `bundle platform --ruby`")
dsl = Bundler::Dsl.new
begin
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 9da798e2bf..a2260e0142 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -211,6 +211,7 @@ module Bundler
# @deprecated Use `original_env` instead
# @return [Hash] Environment with all bundler-related variables removed
def clean_env
+ Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
env = original_env
if env.key?("BUNDLE_ORIG_MANPATH")
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 4208f9b575..358784a9de 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -374,7 +374,7 @@ module Bundler
def normalize_source(source)
case source
when :gemcutter, :rubygems, :rubyforge
- Bundler.ui.warn "The source :#{source} is deprecated because HTTP " \
+ Bundler::SharedHelpers.major_deprecation "The source :#{source} is deprecated because HTTP " \
"requests are insecure.\nPlease change your source to 'https://" \
"rubygems.org' if possible, or 'http://rubygems.org' if not."
"http://rubygems.org"
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 376235abfd..7b56619c5f 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -127,6 +127,15 @@ module Bundler
ui.warn("[DEPRECATED FOR #{Bundler::VERSION.split(".").first.to_i + 1}.0] #{message}")
end
+ def print_major_deprecations!
+ if RUBY_VERSION < "2"
+ major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
+ end
+ unless Bundler.rubygems.provides?(">= 2")
+ major_deprecation("Bundler will only support rubygems >= 2.4, you are running #{self.class.version}")
+ end
+ end
+
private
def find_gemfile
diff --git a/spec/other/bundle_ruby_spec.rb b/spec/other/bundle_ruby_spec.rb
index 88cd8a7e03..9847aded62 100644
--- a/spec/other/bundle_ruby_spec.rb
+++ b/spec/other/bundle_ruby_spec.rb
@@ -2,22 +2,6 @@
require "spec_helper"
describe "bundle_ruby" do
- context "when run" do
- it "displays a deprecation warning" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
-
- gem "foo"
- G
-
- bundle_ruby :expect_err => true
-
- expect(err).to eq("Warning: bundle_ruby will be deprecated in " \
- "Bundler 2.0.0.")
- end
- end
-
context "without patchlevel" do
it "returns the ruby version" do
gemfile <<-G