Skip to content

Commit c2e81f8

Browse files
Fully switch to https sources
1 parent d72771b commit c2e81f8

File tree

6 files changed

+27
-96
lines changed

6 files changed

+27
-96
lines changed

bundler/lib/bundler/dsl.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,7 @@ def add_git_sources
291291
"https://github.com/#{repo_name}.git"
292292
RUBY
293293
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
294-
if Bundler.feature_flag.github_https?
295-
"https://github.com/#{repo_name}.git"
296-
else
297-
Bundler::SharedHelpers.major_deprecation 2, "Setting `github.https` to false is deprecated and won't be supported in the future."
298-
"git://github.com/#{repo_name}.git"
299-
end
294+
"https://github.com/#{repo_name}.git"
300295
end
301296

302297
git_source(:gist) do |repo_name|

bundler/lib/bundler/feature_flag.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def self.settings_method(name, key, &default)
4444
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
4545
settings_flag(:print_only_version_number) { bundler_3_mode? }
4646
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
47-
settings_flag(:skip_default_git_sources) { bundler_4_mode? }
47+
settings_flag(:skip_default_git_sources) { bundler_3_mode? }
4848
settings_flag(:specific_platform) { bundler_3_mode? }
4949
settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
5050
settings_flag(:unlock_source_unlocks_spec) { !bundler_3_mode? }
@@ -53,8 +53,6 @@ def self.settings_method(name, key, &default)
5353

5454
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }
5555

56-
settings_method(:github_https?, "github.https") { bundler_2_mode? }
57-
5856
def initialize(bundler_version)
5957
@bundler_version = Gem::Version.create(bundler_version)
6058
end

bundler/lib/bundler/settings.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class Settings
3333
frozen
3434
gem.coc
3535
gem.mit
36-
github.https
3736
global_path_appends_ruby_scope
3837
global_gem_cache
3938
ignore_messages

bundler/spec/bundler/dsl_spec.rb

Lines changed: 11 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -25,60 +25,17 @@
2525
expect { subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
2626
end
2727

28-
context "github_https feature flag" do
29-
it "is true when github.https is true" do
30-
bundle "config set github.https true"
31-
expect(Bundler.feature_flag.github_https?).to eq true
32-
end
33-
end
34-
35-
shared_examples_for "the github DSL" do |protocol|
36-
context "when full repo is used" do
37-
let(:repo) { "indirect/sparks" }
38-
39-
it "converts :github to URI using #{protocol}" do
40-
subject.gem("sparks", :github => repo)
41-
github_uri = "#{protocol}://github.com/#{repo}.git"
42-
expect(subject.dependencies.first.source.uri).to eq(github_uri)
43-
end
44-
end
45-
46-
context "when shortcut repo is used" do
47-
let(:repo) { "rails" }
48-
49-
it "converts :github to URI using #{protocol}" do
50-
subject.gem("sparks", :github => repo)
51-
github_uri = "#{protocol}://github.com/#{repo}/#{repo}.git"
52-
expect(subject.dependencies.first.source.uri).to eq(github_uri)
53-
end
54-
end
55-
end
56-
57-
context "default hosts (git, gist)" do
58-
context "when github.https config is true" do
59-
before { bundle "config set github.https true" }
60-
61-
it_behaves_like "the github DSL", "https"
62-
end
63-
64-
context "when github.https config is false", :bundler => "2" do
65-
before { bundle "config set github.https false" }
66-
67-
it_behaves_like "the github DSL", "git"
68-
end
69-
70-
context "when github.https config is false", :bundler => "3" do
71-
before { bundle "config set github.https false" }
72-
73-
pending "should show a proper message about the removed setting"
74-
end
75-
76-
context "by default", :bundler => "2" do
77-
it_behaves_like "the github DSL", "https"
28+
context "default hosts", :bundler => "2" do
29+
it "converts :github to URI using https" do
30+
subject.gem("sparks", :github => "indirect/sparks")
31+
github_uri = "https://github.com/indirect/sparks.git"
32+
expect(subject.dependencies.first.source.uri).to eq(github_uri)
7833
end
7934

80-
context "by default", :bundler => "3" do
81-
it_behaves_like "the github DSL", "https"
35+
it "converts :github shortcut to URI using https" do
36+
subject.gem("sparks", :github => "rails")
37+
github_uri = "https://github.com/rails/rails.git"
38+
expect(subject.dependencies.first.source.uri).to eq(github_uri)
8239
end
8340

8441
it "converts numeric :gist to :git" do
@@ -106,7 +63,7 @@
10663
end
10764
end
10865

109-
context "default git sources", :bundler => "4" do
66+
context "default git sources", :bundler => "3" do
11067
it "has none" do
11168
expect(subject.instance_variable_get(:@git_sources)).to eq({})
11269
end
@@ -285,7 +242,7 @@
285242
end
286243
end
287244

288-
describe "#github", :bundler => "3" do
245+
describe "#github", :bundler => "2" do
289246
it "from github" do
290247
spree_gems = %w[spree_core spree_api spree_backend]
291248
subject.github "spree" do
@@ -299,19 +256,6 @@
299256
end
300257

301258
describe "#github", :bundler => "3" do
302-
it "from github" do
303-
spree_gems = %w[spree_core spree_api spree_backend]
304-
subject.github "spree" do
305-
spree_gems.each {|spree_gem| subject.send :gem, spree_gem }
306-
end
307-
308-
subject.dependencies.each do |d|
309-
expect(d.source.uri).to eq("https://github.com/spree/spree.git")
310-
end
311-
end
312-
end
313-
314-
describe "#github", :bundler => "4" do
315259
it "from github" do
316260
expect do
317261
spree_gems = %w[spree_core spree_api spree_backend]

bundler/spec/other/major_deprecation_spec.rb

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -365,38 +365,30 @@
365365
end
366366

367367
describe Bundler::Dsl do
368-
let(:msg) do
369-
<<-EOS
370-
The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
371-
372-
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
373-
374-
EOS
375-
end
376-
377368
before do
378369
@rubygems = double("rubygems")
379370
allow(Bundler::Source::Rubygems).to receive(:new) { @rubygems }
380371
end
381372

382373
context "with github gems" do
383-
it "warns about the https change if people are opting out" do
384-
Bundler.settings.temporary "github.https" => false
385-
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
386-
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "Setting `github.https` to false is deprecated and won't be supported in the future.")
387-
subject.gem("sparks", :github => "indirect/sparks")
388-
end
374+
it "warns about removal", :bundler => "2" do
375+
msg = <<-EOS
376+
The :github git source is deprecated, and will be removed in the future. Change any "reponame" :github sources to "username/reponame". Add this code to the top of your Gemfile to ensure it continues to work:
377+
378+
git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" }
389379
390-
it "upgrades to https by default", :bundler => "2" do
380+
EOS
391381
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
392382
subject.gem("sparks", :github => "indirect/sparks")
393383
github_uri = "https://github.com/indirect/sparks.git"
394384
expect(subject.dependencies.first.source.uri).to eq(github_uri)
395385
end
386+
387+
pending "should fail with a helpful error", :bundler => "3"
396388
end
397389

398390
context "with bitbucket gems" do
399-
it "warns about removal" do
391+
it "warns about removal", :bundler => "2" do
400392
allow(Bundler.ui).to receive(:deprecate)
401393
msg = <<-EOS
402394
The :bitbucket git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
@@ -411,10 +403,12 @@
411403
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
412404
subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails")
413405
end
406+
407+
pending "should fail with a helpful error", :bundler => "3"
414408
end
415409

416410
context "with gist gems" do
417-
it "warns about removal" do
411+
it "warns about removal", :bundler => "2" do
418412
allow(Bundler.ui).to receive(:deprecate)
419413
msg = <<-EOS
420414
The :gist git source is deprecated, and will be removed in the future. Add this code to the top of your Gemfile to ensure it continues to work:
@@ -425,6 +419,8 @@
425419
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg)
426420
subject.gem("not-really-a-gem", :gist => "1234")
427421
end
422+
423+
pending "should fail with a helpful error", :bundler => "3"
428424
end
429425
end
430426

bundler/spec/quality_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ def check_for_specific_pronouns(filename)
173173
forget_cli_options
174174
gem.coc
175175
gem.mit
176-
github.https
177176
inline
178177
use_gem_version_promoter_for_major_updates
179178
]

0 commit comments

Comments
 (0)