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

Commit

Permalink
Merge #6798
Browse files Browse the repository at this point in the history
6798: Use https in the Github shortcut by default in Bundler 2 r=colby-swandale a=colby-swandale

This PR is setting Git gems to be fetched over https by default.

Note: This PR is successing #6791 

Closes #6785 

Co-authored-by: Colby Swandale <[email protected]>
  • Loading branch information
bundlerbot and colby-swandale committed Nov 26, 2018
2 parents 07d22ae + 93471b0 commit cf45792
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
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? }

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

0 comments on commit cf45792

Please sign in to comment.