dependabot-bundler 0.280.0 → 0.282.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dependabot/bundler/helpers.rb +1 -13
  3. data/lib/dependabot/bundler/package_manager.rb +6 -6
  4. data/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb +1 -2
  5. metadata +12 -37
  6. data/helpers/v1/.gitignore +0 -8
  7. data/helpers/v1/Gemfile +0 -7
  8. data/helpers/v1/build +0 -29
  9. data/helpers/v1/lib/functions/conflicting_dependency_resolver.rb +0 -89
  10. data/helpers/v1/lib/functions/dependency_source.rb +0 -90
  11. data/helpers/v1/lib/functions/file_parser.rb +0 -119
  12. data/helpers/v1/lib/functions/force_updater.rb +0 -173
  13. data/helpers/v1/lib/functions/lockfile_updater.rb +0 -218
  14. data/helpers/v1/lib/functions/version_resolver.rb +0 -141
  15. data/helpers/v1/lib/functions.rb +0 -172
  16. data/helpers/v1/monkey_patches/definition_bundler_version_patch.rb +0 -16
  17. data/helpers/v1/monkey_patches/definition_ruby_version_patch.rb +0 -22
  18. data/helpers/v1/monkey_patches/fileutils_keyword_splat_patch.rb +0 -20
  19. data/helpers/v1/monkey_patches/git_source_patch.rb +0 -62
  20. data/helpers/v1/monkey_patches/object_untaint_patch.rb +0 -17
  21. data/helpers/v1/monkey_patches/resolver_spec_group_sane_eql.rb +0 -18
  22. data/helpers/v1/patched_bundler +0 -34
  23. data/helpers/v1/run.rb +0 -38
  24. data/helpers/v1/spec/functions/conflicting_dependency_resolver_spec.rb +0 -118
  25. data/helpers/v1/spec/functions/dependency_source_spec.rb +0 -188
  26. data/helpers/v1/spec/functions/file_parser_spec.rb +0 -75
  27. data/helpers/v1/spec/functions/force_updater_spec.rb +0 -59
  28. data/helpers/v1/spec/functions/version_resolver_spec.rb +0 -105
  29. data/helpers/v1/spec/native_spec_helper.rb +0 -56
  30. data/helpers/v1/spec/shared_contexts.rb +0 -60
@@ -1,105 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "native_spec_helper"
5
- require "shared_contexts"
6
-
7
- RSpec.describe Functions::VersionResolver do
8
- include_context "when in a temporary bundler directory"
9
- include_context "when stubbing rubygems compact index"
10
-
11
- let(:version_resolver) do
12
- described_class.new(
13
- dependency_name: dependency_name,
14
- dependency_requirements: dependency_requirements,
15
- gemfile_name: "Gemfile",
16
- lockfile_name: "Gemfile.lock"
17
- )
18
- end
19
-
20
- let(:dependency_name) { "business" }
21
- let(:dependency_requirements) do
22
- [{
23
- file: "Gemfile",
24
- requirement: requirement_string,
25
- groups: [],
26
- source: source
27
- }]
28
- end
29
- let(:source) { nil }
30
-
31
- let(:rubygems_url) { "https://index.rubygems.org/api/v1/" }
32
- let(:old_index_url) { rubygems_url + "dependencies" }
33
-
34
- describe "#version_details" do
35
- subject do
36
- in_tmp_folder { version_resolver.version_details }
37
- end
38
-
39
- let(:project_name) { "gemfile" }
40
- let(:requirement_string) { " >= 0" }
41
-
42
- its([:version]) { is_expected.to eq(Gem::Version.new("1.4.0")) }
43
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::CompactIndex") }
44
-
45
- context "with a private gemserver source" do
46
- include_context "when stubbing rubygems compact index"
47
-
48
- let(:project_name) { "specified_source" }
49
- let(:requirement_string) { ">= 0" }
50
-
51
- before do
52
- gemfury_url = "https://repo.fury.io/greysteil/"
53
- gemfury_deps_url = gemfury_url + "api/v1/dependencies"
54
-
55
- stub_request(:get, gemfury_url + "versions")
56
- .to_return(status: 200, body: fixture("ruby", "gemfury-index"))
57
- stub_request(:get, gemfury_url + "info/business").to_return(status: 404)
58
- stub_request(:get, gemfury_deps_url).to_return(status: 200)
59
- stub_request(:get, gemfury_deps_url + "?gems=business,statesman")
60
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
61
- stub_request(:get, gemfury_deps_url + "?gems=business")
62
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
63
- stub_request(:get, gemfury_deps_url + "?gems=statesman")
64
- .to_return(status: 200, body: fixture("ruby", "gemfury_response"))
65
- end
66
-
67
- its([:version]) { is_expected.to eq(Gem::Version.new("1.9.0")) }
68
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::Dependency") }
69
- end
70
-
71
- context "with a git source" do
72
- let(:project_name) { "git_source" }
73
-
74
- its([:version]) { is_expected.to eq(Gem::Version.new("1.6.0")) }
75
- its([:fetcher]) { is_expected.to be_nil }
76
- end
77
-
78
- context "when Bundler's compact index is down" do
79
- before do
80
- stub_request(:get, "https://index.rubygems.org/versions")
81
- .to_return(status: 500, body: "We'll be back soon")
82
- stub_request(:get, "https://index.rubygems.org/info/public_suffix")
83
- .to_return(status: 500, body: "We'll be back soon")
84
- stub_request(:get, old_index_url).to_return(status: 200)
85
- stub_request(:get, old_index_url + "?gems=business,statesman")
86
- .to_return(
87
- status: 200,
88
- body: fixture("rubygems_responses",
89
- "dependencies-default-gemfile")
90
- )
91
- end
92
-
93
- its([:version]) { is_expected.to eq(Gem::Version.new("1.4.0")) }
94
- its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::Dependency") }
95
- end
96
-
97
- context "with no update possible due to a version conflict" do
98
- let(:project_name) { "version_conflict_with_listed_subdep" }
99
- let(:dependency_name) { "rspec-mocks" }
100
- let(:requirement_string) { ">= 0" }
101
-
102
- its([:version]) { is_expected.to eq(Gem::Version.new("3.6.0")) }
103
- end
104
- end
105
- end
@@ -1,56 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "rspec/its"
5
- require "webmock/rspec"
6
- require "tmpdir"
7
-
8
- $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
9
- $LOAD_PATH.unshift(File.expand_path("../monkey_patches", __dir__))
10
- $LOAD_PATH.unshift(File.expand_path("../../spec_helpers", __dir__))
11
-
12
- # Bundler monkey patches
13
- require "definition_ruby_version_patch"
14
- require "definition_bundler_version_patch"
15
- require "fileutils_keyword_splat_patch"
16
- require "git_source_patch"
17
- require "resolver_spec_group_sane_eql"
18
-
19
- require "functions"
20
-
21
- require "gem_net_http_adapter"
22
-
23
- RSpec.configure do |config|
24
- config.color = true
25
- config.order = :rand
26
- config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
27
- config.raise_errors_for_deprecations!
28
- end
29
-
30
- # Duplicated in lib/dependabot/bundler/file_updater/lockfile_updater.rb
31
- # TODO: Stop sanitizing the lockfile once we have bundler 2 installed
32
- LOCKFILE_ENDING = /(?<ending>\s*(?:RUBY VERSION|BUNDLED WITH).*)/m
33
-
34
- def project_dependency_files(project)
35
- project_path = File.expand_path(File.join("../../spec/fixtures/projects/bundler1", project))
36
-
37
- raise "Fixture does not exist for project: '#{project}'" unless Dir.exist?(project_path)
38
-
39
- Dir.chdir(project_path) do
40
- # NOTE: Include dotfiles (e.g. .npmrc)
41
- files = Dir.glob("**/*", File::FNM_DOTMATCH)
42
- files = files.select { |f| File.file?(f) }
43
- files.map do |filename|
44
- content = File.read(filename)
45
- content = content.gsub(LOCKFILE_ENDING, "") if filename == "Gemfile.lock"
46
- {
47
- name: filename,
48
- content: content
49
- }
50
- end
51
- end
52
- end
53
-
54
- def fixture(*name)
55
- File.read(File.join("../../spec/fixtures", File.join(*name)))
56
- end
@@ -1,60 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- require "bundler/compact_index_client"
5
- require "bundler/compact_index_client/updater"
6
-
7
- TMP_DIR_PATH = File.expand_path("../tmp", __dir__)
8
-
9
- RSpec.shared_context "when in a temporary bundler directory" do
10
- let(:project_name) { "gemfile" }
11
-
12
- let(:tmp_path) do
13
- FileUtils.mkdir_p(TMP_DIR_PATH)
14
- dir = Dir.mktmpdir("native_helper_spec_", TMP_DIR_PATH)
15
- Pathname.new(dir).expand_path
16
- end
17
-
18
- before do
19
- project_dependency_files(project_name).each do |file|
20
- File.write(File.join(tmp_path, file[:name]), file[:content])
21
- end
22
- end
23
-
24
- def in_tmp_folder(&block)
25
- Dir.chdir(tmp_path, &block)
26
- end
27
- end
28
-
29
- RSpec.shared_context "without caching rubygems" do
30
- before do
31
- # Stub Bundler to stop it using a cached versions of Rubygems
32
- allow_any_instance_of(Bundler::CompactIndexClient::Updater)
33
- .to receive(:etag_for).and_return("")
34
- end
35
- end
36
-
37
- RSpec.shared_context "when stubbing rubygems compact index" do
38
- include_context "without caching rubygems"
39
-
40
- before do
41
- # Stub the Rubygems index
42
- stub_request(:get, "https://index.rubygems.org/versions")
43
- .to_return(
44
- status: 200,
45
- body: fixture("rubygems_responses", "index")
46
- )
47
-
48
- # Stub the Rubygems response for each dependency we have a fixture for
49
- fixtures =
50
- Dir[File.join("../../spec", "fixtures", "rubygems_responses", "info-*")]
51
- fixtures.each do |path|
52
- dep_name = path.split("/").last.gsub("info-", "")
53
- stub_request(:get, "https://index.rubygems.org/info/#{dep_name}")
54
- .to_return(
55
- status: 200,
56
- body: fixture("rubygems_responses", "info-#{dep_name}")
57
- )
58
- end
59
- end
60
- end