dependabot-elm 0.288.0 → 0.289.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: 9e2aa292f16b9fea6d7118e7e1bd53af5104f060830e36262ebd0234585daf70
4
- data.tar.gz: e453ffd3a544e327f71dfab85fe7e01a9b69041e01ce14214170dbddd929edf3
3
+ metadata.gz: 88e5384e747e824289cf975412d4951b431797e8d7d32bb4f2628ab798f44f46
4
+ data.tar.gz: 715860765b8dc4ca3d2885659fd9911d674e752946672ce0042417bd94a8dc2b
5
5
  SHA512:
6
- metadata.gz: e311f36d6dac9308c74784c5c99c54c6ea255de77648b422e3af009d426ab7bb568636db290ccff81a5b59e7300df2965d15cb3b82485a4a9907d1105d0fd15e
7
- data.tar.gz: 4d974f5c4dbb931087f61dc3a8d37808395c01f10d64af0bb92af224ab40beca36a6e6a3ea60ca04cc04b4538a7774b41f1640972698d33b46e1bf9063c01542
6
+ metadata.gz: 24e6f4bcc7d694de1d131b9a3c3a1229296017e6ae7e0e75c0e4437144cd310bf7c5932c8d9d1f4bd997d944ab6baa982bad6e509e436e355826ee0455c93c53
7
+ data.tar.gz: 1dd5326b7d648bcf1c1b29b878e787e085b512aa7be93d4c81a1ec8e39de6acc138411202d88466ab566b083e6b4fc3d8f8d70919e371765f1f7958b56b0ce05
@@ -13,12 +13,12 @@ module Dependabot
13
13
 
14
14
  sig { override.params(filenames: T::Array[String]).returns(T::Boolean) }
15
15
  def self.required_files_in?(filenames)
16
- filenames.include?("elm.json")
16
+ filenames.include?(MANIFEST_FILE)
17
17
  end
18
18
 
19
19
  sig { override.returns(String) }
20
20
  def self.required_files_message
21
- "Repo must contain an elm-package.json or an elm.json"
21
+ "Repo must contain an elm-package.json or an #{MANIFEST_FILE}"
22
22
  end
23
23
 
24
24
  sig { override.returns(T::Array[DependencyFile]) }
@@ -38,7 +38,10 @@ module Dependabot
38
38
  def elm_json
39
39
  return @elm_json if defined?(@elm_json)
40
40
 
41
- @elm_json = T.let(fetch_file_if_present("elm.json"), T.nilable(Dependabot::DependencyFile))
41
+ @elm_json = T.let(
42
+ fetch_file_if_present(MANIFEST_FILE),
43
+ T.nilable(Dependabot::DependencyFile)
44
+ )
42
45
  end
43
46
  end
44
47
  end
@@ -6,6 +6,8 @@ require "dependabot/errors"
6
6
  require "dependabot/file_parsers"
7
7
  require "dependabot/file_parsers/base"
8
8
  require "dependabot/elm/requirement"
9
+ require "dependabot/elm/language"
10
+ require "dependabot/elm/package_manager"
9
11
 
10
12
  module Dependabot
11
13
  module Elm
@@ -22,8 +24,80 @@ module Dependabot
22
24
  dependency_set.dependencies.sort_by(&:name)
23
25
  end
24
26
 
27
+ sig { returns(Ecosystem) }
28
+ def ecosystem
29
+ @ecosystem ||= T.let(
30
+ Ecosystem.new(
31
+ name: ECOSYSTEM,
32
+ package_manager: package_manager,
33
+ language: language
34
+ ),
35
+ T.nilable(Ecosystem)
36
+ )
37
+ end
38
+
25
39
  private
26
40
 
41
+ sig { returns(Ecosystem::VersionManager) }
42
+ def package_manager
43
+ @package_manager ||= T.let(
44
+ PackageManager.new(elm_version || DEFAULT_ELM_VERSION, elm_requirement),
45
+ T.nilable(Ecosystem::VersionManager)
46
+ )
47
+ end
48
+
49
+ sig { returns(T.nilable(Ecosystem::VersionManager)) }
50
+ def language
51
+ @language ||= T.let(
52
+ Language.new(elm_version || DEFAULT_ELM_VERSION, elm_requirement),
53
+ T.nilable(Ecosystem::VersionManager)
54
+ )
55
+ end
56
+
57
+ sig { returns(T.nilable(Dependabot::Elm::Requirement)) }
58
+ def elm_requirement
59
+ @elm_requirement ||= T.let(
60
+ extract_version_requirement(ELM_VERSION_KEY),
61
+ T.nilable(Dependabot::Elm::Requirement)
62
+ )
63
+ end
64
+
65
+ sig { returns(T.nilable(String)) }
66
+ def elm_version
67
+ content = extract_version(ELM_VERSION_KEY)
68
+ return unless content
69
+
70
+ @elm_version ||= T.let(content, T.nilable(String))
71
+ end
72
+
73
+ sig { params(field: String).returns(T.nilable(Dependabot::Elm::Requirement)) }
74
+ def extract_version_requirement(field)
75
+ content = extract_version_content(field)
76
+ return unless content
77
+
78
+ Dependabot::Elm::Requirement.new(content)
79
+ end
80
+
81
+ # Extracts the version content (e.g., "1.9.1" or "<= 1.9.1") and parses it to return only the version part
82
+ sig { params(field: String).returns(T.nilable(String)) }
83
+ def extract_version(field)
84
+ version_content = extract_version_content(field)
85
+ return nil unless version_content
86
+
87
+ # Extract only the version part (e.g., "1.9.1") from the string
88
+ version_match = version_content.match(/(\d+\.\d+\.\d+)/)
89
+ version_match ? version_match[1] : nil
90
+ end
91
+
92
+ sig { params(field: String).returns(T.nilable(String)) }
93
+ def extract_version_content(field)
94
+ parsed_version = parsed_elm_json.fetch(field, nil)
95
+
96
+ return if parsed_version.nil? || parsed_version.empty?
97
+
98
+ parsed_version
99
+ end
100
+
27
101
  # For docs on elm.json, see:
28
102
  # https://github.com/elm/compiler/blob/master/docs/elm.json/application.md
29
103
  # https://github.com/elm/compiler/blob/master/docs/elm.json/package.md
@@ -62,7 +136,7 @@ module Dependabot
62
136
  requirement: requirement,
63
137
  groups: [group],
64
138
  source: nil,
65
- file: "elm.json"
139
+ file: MANIFEST_FILE
66
140
  }]
67
141
 
68
142
  Dependency.new(
@@ -73,14 +147,16 @@ module Dependabot
73
147
  )
74
148
  end
75
149
 
150
+ sig { returns(String) }
76
151
  def repo_type
77
152
  parsed_elm_json.fetch("type")
78
153
  end
79
154
 
155
+ sig { override.void }
80
156
  def check_required_files
81
157
  return if elm_json
82
158
 
83
- raise "No elm.json"
159
+ raise "No #{MANIFEST_FILE}!"
84
160
  end
85
161
 
86
162
  def version_for(version_requirement)
@@ -94,11 +170,14 @@ module Dependabot
94
170
  def parsed_elm_json
95
171
  @parsed_elm_json ||= JSON.parse(elm_json.content)
96
172
  rescue JSON::ParserError
97
- raise Dependabot::DependencyFileNotParseable, elm_json.path
173
+ raise Dependabot::DependencyFileNotParseable, elm_json&.path || MANIFEST_FILE
98
174
  end
99
175
 
100
176
  def elm_json
101
- @elm_json ||= get_original_file("elm.json")
177
+ @elm_json ||= T.let(
178
+ get_original_file(MANIFEST_FILE),
179
+ T.nilable(Dependabot::DependencyFile)
180
+ )
102
181
  end
103
182
  end
104
183
  end
@@ -38,7 +38,7 @@ module Dependabot
38
38
  def check_required_files
39
39
  return if elm_json_files.any?
40
40
 
41
- raise "No elm.json"
41
+ raise "No #{MANIFEST_FILE}"
42
42
  end
43
43
 
44
44
  def updated_elm_json_content(file)
@@ -49,7 +49,7 @@ module Dependabot
49
49
  end
50
50
 
51
51
  def elm_json_files
52
- dependency_files.select { |f| f.name.end_with?("elm.json") }
52
+ dependency_files.select { |f| f.name.end_with?(MANIFEST_FILE) }
53
53
  end
54
54
  end
55
55
  end
