dependabot-bundler 0.262.0 → 0.263.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/bundler/file_fetcher/path_gemspec_finder.rb +21 -9
- data/lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb +1 -1
- data/lib/dependabot/bundler/requirement.rb +5 -0
- data/lib/dependabot/bundler/update_checker/force_updater.rb +10 -3
- data/lib/dependabot/bundler/update_checker/requirements_updater.rb +2 -3
- data/lib/dependabot/bundler/update_checker.rb +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50457240c048f6430b4894d8f032b2eab8bbda90c88566bbbee21e6d4d29fcbe
|
4
|
+
data.tar.gz: c907811fc0c0ea30a9b9bb62f59c53182515b1cc94bf6e94d65899d588afa1cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f230c5e09b5cd4c5a6d92012a6a7590d6edeb22f0663a1f2bdc26911202360c4edbcb02304f2f128b4ce9e44ec763d19d2fac00bde79a0a5dc507addc768b8ff
|
7
|
+
data.tar.gz: eca4288984f2fe056f60c3147a20347f599e49294b8c9e66aae53069577ea8300c89a0085fbfc59528dbf53be28ee32289435f2f75f27038065c931f73cf576a
|
@@ -1,10 +1,11 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "pathname"
|
5
5
|
require "parser/current"
|
6
6
|
require "dependabot/bundler/file_fetcher"
|
7
7
|
require "dependabot/errors"
|
8
|
+
require "sorbet-runtime"
|
8
9
|
|
9
10
|
module Dependabot
|
10
11
|
module Bundler
|
@@ -12,36 +13,42 @@ module Dependabot
|
|
12
13
|
# Finds the paths of any gemspecs declared using `path: ` in the
|
13
14
|
# passed Gemfile.
|
14
15
|
class PathGemspecFinder
|
16
|
+
extend T::Sig
|
17
|
+
|
18
|
+
sig { params(gemfile: Dependabot::DependencyFile).void }
|
15
19
|
def initialize(gemfile:)
|
16
20
|
@gemfile = gemfile
|
17
21
|
end
|
18
22
|
|
23
|
+
sig { returns(T::Array[String]) }
|
19
24
|
def path_gemspec_paths
|
20
|
-
ast = Parser::CurrentRuby.parse(gemfile
|
25
|
+
ast = Parser::CurrentRuby.parse(gemfile&.content)
|
21
26
|
find_path_gemspec_paths(ast)
|
22
27
|
rescue Parser::SyntaxError
|
23
|
-
raise Dependabot::DependencyFileNotParseable, gemfile.path
|
28
|
+
raise Dependabot::DependencyFileNotParseable, T.must(gemfile).path
|
24
29
|
end
|
25
30
|
|
26
31
|
private
|
27
32
|
|
33
|
+
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
28
34
|
attr_reader :gemfile
|
29
35
|
|
36
|
+
sig { params(node: T.untyped).returns(T::Array[T.untyped]) }
|
30
37
|
def find_path_gemspec_paths(node)
|
31
38
|
return [] unless node.is_a?(Parser::AST::Node)
|
32
39
|
|
33
40
|
if declares_path_dependency?(node)
|
34
41
|
path_node = path_node_for_gem_declaration(node)
|
35
42
|
|
36
|
-
unless path_node
|
37
|
-
path = gemfile
|
43
|
+
unless path_node&.type == :str
|
44
|
+
path = gemfile&.path
|
38
45
|
msg = "Dependabot only supports uninterpolated string arguments " \
|
39
46
|
"for path dependencies. Got " \
|
40
|
-
"`#{path_node
|
41
|
-
raise Dependabot::DependencyFileNotParseable.new(path, msg)
|
47
|
+
"`#{path_node&.loc&.expression&.source}`"
|
48
|
+
raise Dependabot::DependencyFileNotParseable.new(T.must(path), msg)
|
42
49
|
end
|
43
50
|
|
44
|
-
path = path_node.loc.expression.source.gsub(/['"]/, "")
|
51
|
+
path = T.must(path_node).loc.expression.source.gsub(/['"]/, "")
|
45
52
|
return [clean_path(path)]
|
46
53
|
end
|
47
54
|
|
@@ -50,12 +57,14 @@ module Dependabot
|
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
60
|
+
sig { returns(T.nilable(String)) }
|
53
61
|
def current_dir
|
54
|
-
@current_dir ||= gemfile
|
62
|
+
@current_dir ||= T.let(gemfile&.name&.rpartition("/")&.first, T.nilable(String))
|
55
63
|
@current_dir = nil if @current_dir == ""
|
56
64
|
@current_dir
|
57
65
|
end
|
58
66
|
|
67
|
+
sig { params(node: Parser::AST::Node).returns(T::Boolean) }
|
59
68
|
def declares_path_dependency?(node)
|
60
69
|
return false unless node.is_a?(Parser::AST::Node)
|
61
70
|
return false unless node.children[1] == :gem
|
@@ -63,6 +72,7 @@ module Dependabot
|
|
63
72
|
!path_node_for_gem_declaration(node).nil?
|
64
73
|
end
|
65
74
|
|
75
|
+
sig { params(path: String).returns(Pathname) }
|
66
76
|
def clean_path(path)
|
67
77
|
if Pathname.new(path).absolute?
|
68
78
|
base_path = Pathname.new(File.expand_path(Dir.pwd))
|
@@ -72,6 +82,7 @@ module Dependabot
|
|
72
82
|
Pathname.new(path).cleanpath
|
73
83
|
end
|
74
84
|
|
85
|
+
sig { params(node: Parser::AST::Node).returns(T.nilable(Parser::AST::Node)) }
|
75
86
|
def path_node_for_gem_declaration(node)
|
76
87
|
return unless node.children.last.type == :hash
|
77
88
|
|
@@ -86,6 +97,7 @@ module Dependabot
|
|
86
97
|
path_hash_pair.children.last
|
87
98
|
end
|
88
99
|
|
100
|
+
sig { params(node: Parser::AST::Node).returns(Symbol) }
|
89
101
|
def key_from_hash_pair(node)
|
90
102
|
node.children.first.children.first.to_sym
|
91
103
|
end
|
@@ -12,7 +12,7 @@ module Dependabot
|
|
12
12
|
class RubyVersionNotFound < StandardError; end
|
13
13
|
|
14
14
|
RUBY_VERSIONS = %w(
|
15
|
-
1.8.7 1.9.3 2.0.0 2.1.10 2.2.10 2.3.8 2.4.10 2.5.9 2.6.9 2.7.6 3.0.6 3.1.4 3.2.2 3.3.
|
15
|
+
1.8.7 1.9.3 2.0.0 2.1.10 2.2.10 2.3.8 2.4.10 2.5.9 2.6.9 2.7.6 3.0.6 3.1.4 3.2.2 3.3.3
|
16
16
|
).freeze
|
17
17
|
|
18
18
|
attr_reader :gemspec
|
@@ -11,6 +11,11 @@ module Dependabot
|
|
11
11
|
class Requirement < Dependabot::Requirement
|
12
12
|
extend T::Sig
|
13
13
|
|
14
|
+
sig { params(req: T::Hash[Symbol, String], version: Gem::Version).returns(T::Boolean) }
|
15
|
+
def self.satisfied_by?(req, version)
|
16
|
+
new(req[:requirement]).satisfied_by?(version)
|
17
|
+
end
|
18
|
+
|
14
19
|
# For consistency with other languages, we define a requirements array.
|
15
20
|
# Ruby doesn't have an `OR` separator for requirements, so it always
|
16
21
|
# contains a single element.
|
@@ -51,6 +51,13 @@ module Dependabot
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def force_update
|
54
|
+
requirement = dependency.requirements.find { |req| req[:file] == gemfile.name }
|
55
|
+
manifest_requirement_not_satisfied = requirement && !Requirement.satisfied_by?(requirement, target_version)
|
56
|
+
|
57
|
+
if manifest_requirement_not_satisfied && requirements_update_strategy.lockfile_only?
|
58
|
+
raise Dependabot::DependencyFileNotResolvable
|
59
|
+
end
|
60
|
+
|
54
61
|
in_a_native_bundler_context(error_handling: false) do |tmp_dir|
|
55
62
|
updated_deps, specs = NativeHelpers.run_bundler_subprocess(
|
56
63
|
bundler_version: bundler_version,
|
@@ -67,10 +74,10 @@ module Dependabot
|
|
67
74
|
}
|
68
75
|
)
|
69
76
|
dependencies_from(updated_deps, specs)
|
77
|
+
rescue SharedHelpers::HelperSubprocessFailed => e
|
78
|
+
msg = e.error_class + " with message: " + e.message
|
79
|
+
raise Dependabot::DependencyFileNotResolvable, msg
|
70
80
|
end
|
71
|
-
rescue SharedHelpers::HelperSubprocessFailed => e
|
72
|
-
msg = e.error_class + " with message: " + e.message
|
73
|
-
raise Dependabot::DependencyFileNotResolvable, msg
|
74
81
|
end
|
75
82
|
|
76
83
|
def original_dependencies
|
@@ -39,7 +39,7 @@ module Dependabot
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def updated_requirements
|
42
|
-
return requirements if update_strategy
|
42
|
+
return requirements if update_strategy.lockfile_only?
|
43
43
|
|
44
44
|
requirements.map do |req|
|
45
45
|
if req[:file].include?(".gemspec")
|
@@ -102,8 +102,7 @@ module Dependabot
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def new_version_satisfies?(req)
|
105
|
-
|
106
|
-
original_req.satisfied_by?(latest_resolvable_version)
|
105
|
+
Requirement.satisfied_by?(req, latest_resolvable_version)
|
107
106
|
end
|
108
107
|
|
109
108
|
def update_gemfile_range(requirements)
|
@@ -42,9 +42,9 @@ module Dependabot
|
|
42
42
|
lowest_fix =
|
43
43
|
latest_version_finder(remove_git_source: false)
|
44
44
|
.lowest_security_fix_version
|
45
|
-
return unless lowest_fix
|
45
|
+
return unless lowest_fix && resolvable?(lowest_fix)
|
46
46
|
|
47
|
-
|
47
|
+
lowest_fix
|
48
48
|
end
|
49
49
|
|
50
50
|
def latest_resolvable_version_with_no_unlock
|
@@ -77,7 +77,7 @@ module Dependabot
|
|
77
77
|
|
78
78
|
def requirements_unlocked_or_can_be?
|
79
79
|
return true if requirements_unlocked?
|
80
|
-
return false if requirements_update_strategy
|
80
|
+
return false if requirements_update_strategy.lockfile_only?
|
81
81
|
|
82
82
|
dependency.specific_requirements
|
83
83
|
.all? do |req|
|
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.263.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-06-
|
11
|
+
date: 2024-06-27 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.263.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.263.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: parallel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -345,7 +345,7 @@ licenses:
|
|
345
345
|
- MIT
|
346
346
|
metadata:
|
347
347
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
348
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
348
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.263.0
|
349
349
|
post_install_message:
|
350
350
|
rdoc_options: []
|
351
351
|
require_paths:
|