summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-05-05 13:49:11 -0700
committerSamuel Giddins <segiddins@segiddins.me>2016-07-05 15:11:19 -0300
commitf428506bf086f6dcd536af8922aa922fb47b0321 (patch)
treea743e35bea21ad2c7f398707b4f293ca1936f6f7
parent1257acfe01c6f963d47d6552cbf4dbfc295550cc (diff)
downloadbundler-f428506bf086f6dcd536af8922aa922fb47b0321.tar.gz
deprecate :bitbucket and :gist for 2.0
-rw-r--r--lib/bundler/dsl.rb17
-rw-r--r--spec/deprecation_spec.rb33
2 files changed, 49 insertions, 1 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 04ef641b8e..6cd95dd63c 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -268,9 +268,15 @@ module Bundler
"git://github.com/#{repo_name}.git"
end
- git_source(:gist) {|repo_name| "https://gist.github.com/#{repo_name}.git" }
+ # TODO: 2.0 remove this deprecated git source
+ git_source(:gist) do |repo_name|
+ warn_deprecated_git_source(:gist, "https://gist.github.com/#{repo_name}.git")
+ "https://gist.github.com/#{repo_name}.git"
+ end
+ # TODO: 2.0 remove this deprecated git source
git_source(:bitbucket) do |repo_name|
+ warn_deprecated_git_source(:bitbucket, "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git")
user_name, repo_name = repo_name.split "/"
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
@@ -418,6 +424,15 @@ module Bundler
end
end
+ def warn_deprecated_git_source(name, repo_string)
+ # TODO: 2.0 remove deprecation
+ Bundler.ui.deprecate "The :#{name} git source is deprecated, and will be removed " \
+ "in Bundler 2.0. Add this code to your Gemfile to ensure it continues to work:\n" \
+ " git_source(:#{name}) do |repo_name|\n" \
+ " #{repo_string}\n" \
+ " end", true
+ end
+
class DSLError < GemfileError
# @return [String] the description that should be presented to the user.
#
diff --git a/spec/deprecation_spec.rb b/spec/deprecation_spec.rb
index 21cb9d72a4..d7fd228f6c 100644
--- a/spec/deprecation_spec.rb
+++ b/spec/deprecation_spec.rb
@@ -56,4 +56,37 @@ describe "Bundler version 1.99" do
"capistrano-bundler gem. Use it instead.")
end
end
+
+ describe Bundler::Dsl do
+ before do
+ @rubygems = double("rubygems")
+ allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems }
+ end
+
+ context "with bitbucket gems" do
+ it "warns about removal" do
+ allow(Bundler.ui).to receive(:deprecate)
+ msg = "The :bitbucket git source is deprecated, and will be removed " \
+ "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
+ "continues to work:\n git_source(:bitbucket) do |repo_name|\n " \
+ " https://\#{user_name}@bitbucket.org/\#{user_name}/\#{repo_name}" \
+ ".git\n end"
+ expect(Bundler.ui).to receive(:deprecate).with(msg, true)
+ subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
+ end
+ end
+
+ context "with gist gems" do
+ it "warns about removal" do
+ allow(Bundler.ui).to receive(:deprecate)
+ msg = "The :gist git source is deprecated, and will be removed " \
+ "in Bundler 2.0. Add this code to your Gemfile to ensure it " \
+ "continues to work:\n git_source(:gist) do |repo_name|\n " \
+ " https://gist.github.com/\#{repo_name}.git\n" \
+ " end"
+ expect(Bundler.ui).to receive(:deprecate).with(msg, true)
+ subject.gem("not-really-a-gem", :gist => "1234")
+ end
+ end
+ end
end