Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,25 +290,11 @@ def add_git_sources
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
"https://github.com/#{repo_name}.git"
RUBY
# It would be better to use https instead of the git protocol, but this
# can break deployment of existing locked bundles when switching between
# different versions of Bundler. The change will be made in 2.0, which
# does not guarantee compatibility with the 1.x series.
#
# See https://github.com/bundler/bundler/pull/2569 for discussion
#
# This can be overridden by adding this code to your Gemfiles:
#
# git_source(:github) do |repo_name|
# repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
# "https://github.com/#{repo_name}.git"
# end
Comment thread
deivid-rodriguez marked this conversation as resolved.
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
# TODO: 2.0 upgrade this setting to the default
if Bundler.settings["github.https"]
Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed"
if Bundler.feature_flag.github_https?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"https://github.com/#{repo_name}.git"
else
Bundler::SharedHelpers.major_deprecation 3, "Setting `github.https` to false is deprecated and won't be supported in the future."
"git://github.com/#{repo_name}.git"
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/bundler/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

it "converts :github to :git" do
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "git://github.com/indirect/sparks.git"
github_uri = "https://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end

Expand All @@ -62,7 +62,7 @@

it "converts 'rails' to 'rails/rails'" do
subject.gem("rails", :github => "rails")
github_uri = "git://github.com/rails/rails.git"
github_uri = "https://github.com/rails/rails.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end

Expand Down Expand Up @@ -253,7 +253,7 @@
end

subject.dependencies.each do |d|
expect(d.source.uri).to eq("git://github.com/spree/spree.git")
expect(d.source.uri).to eq("https://github.com/spree/spree.git")
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/other/major_deprecation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@
subject.gem("sparks", :github => "indirect/sparks")
end

it "upgrades to https on request" do
Bundler.settings.temporary "github.https" => true
it "downgrades to http on request" do
Bundler.settings.temporary "github.https" => "false"
msg = <<-EOS
The :github git source is deprecated, and will be removed in Bundler 3.0. 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::SharedHelpers).to receive(:major_deprecation).with(3, msg)
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "The `github.https` setting will be removed")
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "Setting `github.https` to false is deprecated and won't be supported in the future.")
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "https://github.com/indirect/sparks.git"
github_uri = "git://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
end
end
Expand Down