Skip to content

Commit

Permalink
Cancel deprecation of custom git sources
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Dec 7, 2021
1 parent 3444e7e commit 99cd6e0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 96 deletions.
27 changes: 0 additions & 27 deletions bundler/lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ def check_primary_source_safety

def add_git_sources
git_source(:github) do |repo_name|
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
"https://github.com/#{repo_name}.git"
RUBY
if repo_name =~ GITHUB_PULL_REQUEST_URL
{
"git" => "https://github.com/#{$1}.git",
Expand All @@ -294,18 +291,10 @@ def add_git_sources
end

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

git_source(:bitbucket) do |repo_name|
warn_deprecated_git_source(:bitbucket, <<-'RUBY'.strip)
user_name, repo_name = repo_name.split("/")
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
RUBY

user_name, repo_name = repo_name.split("/")
repo_name ||= user_name
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
Expand Down Expand Up @@ -490,22 +479,6 @@ def multiple_global_source_warning
end
end

def warn_deprecated_git_source(name, replacement, additional_message = nil)
additional_message &&= " #{additional_message}"
replacement = if replacement.count("\n").zero?
"{|repo_name| #{replacement} }"
else
"do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end"
end

Bundler::SharedHelpers.major_deprecation 3, <<-EOS
The :#{name} git source is deprecated, and will be removed in the future.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:#{name}) #{replacement}
EOS
end

class DSLError < GemfileError
# @return [String] the description that should be presented to the user.
#
Expand Down
69 changes: 0 additions & 69 deletions bundler/spec/other/major_deprecation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -534,75 +534,6 @@
pending "fails with a helpful error", :bundler => "3"
end

describe Bundler::Dsl do
before do
@rubygems = double("rubygems")
allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems }
end

context "with github gems" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end

it "warns about removal", :bundler => "3" do
msg = <<-EOS
The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
EOS
expect(Bundler.ui).to receive(:warn).with("[DEPRECATED] #{msg}")
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
end

context "with bitbucket gems" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end

it "warns about removal", :bundler => "3" do
msg = <<-EOS
The :bitbucket git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:bitbucket) do |repo_name|
user_name, repo_name = repo_name.split("/")
repo_name ||= user_name
"https://\#{user_name}@bitbucket.org/\#{user_name}/\#{repo_name}.git"
end
EOS
expect(Bundler.ui).to receive(:warn).with("[DEPRECATED] #{msg}")
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
end
end

context "with gist gems" do
it "does not warn about removal", :bundler => "< 3" do
expect(Bundler.ui).not_to receive(:warn)
subject.gem("not-really-a-gem", :gist => "1234")
end

it "warns about removal", :bundler => "3" do
msg = <<-EOS
The :gist git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
git_source(:gist) {|repo_name| "https://gist.github.com/\#{repo_name}.git" }
EOS
expect(Bundler.ui).to receive(:warn).with("[DEPRECATED] #{msg}")
subject.gem("not-really-a-gem", :gist => "1234")
end
end
end

context "bundle show" do
before do
install_gemfile <<-G
Expand Down

0 comments on commit 99cd6e0

Please sign in to comment.