dependabot-common 0.143.0 → 0.143.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57330557c4c6b5c67064d741415cf5ec79dcb8f43bf9f3919048a3464260ab3c
4
- data.tar.gz: c2c2540484356b1beeb3b72dfff70a4d0da24ee20cfbeb4b9c2e465bdd4dc2e1
3
+ metadata.gz: 04061b64d2ec9c8ff56b799d8ea0c7426dadcca2701581f1917faa494ba3f76d
4
+ data.tar.gz: 1129318553b00a3e77274d84cff91987b9c2d20f69a57deb3f171eee4729555a
5
5
  SHA512:
6
- metadata.gz: ab1843750e40351dd4a63830cb45e466bda21006140c4b39540010b0cd00e30a09dec6bf08aa744a42e870d2693e09d861aed43b0ec59b0854910f4dfcdbde8f
7
- data.tar.gz: be02824d97291c474f1074e3070abf82fa1576bc9f5898fea338734bd4f11d811526bccb3888a3a279b893dec717fffe77fd7218b47d0b16025e3e680372109e
6
+ metadata.gz: 81049fffec22a52e685fd08d7f8afc8947f6cd66532491d4e16eb6420cd46ba0d65e863f5f11659968572c8bc6b8d3339601fffa57631ffeb0503823ba53e03d
7
+ data.tar.gz: '0955f36ca302e038b4dae7d97fd4f83d4ffa3a1cb1668eb353e16f7501851ba567c6b7eebf2bed72776343cf39a54116d326c45e2261320514a0c53d3e360aba'
@@ -20,7 +20,10 @@ module Dependabot
20
20
  u[:"package-ecosystem"] == package_ecosystem && u[:directory] == dir &&
21
21
  (target_branch.nil? || u[:"target-branch"] == target_branch)
22
22
  end
23
- Dependabot::Config::UpdateConfig.new(cfg)
23
+ Dependabot::Config::UpdateConfig.new(
24
+ ignore_conditions: ignore_conditions(cfg),
25
+ commit_message_options: commit_message_options(cfg)
26
+ )
24
27
  end
25
28
 
26
29
  PACKAGE_MANAGER_LOOKUP = {
@@ -49,6 +52,27 @@ module Dependabot
49
52
 
50
53
  File.new(updates: parsed[:updates], registries: parsed[:registries])
51
54
  end
55
+
56
+ private
57
+
58
+ def ignore_conditions(cfg)
59
+ ignores = cfg&.dig(:ignore) || []
60
+ ignores.map do |ic|
61
+ Dependabot::Config::UpdateConfig::IgnoreCondition.new(
62
+ dependency_name: ic[:"dependency-name"],
63
+ versions: ic[:versions]
64
+ )
65
+ end
66
+ end
67
+
68
+ def commit_message_options(cfg)
69
+ commit_message = cfg&.dig(:"commit-message") || {}
70
+ Dependabot::Config::UpdateConfig::CommitMessageOptions.new(
71
+ prefix: commit_message[:prefix],
72
+ prefix_development: commit_message[:"prefix-development"],
73
+ include: commit_message[:include]
74
+ )
75
+ end
52
76
  end
53
77
  end
54
78
  end
@@ -4,44 +4,48 @@ module Dependabot
4
4
  module Config
5
5
  # Configuration for a single ecosystem
6
6
  class UpdateConfig
7
- module Interval
8
- DAILY = "daily"
9
- WEEKLY = "weekly"
10
- MONTHLY = "monthly"
11
- end
7
+ attr_reader :commit_message_options
12
8
 
13
- def initialize(config)
14
- @config = config || {}
9
+ def initialize(ignore_conditions: nil, commit_message_options: nil)
10
+ @ignore_conditions = ignore_conditions || []
11
+ @commit_message_options = commit_message_options
15
12
  end
16
13
 
17
14
  def ignored_versions_for(dep)
18
- return [] unless @config[:ignore]
19
-
20
- @config[:ignore].
21
- select { |ic| ic[:"dependency-name"] == dep.name }. # FIXME: wildcard support
22
- map { |ic| ic[:versions] }.
23
- flatten
15
+ @ignore_conditions.
16
+ select { |ic| ic.dependency_name == dep.name }. # FIXME: wildcard support
17
+ map(&:versions).
18
+ flatten.
19
+ compact
24
20
  end
25
21
 
26
- def commit_message_options
27
- commit_message = @config[:"commit-message"] || {}
28
- {
29
- prefix: commit_message[:prefix],
30
- prefix_development: commit_message[:"prefix-development"],
31
- include_scope: commit_message[:include] == "scope"
32
- }
22
+ class IgnoreCondition
23
+ attr_reader :dependency_name, :versions
24
+ def initialize(dependency_name:, versions:)
25
+ @dependency_name = dependency_name
26
+ @versions = versions
27
+ end
33
28
  end
34
29
 
35
- def interval
36
- return unless @config[:schedule]
37
- return unless @config[:schedule][:interval]
30
+ class CommitMessageOptions
31
+ attr_reader :prefix, :prefix_development, :include
32
+
33
+ def initialize(prefix:, prefix_development:, include:)
34
+ @prefix = prefix
35
+ @prefix_development = prefix_development
36
+ @include = include
37
+ end
38
+
39
+ def include_scope?
40
+ @include == "scope"
41
+ end
38
42
 
39
- interval = @config[:schedule][:interval]
40
- case interval.downcase
41
- when Interval::DAILY, Interval::WEEKLY, Interval::MONTHLY
42
- interval.downcase
43
- else
44
- raise InvalidConfigError, "unknown interval: #{interval}"
43
+ def to_h
44
+ {
45
+ prefix: @prefix,
46
+ prefix_development: @prefix_development,
47
+ include_scope: include_scope?
48
+ }
45
49
  end
46
50
  end
47
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.143.0"
4
+ VERSION = "0.143.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.143.0
4
+ version: 0.143.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot