diff options
author | Bundlerbot <bot@bundler.io> | 2018-11-26 23:09:40 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-11-27 21:28:34 +1100 |
commit | d9844e8d0f8d365c8750cf214a678602f29e4926 (patch) | |
tree | d481a7fa5c6e0298df1808abe68ce0eb28077dea | |
parent | 7e2ac2853bf88224fed9bff44d51356112bb1c06 (diff) | |
download | bundler-d9844e8d0f8d365c8750cf214a678602f29e4926.tar.gz |
Merge #6798
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 <me@colby.fyi>
(cherry picked from commit cf45792213fadf97f7aa6464de8ebd79f09725d2)
-rw-r--r-- | lib/bundler/feature_flag.rb | 2 | ||||
-rw-r--r-- | spec/bundler/dsl_spec.rb | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index e3266da8ab..e5b4e84063 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -61,6 +61,8 @@ module Bundler settings_option(:default_cli_command) { bundler_3_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 diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index dcc816eee2..94d54ad877 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -25,7 +25,23 @@ RSpec.describe Bundler::Dsl do 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 => "< 3" 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" |