@@ -0,0 +1,31 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ require "sorbet-runtime"
5
+ require "dependabot/elm/version"
6
+ require "dependabot/ecosystem"
7
+
8
+ module Dependabot
9
+ module Elm
10
+ LANGUAGE = "elm"
11
+
12
+ class Language < Dependabot::Ecosystem::VersionManager
13
+ extend T::Sig
14
+
15
+ sig { params(raw_version: String, requirement: T.nilable(Requirement)).void }
16
+ def initialize(raw_version, requirement = nil)
17
+ super(LANGUAGE, Version.new(raw_version), [], [], requirement)
18
+ end
19
+
20
+ sig { returns(T::Boolean) }
21
+ def deprecated?
22
+ false
23
+ end
24
+
25
+ sig { returns(T::Boolean) }
26
+ def unsupported?
27
+ false
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,56 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ require "sorbet-runtime"
5
+ require "dependabot/elm/version"
6
+ require "dependabot/ecosystem"
7
+ require "dependabot/elm/requirement"
8
+
9
+ module Dependabot
10
+ module Elm
11
+ ECOSYSTEM = "elm"
12
+ PACKAGE_MANAGER = "elm"
13
+ ELM_VERSION_KEY = "elm-version"
14
+ MANIFEST_FILE = "elm.json"
15
+ DEFAULT_ELM_VERSION = "0.19.0"
16
+
17
+ # Keep versions in ascending order
18
+ SUPPORTED_ELM_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])
19
+
20
+ # Currently, we don't support any deprecated versions of Elm
21
+ # When a version is going to be unsupported, it will be added here for a while to give users time to upgrade
22
+ # Example for deprecation:
23
+ # DEPRECATED_ELM_VERSIONS = T.let([Version.new("1")].freeze, T::Array[Dependabot::Version])
24
+ DEPRECATED_ELM_VERSIONS = T.let([].freeze, T::Array[Dependabot::Version])
25
+
26
+ class PackageManager < Dependabot::Ecosystem::VersionManager
27
+ extend T::Sig
28
+
29
+ sig do
30
+ params(
31
+ raw_version: String,
32
+ requirement: T.nilable(Requirement)
33
+ ).void
34
+ end
35
+ def initialize(raw_version, requirement = nil)
36
+ super(
37
+ PACKAGE_MANAGER,
38
+ Version.new(raw_version),
39
+ DEPRECATED_ELM_VERSIONS,
40
+ SUPPORTED_ELM_VERSIONS,
41
+ requirement,
42
+ )
43
+ end
44
+
45
+ sig { returns(T::Boolean) }
46
+ def deprecated?
47
+ false
48
+ end
49
+
50
+ sig { returns(T::Boolean) }
51
+ def unsupported?
52
+ false
53
+ end
54
+ end
55
+ end
56
+ end
@@ -56,8 +56,8 @@ module Dependabot
56
56
  def version_resolver
57
57
  @version_resolver ||=
58
58
  begin
59
- unless dependency.requirements.any? { |r| r.fetch(:file) == "elm.json" }
60
- raise Dependabot::DependencyFileNotResolvable, "No elm.json found"
59
+ unless dependency.requirements.any? { |r| r.fetch(:file) == MANIFEST_FILE }
60
+ raise Dependabot::DependencyFileNotResolvable, "No #{MANIFEST_FILE} found"
61
61
  end
62
62
 
63
63
  Elm19VersionResolver.new(
@@ -3,6 +3,8 @@
3
3
 
4
4
  # These all need to be required so the various classes can be registered in a
5
5
  # lookup table of package manager names to concrete classes.
6
+ require "dependabot/elm/language"
7
+ require "dependabot/elm/package_manager"
6
8
  require "dependabot/elm/file_fetcher"
7
9
  require "dependabot/elm/file_parser"
8
10
  require "dependabot/elm/update_checker"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-elm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.288.0
4
+ version: 0.289.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-11-21 00:00:00.000000000 Z
11
+ date: 2024-12-05 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.288.0
19
+ version: 0.289.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.288.0
26
+ version: 0.289.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -247,7 +247,9 @@ files:
247
247
  - lib/dependabot/elm/file_parser.rb
248
248
  - lib/dependabot/elm/file_updater.rb
249
249
  - lib/dependabot/elm/file_updater/elm_json_updater.rb
250
+ - lib/dependabot/elm/language.rb
250
251
  - lib/dependabot/elm/metadata_finder.rb
252
+ - lib/dependabot/elm/package_manager.rb
251
253
  - lib/dependabot/elm/requirement.rb
252
254
  - lib/dependabot/elm/update_checker.rb
253
255
  - lib/dependabot/elm/update_checker/cli_parser.rb
@@ -259,7 +261,7 @@ licenses:
259
261
  - MIT
260
262
  metadata:
261
263
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
262
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.288.0
264
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.289.0
263
265
  post_install_message:
264
266
  rdoc_options: []
265
267
  require_paths: