dependabot-bundler 0.257.0 → 0.259.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/v1/spec/functions/conflicting_dependency_resolver_spec.rb +2 -2
- data/helpers/v1/spec/functions/dependency_source_spec.rb +7 -7
- data/helpers/v1/spec/functions/file_parser_spec.rb +5 -5
- data/helpers/v1/spec/functions/force_updater_spec.rb +2 -2
- data/helpers/v1/spec/functions/version_resolver_spec.rb +3 -3
- data/helpers/v1/spec/shared_contexts.rb +2 -2
- data/helpers/v2/monkey_patches/definition_bundler_spec_set_patch.rb +23 -0
- data/helpers/v2/run.rb +1 -0
- data/helpers/v2/spec/definition_bundler_spec_set_patch_spec.rb +68 -0
- data/helpers/v2/spec/functions/conflicting_dependency_resolver_spec.rb +2 -2
- data/helpers/v2/spec/functions/dependency_source_spec.rb +7 -7
- data/helpers/v2/spec/functions/file_parser_spec.rb +5 -5
- data/helpers/v2/spec/functions/force_updater_spec.rb +2 -2
- data/helpers/v2/spec/functions/version_resolver_spec.rb +3 -3
- data/helpers/v2/spec/functions_spec.rb +3 -2
- data/helpers/v2/spec/native_spec_helper.rb +1 -0
- data/helpers/v2/spec/ruby_version_spec.rb +4 -2
- data/helpers/v2/spec/shared_contexts.rb +2 -2
- data/lib/dependabot/bundler/file_fetcher.rb +8 -3
- data/lib/dependabot/bundler/file_parser/file_preparer.rb +6 -1
- data/lib/dependabot/bundler/file_parser.rb +1 -1
- data/lib/dependabot/bundler/file_updater/lockfile_updater.rb +13 -1
- data/lib/dependabot/bundler/file_updater.rb +1 -1
- data/lib/dependabot/bundler/update_checker/file_preparer.rb +6 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cf058014268b3cfec697930e773369e1f2f1edfe1b4cd6a4c43a33af020a3a6
|
4
|
+
data.tar.gz: ef3f4b5ccd9bed22f52b4408d2097ee0709089db43baa21763a8093d684f69ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1699556eb7cdf17c530f580620f88f14452c750e6ba426dbe192a885a0d029ad054d7304378a482deca2e09d988fee7db8f4ec17719cbadd83ceb89aede7828f
|
7
|
+
data.tar.gz: 70e5f1f22cb8ae1025fda30e255222daf55f69a44944217aa640b440759908ba5700f09c8049b5d1fbc82979b9db13d8a783c297408ffb886ffe97ec0708fa78
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::ConflictingDependencyResolver do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:conflicting_dependency_resolver) do
|
11
11
|
described_class.new(
|
@@ -36,7 +36,7 @@ RSpec.describe Functions::ConflictingDependencyResolver do
|
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
-
context "
|
39
|
+
context "when dealing with nested transitive dependencies" do
|
40
40
|
let(:project_name) { "transitive_blocking" }
|
41
41
|
let(:dependency_name) { "activesupport" }
|
42
42
|
let(:target_version) { "6.0.0" }
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::DependencySource do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:dependency_source) do
|
11
11
|
described_class.new(
|
@@ -47,7 +47,7 @@ RSpec.describe Functions::DependencySource do
|
|
47
47
|
])
|
48
48
|
end
|
49
49
|
|
50
|
-
context "specified as the default source" do
|
50
|
+
context "when specified as the default source" do
|
51
51
|
let(:project_name) { "specified_default_source_no_lockfile" }
|
52
52
|
|
53
53
|
it "returns all versions from the private source" do
|
@@ -59,7 +59,7 @@ RSpec.describe Functions::DependencySource do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
context "
|
62
|
+
context "when we don't have authentication details for" do
|
63
63
|
before do
|
64
64
|
stub_request(:get, registry_url + "versions")
|
65
65
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -83,7 +83,7 @@ RSpec.describe Functions::DependencySource do
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
context "
|
86
|
+
context "when we have bad authentication details" do
|
87
87
|
before do
|
88
88
|
stub_request(:get, registry_url + "versions")
|
89
89
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -107,7 +107,7 @@ RSpec.describe Functions::DependencySource do
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
context "
|
110
|
+
context "when bad-requested, but is a private repo" do
|
111
111
|
before do
|
112
112
|
stub_request(:get, registry_url + "versions")
|
113
113
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -130,7 +130,7 @@ RSpec.describe Functions::DependencySource do
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
-
context "
|
133
|
+
context "when it doesn't have details of the gem" do
|
134
134
|
before do
|
135
135
|
stub_request(:get, gemfury_business_url)
|
136
136
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -152,7 +152,7 @@ RSpec.describe Functions::DependencySource do
|
|
152
152
|
it { is_expected.to be_empty }
|
153
153
|
end
|
154
154
|
|
155
|
-
context "
|
155
|
+
context "when it only implements the old Bundler index format" do
|
156
156
|
let(:project_name) { "sidekiq_pro" }
|
157
157
|
let(:dependency_name) { "sidekiq-pro" }
|
158
158
|
let(:registry_url) { "https://gems.contribsys.com/" }
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::FileParser do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:dependency_source) do
|
11
11
|
described_class.new(
|
@@ -14,14 +14,14 @@ RSpec.describe Functions::FileParser do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#parsed_gemfile" do
|
17
|
-
let(:project_name) { "gemfile" }
|
18
|
-
|
19
17
|
subject(:parsed_gemfile) do
|
20
18
|
in_tmp_folder do
|
21
19
|
dependency_source.parsed_gemfile(gemfile_name: "Gemfile")
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
23
|
+
let(:project_name) { "gemfile" }
|
24
|
+
|
25
25
|
it "parses gemfile" do
|
26
26
|
parsed_gemfile = [
|
27
27
|
{
|
@@ -44,14 +44,14 @@ RSpec.describe Functions::FileParser do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "#parsed_gemspec" do
|
47
|
-
let(:project_name) { "gemfile_exact" }
|
48
|
-
|
49
47
|
subject(:parsed_gemspec) do
|
50
48
|
in_tmp_folder do |_tmp_path|
|
51
49
|
dependency_source.parsed_gemspec(gemspec_name: "example.gemspec")
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
53
|
+
let(:project_name) { "gemfile_exact" }
|
54
|
+
|
55
55
|
it "parses gemspec" do
|
56
56
|
parsed_gemspec = [
|
57
57
|
{
|
@@ -5,8 +5,8 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::ForceUpdater do
|
8
|
-
include_context "in a temporary bundler directory"
|
9
|
-
include_context "
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
|
+
include_context "when stubbing rubygems compact index"
|
10
10
|
|
11
11
|
let(:force_updater) do
|
12
12
|
described_class.new(
|
@@ -5,8 +5,8 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::VersionResolver do
|
8
|
-
include_context "in a temporary bundler directory"
|
9
|
-
include_context "
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
|
+
include_context "when stubbing rubygems compact index"
|
10
10
|
|
11
11
|
let(:version_resolver) do
|
12
12
|
described_class.new(
|
@@ -43,7 +43,7 @@ RSpec.describe Functions::VersionResolver do
|
|
43
43
|
its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::CompactIndex") }
|
44
44
|
|
45
45
|
context "with a private gemserver source" do
|
46
|
-
include_context "
|
46
|
+
include_context "when stubbing rubygems compact index"
|
47
47
|
|
48
48
|
let(:project_name) { "specified_source" }
|
49
49
|
let(:requirement_string) { ">= 0" }
|
@@ -6,7 +6,7 @@ require "bundler/compact_index_client/updater"
|
|
6
6
|
|
7
7
|
TMP_DIR_PATH = File.expand_path("../tmp", __dir__)
|
8
8
|
|
9
|
-
RSpec.shared_context "in a temporary bundler directory" do
|
9
|
+
RSpec.shared_context "when in a temporary bundler directory" do
|
10
10
|
let(:project_name) { "gemfile" }
|
11
11
|
|
12
12
|
let(:tmp_path) do
|
@@ -34,7 +34,7 @@ RSpec.shared_context "without caching rubygems" do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
RSpec.shared_context "
|
37
|
+
RSpec.shared_context "when stubbing rubygems compact index" do
|
38
38
|
include_context "without caching rubygems"
|
39
39
|
|
40
40
|
before do
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/spec_set"
|
5
|
+
|
6
|
+
# monkey patch materialized_for_all_platforms for lazy specification issue resolution
|
7
|
+
# https://github.com/dependabot/dependabot-core/pull/9807
|
8
|
+
module BundlerSpecSetPatch
|
9
|
+
def materialized_for_all_platforms
|
10
|
+
@specs.map do |s|
|
11
|
+
next s unless s.is_a?(Bundler::LazySpecification)
|
12
|
+
|
13
|
+
s.source.cached!
|
14
|
+
s.source.remote!
|
15
|
+
spec = s.materialize_for_installation
|
16
|
+
raise Bundler::GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
17
|
+
|
18
|
+
spec
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Bundler::SpecSet.prepend(BundlerSpecSetPatch)
|
data/helpers/v2/run.rb
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# rubocop:disable RSpec/FilePath
|
5
|
+
# rubocop:disable RSpec/SpecFilePathFormat
|
6
|
+
|
7
|
+
require "native_spec_helper"
|
8
|
+
require "shared_contexts"
|
9
|
+
require "bundler/spec_set"
|
10
|
+
|
11
|
+
RSpec.describe Bundler::SpecSet do
|
12
|
+
let(:primary_source) { instance_double(Bundler::Source::Git) }
|
13
|
+
let(:secondary_source) { instance_double(Bundler::Source::Path) }
|
14
|
+
let(:primary_spec_set) do
|
15
|
+
instance_double(Bundler::LazySpecification, full_name: "foo-1.0.0-x86_64-linux", source: primary_source)
|
16
|
+
end
|
17
|
+
let(:secondary_spec_set) do
|
18
|
+
instance_double(Bundler::LazySpecification, full_name: "foo-1.0.0-arm64-darwin", source: secondary_source)
|
19
|
+
end
|
20
|
+
|
21
|
+
before do
|
22
|
+
allow(primary_spec_set).to receive(:is_a?).with(Bundler::LazySpecification).and_return(true)
|
23
|
+
allow(secondary_spec_set).to receive(:is_a?).with(Bundler::LazySpecification).and_return(true)
|
24
|
+
|
25
|
+
allow(primary_source).to receive(:cached!)
|
26
|
+
allow(primary_source).to receive(:remote!)
|
27
|
+
allow(secondary_source).to receive(:cached!)
|
28
|
+
allow(secondary_source).to receive(:remote!)
|
29
|
+
|
30
|
+
allow(primary_spec_set).to receive(:materialize_for_installation).and_return(primary_spec_set)
|
31
|
+
allow(secondary_spec_set).to receive(:materialize_for_installation).and_return(secondary_spec_set)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#materialized_for_all_platforms" do
|
35
|
+
context "when cache_all_platforms is enabled" do
|
36
|
+
let(:spec_set) { described_class.new([primary_spec_set, secondary_spec_set]) }
|
37
|
+
|
38
|
+
before do
|
39
|
+
described_class.prepend(BundlerSpecSetPatch)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "uses cached gems for secondary sources" do
|
43
|
+
expect(primary_spec_set.source).to receive(:cached!).ordered
|
44
|
+
expect(primary_spec_set.source).to receive(:remote!).ordered
|
45
|
+
expect(primary_spec_set).to receive(:materialize_for_installation).and_return(primary_spec_set).ordered
|
46
|
+
|
47
|
+
expect(secondary_spec_set.source).to receive(:cached!).ordered
|
48
|
+
expect(secondary_spec_set.source).to receive(:remote!).ordered
|
49
|
+
expect(secondary_spec_set).to receive(:materialize_for_installation).and_return(secondary_spec_set).ordered
|
50
|
+
|
51
|
+
result = spec_set.materialized_for_all_platforms
|
52
|
+
expect(result).to include(primary_spec_set, secondary_spec_set)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "raises an error if a gem cannot be found in any of the sources" do
|
56
|
+
allow(primary_spec_set).to receive(:materialize_for_installation).and_return(nil)
|
57
|
+
|
58
|
+
expect do
|
59
|
+
spec_set.materialized_for_all_platforms
|
60
|
+
end.to raise_error(Bundler::GemNotFound,
|
61
|
+
"Could not find foo-1.0.0-x86_64-linux in any of the sources")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# rubocop:enable RSpec/FilePath
|
68
|
+
# rubocop:enable RSpec/SpecFilePathFormat
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::ConflictingDependencyResolver do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:conflicting_dependency_resolver) do
|
11
11
|
described_class.new(
|
@@ -36,7 +36,7 @@ RSpec.describe Functions::ConflictingDependencyResolver do
|
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
-
context "
|
39
|
+
context "when dealing with nested transitive dependencies" do
|
40
40
|
let(:project_name) { "transitive_blocking" }
|
41
41
|
let(:dependency_name) { "activesupport" }
|
42
42
|
let(:target_version) { "6.0.0" }
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::DependencySource do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:dependency_source) do
|
11
11
|
described_class.new(
|
@@ -47,7 +47,7 @@ RSpec.describe Functions::DependencySource do
|
|
47
47
|
])
|
48
48
|
end
|
49
49
|
|
50
|
-
context "specified as the default source" do
|
50
|
+
context "when specified as the default source" do
|
51
51
|
let(:project_name) { "specified_default_source_no_lockfile" }
|
52
52
|
|
53
53
|
it "returns all versions from the private source" do
|
@@ -59,7 +59,7 @@ RSpec.describe Functions::DependencySource do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
context "
|
62
|
+
context "when we don't have authentication details" do
|
63
63
|
before do
|
64
64
|
stub_request(:get, registry_url + "versions")
|
65
65
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -82,7 +82,7 @@ RSpec.describe Functions::DependencySource do
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
context "
|
85
|
+
context "when we have bad authentication details" do
|
86
86
|
before do
|
87
87
|
stub_request(:get, registry_url + "versions")
|
88
88
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -105,7 +105,7 @@ RSpec.describe Functions::DependencySource do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
context "
|
108
|
+
context "when there is a bad request but it's a private repo" do
|
109
109
|
before do
|
110
110
|
stub_request(:get, registry_url + "versions")
|
111
111
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -131,7 +131,7 @@ RSpec.describe Functions::DependencySource do
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
context "
|
134
|
+
context "when the gem details are not available" do
|
135
135
|
before do
|
136
136
|
stub_request(:get, gemfury_business_url)
|
137
137
|
.with(basic_auth: ["SECRET_CODES", ""])
|
@@ -153,7 +153,7 @@ RSpec.describe Functions::DependencySource do
|
|
153
153
|
it { is_expected.to be_empty }
|
154
154
|
end
|
155
155
|
|
156
|
-
context "
|
156
|
+
context "when only the old Bundler index format is implemented" do
|
157
157
|
let(:project_name) { "sidekiq_pro" }
|
158
158
|
let(:dependency_name) { "sidekiq-pro" }
|
159
159
|
let(:registry_url) { "https://gems.contribsys.com/" }
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::FileParser do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
let(:dependency_source) do
|
11
11
|
described_class.new(
|
@@ -14,14 +14,14 @@ RSpec.describe Functions::FileParser do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#parsed_gemfile" do
|
17
|
-
let(:project_name) { "gemfile" }
|
18
|
-
|
19
17
|
subject(:parsed_gemfile) do
|
20
18
|
in_tmp_folder do
|
21
19
|
dependency_source.parsed_gemfile(gemfile_name: "Gemfile")
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
23
|
+
let(:project_name) { "gemfile" }
|
24
|
+
|
25
25
|
it "parses gemfile" do
|
26
26
|
parsed_gemfile = [
|
27
27
|
{
|
@@ -109,14 +109,14 @@ RSpec.describe Functions::FileParser do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "#parsed_gemspec" do
|
112
|
-
let(:project_name) { "gemfile_exact" }
|
113
|
-
|
114
112
|
subject(:parsed_gemspec) do
|
115
113
|
in_tmp_folder do |_tmp_path|
|
116
114
|
dependency_source.parsed_gemspec(gemspec_name: "example.gemspec")
|
117
115
|
end
|
118
116
|
end
|
119
117
|
|
118
|
+
let(:project_name) { "gemfile_exact" }
|
119
|
+
|
120
120
|
it "parses gemspec" do
|
121
121
|
parsed_gemspec = [
|
122
122
|
{
|
@@ -5,8 +5,8 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::ForceUpdater do
|
8
|
-
include_context "in a temporary bundler directory"
|
9
|
-
include_context "
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
|
+
include_context "when stubbing rubygems compact index"
|
10
10
|
|
11
11
|
let(:force_updater) do
|
12
12
|
described_class.new(
|
@@ -5,8 +5,8 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions::VersionResolver do
|
8
|
-
include_context "in a temporary bundler directory"
|
9
|
-
include_context "
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
|
+
include_context "when stubbing rubygems compact index"
|
10
10
|
|
11
11
|
let(:version_resolver) do
|
12
12
|
described_class.new(
|
@@ -52,7 +52,7 @@ RSpec.describe Functions::VersionResolver do
|
|
52
52
|
its([:fetcher]) { is_expected.to eq("Bundler::Fetcher::CompactIndex") }
|
53
53
|
|
54
54
|
context "with a private gemserver source" do
|
55
|
-
include_context "
|
55
|
+
include_context "when stubbing rubygems compact index"
|
56
56
|
|
57
57
|
let(:project_name) { "specified_source" }
|
58
58
|
let(:requirement_string) { ">= 0" }
|
@@ -5,7 +5,7 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe Functions do
|
8
|
-
include_context "in a temporary bundler directory"
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
9
|
|
10
10
|
describe "#jfrog_source" do
|
11
11
|
let(:project_name) { "jfrog_source" }
|
@@ -24,7 +24,6 @@ RSpec.describe Functions do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "#git_specs" do
|
27
|
-
let(:project_name) { "git_source" }
|
28
27
|
subject(:git_specs) do
|
29
28
|
in_tmp_folder do
|
30
29
|
Functions.git_specs(
|
@@ -35,6 +34,8 @@ RSpec.describe Functions do
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
37
|
+
let(:project_name) { "git_source" }
|
38
|
+
|
38
39
|
def expect_specs(count)
|
39
40
|
expect(git_specs.size).to eq(count)
|
40
41
|
git_specs.each do |gs|
|
@@ -12,6 +12,7 @@ $LOAD_PATH.unshift(File.expand_path("../../spec_helpers", __dir__))
|
|
12
12
|
# Bundler monkey patches
|
13
13
|
require "definition_ruby_version_patch"
|
14
14
|
require "definition_bundler_version_patch"
|
15
|
+
require "definition_bundler_spec_set_patch"
|
15
16
|
require "git_source_patch"
|
16
17
|
|
17
18
|
require "functions"
|
@@ -5,14 +5,16 @@ require "native_spec_helper"
|
|
5
5
|
require "shared_contexts"
|
6
6
|
|
7
7
|
RSpec.describe BundlerDefinitionRubyVersionPatch do
|
8
|
-
include_context "in a temporary bundler directory"
|
9
|
-
include_context "
|
8
|
+
include_context "when in a temporary bundler directory"
|
9
|
+
include_context "when stubbing rubygems compact index"
|
10
10
|
|
11
11
|
let(:project_name) { "ruby_version_implied" }
|
12
|
+
|
12
13
|
before do
|
13
14
|
@ui = Bundler.ui
|
14
15
|
Bundler.ui = Bundler::UI::Silent.new
|
15
16
|
end
|
17
|
+
|
16
18
|
after { Bundler.ui = @ui }
|
17
19
|
|
18
20
|
it "updates to the most recent version" do
|
@@ -7,7 +7,7 @@ require "bundler/compact_index_client/updater"
|
|
7
7
|
|
8
8
|
TMP_DIR_PATH = File.expand_path("../tmp", __dir__)
|
9
9
|
|
10
|
-
RSpec.shared_context "in a temporary bundler directory" do
|
10
|
+
RSpec.shared_context "when in a temporary bundler directory" do
|
11
11
|
let(:project_name) { "gemfile" }
|
12
12
|
|
13
13
|
let(:tmp_path) do
|
@@ -27,7 +27,7 @@ RSpec.shared_context "in a temporary bundler directory" do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
RSpec.shared_context "
|
30
|
+
RSpec.shared_context "when stubbing rubygems compact index" do
|
31
31
|
before do
|
32
32
|
# Stub the Rubygems index
|
33
33
|
stub_request(:get, "https://index.rubygems.org/versions")
|
@@ -45,6 +45,7 @@ module Dependabot
|
|
45
45
|
fetched_files += child_gemfiles
|
46
46
|
fetched_files += gemspecs
|
47
47
|
fetched_files << ruby_version_file if ruby_version_file
|
48
|
+
fetched_files << tool_versions_file if tool_versions_file
|
48
49
|
fetched_files += path_gemspecs
|
49
50
|
fetched_files += require_relative_files(fetched_files)
|
50
51
|
|
@@ -100,9 +101,13 @@ module Dependabot
|
|
100
101
|
def ruby_version_file
|
101
102
|
return unless gemfile
|
102
103
|
|
103
|
-
@ruby_version_file ||=
|
104
|
-
|
105
|
-
|
104
|
+
@ruby_version_file ||= fetch_support_file(".ruby-version")
|
105
|
+
end
|
106
|
+
|
107
|
+
def tool_versions_file
|
108
|
+
return unless gemfile
|
109
|
+
|
110
|
+
@tool_versions_file ||= fetch_support_file(".tool-versions")
|
106
111
|
end
|
107
112
|
|
108
113
|
def path_gemspecs
|
@@ -28,6 +28,7 @@ module Dependabot
|
|
28
28
|
*evaled_gemfiles,
|
29
29
|
lockfile,
|
30
30
|
ruby_version_file,
|
31
|
+
tool_versions_file,
|
31
32
|
*imported_ruby_files,
|
32
33
|
*specification_files
|
33
34
|
].compact
|
@@ -47,10 +48,10 @@ module Dependabot
|
|
47
48
|
.reject { |f| f.name.end_with?(".gemspec") }
|
48
49
|
.reject { |f| f.name.end_with?(".specification") }
|
49
50
|
.reject { |f| f.name.end_with?(".lock") }
|
50
|
-
.reject { |f| f.name.end_with?(".ruby-version") }
|
51
51
|
.reject { |f| f.name == "Gemfile" }
|
52
52
|
.reject { |f| f.name == "gems.rb" }
|
53
53
|
.reject { |f| f.name == "gems.locked" }
|
54
|
+
.reject(&:support_file?)
|
54
55
|
end
|
55
56
|
|
56
57
|
def specification_files
|
@@ -70,6 +71,10 @@ module Dependabot
|
|
70
71
|
dependency_files.find { |f| f.name == ".ruby-version" }
|
71
72
|
end
|
72
73
|
|
74
|
+
def tool_versions_file
|
75
|
+
dependency_files.find { |f| f.name == ".tool-versions" }
|
76
|
+
end
|
77
|
+
|
73
78
|
def imported_ruby_files
|
74
79
|
dependency_files
|
75
80
|
.select { |f| f.name.end_with?(".rb") }
|
@@ -245,10 +245,10 @@ module Dependabot
|
|
245
245
|
.reject { |f| f.name.end_with?(".gemspec") }
|
246
246
|
.reject { |f| f.name.end_with?(".specification") }
|
247
247
|
.reject { |f| f.name.end_with?(".lock") }
|
248
|
-
.reject { |f| f.name.end_with?(".ruby-version") }
|
249
248
|
.reject { |f| f.name == "Gemfile" }
|
250
249
|
.reject { |f| f.name == "gems.rb" }
|
251
250
|
.reject { |f| f.name == "gems.locked" }
|
251
|
+
.reject(&:support_file?)
|
252
252
|
end
|
253
253
|
|
254
254
|
def lockfile
|
@@ -96,6 +96,7 @@ module Dependabot
|
|
96
96
|
|
97
97
|
write_gemspecs(top_level_gemspecs)
|
98
98
|
write_ruby_version_file
|
99
|
+
write_tool_versions_file
|
99
100
|
write_gemspecs(path_gemspecs)
|
100
101
|
write_specification_files
|
101
102
|
write_imported_ruby_files
|
@@ -115,6 +116,14 @@ module Dependabot
|
|
115
116
|
File.write(path, ruby_version_file.content)
|
116
117
|
end
|
117
118
|
|
119
|
+
def write_tool_versions_file
|
120
|
+
return unless tool_versions_file
|
121
|
+
|
122
|
+
path = tool_versions_file.name
|
123
|
+
FileUtils.mkdir_p(Pathname.new(path).dirname)
|
124
|
+
File.write(path, tool_versions_file.content)
|
125
|
+
end
|
126
|
+
|
118
127
|
def write_gemspecs(files)
|
119
128
|
files.each do |file|
|
120
129
|
path = file.name
|
@@ -160,6 +169,10 @@ module Dependabot
|
|
160
169
|
dependency_files.find { |f| f.name == ".ruby-version" }
|
161
170
|
end
|
162
171
|
|
172
|
+
def tool_versions_file
|
173
|
+
dependency_files.find { |f| f.name == ".tool-versions" }
|
174
|
+
end
|
175
|
+
|
163
176
|
def post_process_lockfile(lockfile_body)
|
164
177
|
lockfile_body = reorder_git_dependencies(lockfile_body)
|
165
178
|
replace_lockfile_ending(lockfile_body)
|
@@ -269,7 +282,6 @@ module Dependabot
|
|
269
282
|
.reject { |f| f.name.end_with?(".gemspec") }
|
270
283
|
.reject { |f| f.name.end_with?(".specification") }
|
271
284
|
.reject { |f| f.name.end_with?(".lock") }
|
272
|
-
.reject { |f| f.name.end_with?(".ruby-version") }
|
273
285
|
.reject { |f| f.name == "Gemfile" }
|
274
286
|
.reject { |f| f.name == "gems.rb" }
|
275
287
|
.reject { |f| f.name == "gems.locked" }
|
@@ -127,10 +127,10 @@ module Dependabot
|
|
127
127
|
.reject { |f| f.name.end_with?(".gemspec") }
|
128
128
|
.reject { |f| f.name.end_with?(".specification") }
|
129
129
|
.reject { |f| f.name.end_with?(".lock") }
|
130
|
-
.reject { |f| f.name.end_with?(".ruby-version") }
|
131
130
|
.reject { |f| f.name == "Gemfile" }
|
132
131
|
.reject { |f| f.name == "gems.rb" }
|
133
132
|
.reject { |f| f.name == "gems.locked" }
|
133
|
+
.reject(&:support_file?)
|
134
134
|
end
|
135
135
|
|
136
136
|
def updated_gemfile_content(file)
|
@@ -94,6 +94,7 @@ module Dependabot
|
|
94
94
|
files += [
|
95
95
|
lockfile,
|
96
96
|
ruby_version_file,
|
97
|
+
tool_versions_file,
|
97
98
|
*imported_ruby_files,
|
98
99
|
*specification_files
|
99
100
|
].compact
|
@@ -130,10 +131,10 @@ module Dependabot
|
|
130
131
|
.reject { |f| f.name.end_with?(".gemspec") }
|
131
132
|
.reject { |f| f.name.end_with?(".specification") }
|
132
133
|
.reject { |f| f.name.end_with?(".lock") }
|
133
|
-
.reject { |f| f.name.end_with?(".ruby-version") }
|
134
134
|
.reject { |f| f.name == "Gemfile" }
|
135
135
|
.reject { |f| f.name == "gems.rb" }
|
136
136
|
.reject { |f| f.name == "gems.locked" }
|
137
|
+
.reject(&:support_file?)
|
137
138
|
end
|
138
139
|
|
139
140
|
def lockfile
|
@@ -154,6 +155,10 @@ module Dependabot
|
|
154
155
|
dependency_files.find { |f| f.name == ".ruby-version" }
|
155
156
|
end
|
156
157
|
|
158
|
+
def tool_versions_file
|
159
|
+
dependency_files.find { |f| f.name == ".tool-versions" }
|
160
|
+
end
|
161
|
+
|
157
162
|
def path_gemspecs
|
158
163
|
all = dependency_files.select { |f| f.name.end_with?(".gemspec") }
|
159
164
|
all - top_level_gemspecs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-bundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.259.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.259.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.259.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: parallel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,10 +292,12 @@ files:
|
|
292
292
|
- helpers/v2/lib/functions/force_updater.rb
|
293
293
|
- helpers/v2/lib/functions/lockfile_updater.rb
|
294
294
|
- helpers/v2/lib/functions/version_resolver.rb
|
295
|
+
- helpers/v2/monkey_patches/definition_bundler_spec_set_patch.rb
|
295
296
|
- helpers/v2/monkey_patches/definition_bundler_version_patch.rb
|
296
297
|
- helpers/v2/monkey_patches/definition_ruby_version_patch.rb
|
297
298
|
- helpers/v2/monkey_patches/git_source_patch.rb
|
298
299
|
- helpers/v2/run.rb
|
300
|
+
- helpers/v2/spec/definition_bundler_spec_set_patch_spec.rb
|
299
301
|
- helpers/v2/spec/functions/conflicting_dependency_resolver_spec.rb
|
300
302
|
- helpers/v2/spec/functions/dependency_source_spec.rb
|
301
303
|
- helpers/v2/spec/functions/file_parser_spec.rb
|
@@ -345,7 +347,7 @@ licenses:
|
|
345
347
|
- MIT
|
346
348
|
metadata:
|
347
349
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
348
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
350
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.259.0
|
349
351
|
post_install_message:
|
350
352
|
rdoc_options: []
|
351
353
|
require_paths:
|