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

set https to the default protocol for git #6791

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,8 @@ def add_git_sources
# "https://github.com/#{repo_name}.git"
# 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"]
Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed"
if Bundler.settings["github.https"] || Bundler.feature_flag.github_https_source?
Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will ba removed" if Bundler.settings["github.https"]
colby-swandale marked this conversation as resolved.
Show resolved Hide resolved
"https://github.com/#{repo_name}.git"
else
"git://github.com/#{repo_name}.git"
Expand Down
1 change: 1 addition & 0 deletions lib/bundler/feature_flag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def self.settings_method(name, key, &default)
settings_flag(:disable_multisource) { bundler_2_mode? }
settings_flag(:error_on_stderr) { bundler_2_mode? }
settings_flag(:forget_cli_options) { bundler_2_mode? }
settings_flag(:github_https_source) { bundler_2_mode? }
settings_flag(:global_path_appends_ruby_scope) { bundler_2_mode? }
settings_flag(:global_gem_cache) { bundler_2_mode? }
settings_flag(:init_gems_rb) { bundler_2_mode? }
Expand Down
1 change: 1 addition & 0 deletions lib/bundler/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Settings
frozen
gem.coc
gem.mit
github_https_source
global_path_appends_ruby_scope
global_gem_cache
ignore_messages
Expand Down
3 changes: 3 additions & 0 deletions man/bundle-config.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
relative paths in the `Gemfile`, among other things. By default, bundler
will search up from the current working directory until it finds a
`Gemfile`.
* `github_https_source` (`GITHUB_HTTPS_SOURCE`)
Set Bundler to use https by default when using the `github:` source in the
Gemfile
* `global_gem_cache` (`BUNDLE_GLOBAL_GEM_CACHE`):
Whether Bundler should cache all gems globally, rather than locally to the
installing Ruby installation.
Expand Down
14 changes: 12 additions & 2 deletions spec/bundler/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
end

context "default hosts (git, gist)", :bundler => "< 2" do
context "default hosts (git, gist)" do
# Note: There is a feature flag that will disabled these soruces by
colby-swandale marked this conversation as resolved.
Show resolved Hide resolved
# default
before { bundle "config skip_default_git_sources false" }

it "converts :github to :git" 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

it "converts :github to :git with git scheme", :bundler => "< 2" do
subject.gem("sparks", :github => "indirect/sparks")
github_uri = "git://github.com/indirect/sparks.git"
expect(subject.dependencies.first.source.uri).to eq(github_uri)
Expand All @@ -46,7 +56,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