Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Use https in the Github shortcut by default in Bundler 2 #6798

Merged
1 commit merged into from
Nov 26, 2018
Merged
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
2 changes: 1 addition & 1 deletion lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def add_git_sources
# end
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
# TODO: 2.0 upgrade this setting to the default
if Bundler.settings["github.https"]
if Bundler.feature_flag.github_https?
Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed"
"https://github.com/#{repo_name}.git"
else
Expand Down
2 changes: 2 additions & 0 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def self.settings_method(name, key, &default)

settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }

settings_method(:github_https?, "github.https") { bundler_2_mode? }
deivid-rodriguez marked this conversation as resolved.
Show resolved Hide resolved

def initialize(bundler_version)
@bundler_version = Gem::Version.create(bundler_version)
end
Expand Down
16 changes: 16 additions & 0 deletions spec/bundler/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,23 @@
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
end

context "github_https feature flag" do
it "is true when github.https is true" do
bundle "config github.https true"
expect(Bundler.feature_flag.github_https?).to eq "true"
end
end

context "default hosts (git, gist)", :bundler => "< 2" do
context "when github.https config is true" do
before { bundle "config github.https true" }
it "converts :github to :git using https" do
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

it "converts :github to :git" do
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "git://github.com/indirect/sparks.git"
Expand Down