diff options
author | Andre Arko <andre@arko.net> | 2015-05-05 13:49:11 -0700 |
---|---|---|
committer | Samuel E. Giddins <segiddins@segiddins.me> | 2015-07-16 08:29:00 -0700 |
commit | fa3b59b9a3d2fbbd63741ce7a670b4d714bc423c (patch) | |
tree | 47e34609f1c269d15448eb73d77c7508b82b1e24 | |
parent | 7a9d981baf88c3578f6afcb2a391641d5b5f3d8b (diff) | |
download | bundler-fa3b59b9a3d2fbbd63741ce7a670b4d714bc423c.tar.gz |
deprecate :bitbucket and :gist for 2.0
-rw-r--r-- | lib/bundler/dsl.rb | 17 | ||||
-rw-r--r-- | spec/deprecation_spec.rb | 33 |
2 files changed, 49 insertions, 1 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 750c549d94..b53903b0cf 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -216,9 +216,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" @@ -365,6 +371,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 9fbed885b6..aa818dfe65 100644 --- a/spec/deprecation_spec.rb +++ b/spec/deprecation_spec.rb @@ -55,4 +55,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 |