dependabot-common 0.145.2 → 0.147.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ac0eb6a686627e7b673437c5c1da1752c604c1d4efc639c10f20d45afc2476c
4
- data.tar.gz: e723d56fac036d1ceaffc0c6bf80ea9dddca274de51ead1c97dd3a4c1ad9b429
3
+ metadata.gz: 51c62db1008c6a6b0be171942883dbb464f0014fed382fae7267bc2b0c926765
4
+ data.tar.gz: 76c18bea324cd9f2ac42eccb8e0e0f41751d48a770cc37b9389daaee0674be2a
5
5
  SHA512:
6
- metadata.gz: 63058f60bf2d7f8697dcab17608f59dfccd5950cac1e68f61d44411d0854179e8de14508a77a885c29a6a06d4d7ac47d77d23772a476014b8400e78ad5c04f2e
7
- data.tar.gz: b9e36648341f0b0afa36bc3106ef5c3e090243186831ca1f37400719d0da653eb366d30fd7deff1fa6c9ab20cb3a86d32758626e77f17b08e9e500e508de8b15
6
+ metadata.gz: d5260d7ee42ffb5ecf8488b06b765a25584f48e99d61a2d08c0c28835561b7f2d7f3acf9e621d9188256cebbb9f4ab44c53b82c28e3110fd2feef19931f4be1e
7
+ data.tar.gz: 7e1e91c215dcf7fffb90a823ea0fab340662e429a04131a6aba3f02460f3cf53923794131933eb003f66bfc580f80d0f6b374bfa31f99fde35e8a3f16bdcc534
@@ -60,10 +60,10 @@ module Dependabot
60
60
  end
61
61
 
62
62
  def pinned_ref_looks_like_commit_sha?
63
- return false unless pinned?
64
-
65
63
  ref = dependency_source_details.fetch(:ref)
66
- return false unless ref.match?(/^[0-9a-f]{6,40}$/)
64
+ return false unless ref&.match?(/^[0-9a-f]{6,40}$/)
65
+
66
+ return false unless pinned?
67
67
 
68
68
  local_repo_git_metadata_fetcher.head_commit_for_ref(ref).nil?
69
69
  end
@@ -87,13 +87,16 @@ module Dependabot
87
87
  end
88
88
 
89
89
  # rubocop:disable Metrics/PerceivedComplexity
90
+ # rubocop:disable Metrics/AbcSize
90
91
  def local_tag_for_latest_version
91
92
  tags =
92
93
  local_tags.
93
94
  select { |t| version_tag?(t.name) && matches_existing_prefix?(t.name) }
94
95
  filtered = tags.
95
96
  reject { |t| tag_included_in_ignore_requirements?(t) }
96
- raise Dependabot::AllVersionsIgnored if @raise_on_ignored && tags.any? && filtered.empty?
97
+ if @raise_on_ignored && filter_lower_versions(filtered).empty? && filter_lower_versions(tags).any?
98
+ raise Dependabot::AllVersionsIgnored
99
+ end
97
100
 
98
101
  tag = filtered.
99
102
  reject { |t| tag_is_prerelease?(t) && !wants_prerelease? }.
@@ -113,8 +116,40 @@ module Dependabot
113
116
  tag_sha: tag.tag_sha
114
117
  }
115
118
  end
119
+ # rubocop:enable Metrics/AbcSize
116
120
  # rubocop:enable Metrics/PerceivedComplexity
117
121
 
122
+ def current_version
123
+ return unless dependency.version && version_tag?(dependency.version)
124
+
125
+ version = dependency.version.match(VERSION_REGEX).named_captures.fetch("version")
126
+ version_class.new(version)
127
+ end
128
+
129
+ def filter_lower_versions(tags)
130
+ return tags unless current_version
131
+
132
+ versions = tags.map do |t|
133
+ version = t.name.match(VERSION_REGEX).named_captures.fetch("version")
134
+ version_class.new(version)
135
+ end
136
+
137
+ versions.select do |version|
138
+ version > current_version
139
+ end
140
+ end
141
+
142
+ def local_tag_for_pinned_version
143
+ return unless pinned?
144
+
145
+ ref = dependency_source_details.fetch(:ref)
146
+ tags = local_tags.select { |t| t.commit_sha == ref && version_class.correct?(t.name) }.
147
+ sort_by { |t| version_class.new(t.name) }
148
+ return if tags.empty?
149
+
150
+ tags[-1].name
151
+ end
152
+
118
153
  def git_repo_reachable?
119
154
  local_upload_pack
120
155
  true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.145.2"
4
+ VERSION = "0.147.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.145.2
4
+ version: 0.147.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport