spm_version_updates 1.1.2 → 2.0.0

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.
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "yaml"
4
+ require_relative "errors"
4
5
  require_relative "git_operations"
5
6
  require_relative "semver"
6
7
  require_relative "update_severity"
@@ -63,13 +64,13 @@ class RepositoryUpdateRules
63
64
  yaml_config = YAML.safe_load_file(path, permitted_classes: [], permitted_symbols: [], aliases: false) || {}
64
65
  from_hash(yaml_config, source: path)
65
66
  rescue Psych::Exception => error
66
- raise(ArgumentError, "repo-rules YAML is invalid in #{path}: #{error.message}")
67
+ raise(SpmVersionUpdates::ConfigurationError, "repo-rules YAML is invalid in #{path}: #{error.message}")
67
68
  end
68
69
 
69
70
  def self.from_hash(config = {}, source: "repo rules", **keyword_config)
70
71
  effective_config = keyword_config.empty? ? config : keyword_config
71
72
  effective_config ||= {}
72
- raise(ArgumentError, "#{source} must contain a YAML mapping") unless effective_config.kind_of?(Hash)
73
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} must contain a YAML mapping") unless effective_config.kind_of?(Hash)
73
74
 
74
75
  new(parse_repositories(repositories_from(effective_config, source), source))
75
76
  end
@@ -84,7 +85,7 @@ class RepositoryUpdateRules
84
85
  repositories.each_with_object({}).with_index(1) { |(entry, rules), index|
85
86
  rule = parse_entry(entry, "#{source} repositories[#{index}]")
86
87
  normalized_url = rule.normalized_url
87
- raise(ArgumentError, "duplicate repo-rules entry for #{normalized_url}") if rules.key?(normalized_url)
88
+ raise(SpmVersionUpdates::ConfigurationError, "duplicate repo-rules entry for #{normalized_url}") if rules.key?(normalized_url)
88
89
 
89
90
  rules[normalized_url] = rule
90
91
  }
@@ -99,8 +100,8 @@ class RepositoryUpdateRules
99
100
 
100
101
  def self.validated_file_path(path)
101
102
  path = path.to_s.strip
102
- raise(ArgumentError, "repo-rules-path was set but no file path was provided") if path.empty?
103
- raise(ArgumentError, "repo-rules-path file does not exist: #{path}") unless File.file?(path)
103
+ raise(SpmVersionUpdates::ConfigurationError, "repo-rules-path was set but no file path was provided") if path.empty?
104
+ raise(SpmVersionUpdates::ConfigurationError, "repo-rules-path file does not exist: #{path}") unless File.file?(path)
104
105
 
105
106
  path
106
107
  end
@@ -109,13 +110,13 @@ class RepositoryUpdateRules
109
110
  string_keys = config.transform_keys(&:to_s)
110
111
  validate_keys!(string_keys, VALID_YAML_KEYS.fetch(:root), "#{source} root")
111
112
  repositories = string_keys.compact.fetch(yaml_key(:repositories), [])
112
- raise(ArgumentError, "#{source} repositories must be a list") unless repositories.kind_of?(Array)
113
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} repositories must be a list") unless repositories.kind_of?(Array)
113
114
 
114
115
  repositories
115
116
  end
116
117
 
117
118
  def self.rule_entry_from(entry, source)
118
- raise(ArgumentError, "#{source} must be a mapping") unless entry.kind_of?(Hash)
119
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} must be a mapping") unless entry.kind_of?(Hash)
119
120
 
120
121
  entry.transform_keys(&:to_s).tap { |string_keys| validate_keys!(string_keys, VALID_YAML_KEYS.fetch(:entry), source) }
121
122
  end
@@ -124,7 +125,7 @@ class RepositoryUpdateRules
124
125
  normalized_url = normalized_url_for(required_value(string_keys, yaml_key(:url), source))
125
126
  ignore_until = parse_ignore_until(string_keys, source)
126
127
  allowed_updates = parse_allowed_updates(string_keys, source)
127
- raise(ArgumentError, "#{source} must set #{yaml_key(:ignore_until)} or #{yaml_key(:allowed_updates)}") unless ignore_until || allowed_updates
128
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} must set #{yaml_key(:ignore_until)} or #{yaml_key(:allowed_updates)}") unless ignore_until || allowed_updates
128
129
 
129
130
  { normalized_url:, ignore_until:, allowed_updates: }
130
131
  end
@@ -133,19 +134,19 @@ class RepositoryUpdateRules
133
134
  unknown = values.keys - allowed
134
135
  return if unknown.empty?
135
136
 
136
- raise(ArgumentError, "#{source} contains unknown key(s): #{unknown.join(', ')}")
137
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} contains unknown key(s): #{unknown.join(', ')}")
137
138
  end
138
139
 
139
140
  def self.required_value(values, key, source)
140
141
  value = values[key].to_s.strip
141
- raise(ArgumentError, "#{source} #{key} must be set") if value.empty?
142
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} #{key} must be set") if value.empty?
142
143
 
143
144
  value
144
145
  end
145
146
 
146
147
  def self.normalized_url_for(value)
147
148
  normalized = GitOperations.trim_repo_url(value)
148
- raise(ArgumentError, "repo-rules url must normalize to a repository URL") if normalized.empty?
149
+ raise(SpmVersionUpdates::ConfigurationError, "repo-rules url must normalize to a repository URL") if normalized.empty?
149
150
 
150
151
  normalized
151
152
  end
@@ -155,7 +156,7 @@ class RepositoryUpdateRules
155
156
  return unless values.key?(key)
156
157
 
157
158
  semver(values[key].to_s.strip).tap { |version|
158
- raise(ArgumentError, "#{source} #{key} must be a semantic version") unless version
159
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} #{key} must be a semantic version") unless version
159
160
  }
160
161
  end
161
162
 
@@ -166,7 +167,7 @@ class RepositoryUpdateRules
166
167
  value = values[key].to_s.strip.downcase
167
168
  return value if SEVERITY_RANK.key?(value)
168
169
 
169
- raise(ArgumentError, "#{source} #{key} must be patch, minor, or major")
170
+ raise(SpmVersionUpdates::ConfigurationError, "#{source} #{key} must be patch, minor, or major")
170
171
  end
171
172
 
172
173
  def self.record_value(record, key)
@@ -5,7 +5,7 @@ require "semverify"
5
5
  # Namespace for the core gem's published constants (gem version and the
6
6
  # {SpmVersionUpdates::Semver} value object).
7
7
  module SpmVersionUpdates
8
- # SemVer value object used by both the GitHub Action and legacy Danger plugin.
8
+ # SemVer value object used by both the GitHub Action and Danger plugin.
9
9
  class Semver
10
10
  include Comparable
11
11
 
@@ -2,9 +2,11 @@
2
2
 
3
3
  require_relative "allow_host_normalizer"
4
4
  require_relative "credential_redactor"
5
+ require_relative "errors"
5
6
  require_relative "git_operations"
6
7
  require_relative "manifest_parser"
7
8
  require_relative "package_resolved"
9
+ require_relative "parse_warning"
8
10
  require_relative "repository_update_rules"
9
11
  require_relative "semver"
10
12
  require_relative "spm_package_context"
@@ -14,16 +16,166 @@ require_relative "version_tags_persistent_cache"
14
16
  require_relative "xcode_parser"
15
17
 
16
18
  # Core SPM version checking logic (migrated from Danger plugin)
19
+ # rubocop:disable Metrics/ClassLength
17
20
  class SpmChecker
18
- VERSION_TAG_WORKER_COUNT = 8
21
+ DEFAULT_VERSION_LOOKUP_WORKERS = 4
19
22
 
20
23
  # Raised when allow-hosts blocks a repository before git is contacted.
21
- class DisallowedRepositoryHost < StandardError; end
24
+ class DisallowedRepositoryHost < SpmVersionUpdates::PolicyError; end
22
25
 
23
- # Structured facts about each warning, used by the GitHub Action comment
24
- # renderer. `check_for_updates` and `check_manifests` still return the legacy
25
- # string warnings for compatibility with existing plugin-style callers.
26
- attr_reader :warning_details
26
+ # Filters configured Package.resolved paths and reports missing files.
27
+ class ResolvedPathList
28
+ def initialize(paths, missing_handler)
29
+ @paths = paths
30
+ @missing_handler = missing_handler
31
+ end
32
+
33
+ def existing
34
+ return @paths if missing.empty?
35
+
36
+ raise(ManifestParser::CouldNotFindResolvedFile, missing.join(", ")) unless @missing_handler
37
+
38
+ @missing_handler.call(missing)
39
+ @paths - missing
40
+ end
41
+
42
+ private
43
+
44
+ def missing
45
+ @missing ||= @paths.reject { |path| File.exist?(path) }
46
+ end
47
+ end
48
+ private_constant :ResolvedPathList
49
+
50
+ # Converts resolved pins into the package and version maps consumed by checks.
51
+ class ResolvedPackageEntries
52
+ def initialize(path, malformed_handler)
53
+ @path = path
54
+ @malformed_handler = malformed_handler
55
+ end
56
+
57
+ def packages_and_versions
58
+ pins.each_with_object([{}, {}]) { |pin, (packages, versions)|
59
+ entry = ResolvedPinEntry.new(pin)
60
+ entry.add_to(packages, versions)
61
+ }
62
+ end
63
+
64
+ private
65
+
66
+ def pins
67
+ PackageResolved.pins_from(@path)
68
+ rescue PackageResolved::MalformedFileError => error
69
+ raise unless @malformed_handler
70
+
71
+ @malformed_handler.call(@path, error)
72
+ []
73
+ end
74
+ end
75
+ private_constant :ResolvedPackageEntries
76
+
77
+ # Normalized data derived from one Package.resolved pin.
78
+ class ResolvedPinEntry
79
+ def initialize(pin)
80
+ @pin = pin
81
+ end
82
+
83
+ def normalized_url
84
+ @pin["normalized_url"]
85
+ end
86
+
87
+ def package
88
+ {
89
+ "repository_url" => @pin["repository_url"],
90
+ "requirement" => requirement
91
+ }
92
+ end
93
+
94
+ def resolved_version
95
+ @pin["version"] || @pin["revision"]
96
+ end
97
+
98
+ def add_to(packages, versions)
99
+ packages[normalized_url] = package
100
+ versions[normalized_url] = resolved_version
101
+ end
102
+
103
+ private
104
+
105
+ def requirement
106
+ version = @pin["version"]
107
+ return { "kind" => "resolvedPin", "version" => version } if version
108
+
109
+ { "kind" => "revision", "revision" => @pin["revision"] }
110
+ end
111
+ end
112
+ private_constant :ResolvedPinEntry
113
+
114
+ # Builds warning detail records while preserving explicit nil requirements.
115
+ class WarningDetailRecord
116
+ def initialize(message, package, detail)
117
+ @message = message
118
+ @package = package
119
+ @detail = detail
120
+ end
121
+
122
+ def to_h
123
+ with_optional_requirement(compacted_record)
124
+ end
125
+
126
+ private
127
+
128
+ def record
129
+ @detail.merge(message: @message, source: @package.source)
130
+ end
131
+
132
+ def compacted_record
133
+ record.compact
134
+ end
135
+
136
+ def with_optional_requirement(compacted)
137
+ return compacted unless record.key?(:suggested_requirement)
138
+
139
+ compacted.merge(suggested_requirement: record[:suggested_requirement])
140
+ end
141
+ end
142
+ private_constant :WarningDetailRecord
143
+
144
+ # Parses a package's resolved version for semantic comparisons.
145
+ class PackageSemver
146
+ def initialize(package)
147
+ @package = package
148
+ end
149
+
150
+ def value
151
+ resolved_version = @package.resolved_version
152
+ SpmVersionUpdates::Semver.new(resolved_version)
153
+ rescue ArgumentError => error
154
+ puts("Unable to extract semver from #{resolved_version} for #{@package.name} (#{error})")
155
+ nil
156
+ end
157
+ end
158
+ private_constant :PackageSemver
159
+
160
+ # Structured result from one checker run. Parse warnings stay separate from
161
+ # update records so counts and fail-on thresholds only consider real updates.
162
+ class Result
163
+ attr_reader :updates, :parse_warnings
164
+
165
+ def initialize(updates:, parse_warnings:)
166
+ @updates = normalize_records(updates)
167
+ @parse_warnings = normalize_records(parse_warnings)
168
+ end
169
+
170
+ private
171
+
172
+ def normalize_records(records)
173
+ Array(records).map { |record| record.to_h.transform_keys(&:to_s).compact.freeze }
174
+ .freeze
175
+ end
176
+ end
177
+
178
+ attr_reader :version_lookup_workers
27
179
 
28
180
  attr_accessor :allow_hosts,
29
181
  :check_branches,
@@ -47,6 +199,12 @@ class SpmChecker
47
199
  # default), PackageResolved::MalformedFileError is raised.
48
200
  attr_accessor :malformed_resolved_handler
49
201
 
202
+ # Optional callable `(missing_paths)` invoked instead of raising when expected
203
+ # Package.resolved files are missing. Missing paths are dropped and packages
204
+ # without a resolved version keep the existing "Unable to locate..." behavior:
205
+ # no warning record is created and no version tags are fetched for them.
206
+ attr_accessor :missing_resolved_handler
207
+
50
208
  def self.redact_credentials(value)
51
209
  CredentialRedactor.redact(value)
52
210
  end
@@ -54,12 +212,13 @@ class SpmChecker
54
212
  def initialize
55
213
  @check_when_exact = @check_revisions = @report_above_maximum = @report_pre_releases = false
56
214
  @check_branches = true
57
- @lookup_failure_handler = @malformed_resolved_handler = nil
215
+ @lookup_failure_handler = @malformed_resolved_handler = @missing_resolved_handler = nil
58
216
  @ignore_repos = []
59
217
  @repository_update_rules = RepositoryUpdateRules.empty
60
218
  @allow_hosts = []
61
- @warnings = []
62
- @warning_details = []
219
+ @version_lookup_workers = DEFAULT_VERSION_LOOKUP_WORKERS
220
+ @updates = []
221
+ @parse_warnings = []
63
222
  @version_tags_cache = {}
64
223
  @version_tag_lookup_errors = {}
65
224
  @reported_lookup_failures = {}
@@ -67,15 +226,19 @@ class SpmChecker
67
226
  @version_tags_cache_ttl_seconds = VersionTagsPersistentCache::DEFAULT_TTL_SECONDS
68
227
  end
69
228
 
229
+ def version_lookup_workers=(value)
230
+ workers = Integer(value.to_s, 10, exception: false)
231
+ raise(SpmVersionUpdates::ConfigurationError, "version_lookup_workers must be a positive integer") unless workers && workers >= 1
232
+
233
+ @version_lookup_workers = workers
234
+ end
235
+
70
236
  # Check for SPM updates using an Xcode project as the source of dependencies.
71
237
  #
72
238
  # @param [String] xcodeproj_path The path to your Xcode project
73
- # @return [Array<String>] Array of warning messages
239
+ # @return [Result] Structured update records and parse warnings
74
240
  def check_for_updates(xcodeproj_path)
75
- clear_warnings
76
- reset_version_tags_cache
77
- normalize_ignore_repos
78
- normalize_allow_hosts
241
+ prepare_run
79
242
 
80
243
  remote_packages = XcodeParser.get_packages(xcodeproj_path)
81
244
  resolved_versions = XcodeParser.get_resolved_versions(xcodeproj_path, &@malformed_resolved_handler)
@@ -83,7 +246,7 @@ class SpmChecker
83
246
  warn_for_empty_xcode_project(remote_packages, resolved_versions, xcodeproj_path)
84
247
 
85
248
  check_packages(remote_packages, resolved_versions)
86
- @warnings
249
+ result
87
250
  end
88
251
 
89
252
  # Check for SPM updates using one or more `Package.swift` manifests as the
@@ -99,25 +262,48 @@ class SpmChecker
99
262
  # `Package.resolved` paths. When omitted, a `Package.resolved` next to
100
263
  # each manifest is used.
101
264
  # @raise [ManifestParser::CouldNotFindResolvedFile] if no resolved file exists
102
- # @return [Array<String>] Array of warning messages
265
+ # @return [Result] Structured update records and parse warnings
103
266
  def check_manifests(manifest_paths, resolved_paths = nil)
104
- clear_warnings
105
- reset_version_tags_cache
106
- normalize_ignore_repos
107
- normalize_allow_hosts
267
+ prepare_run
108
268
 
109
269
  resolved_versions = merged_resolved_versions(manifest_paths, resolved_paths)
110
270
  puts("Found resolved versions for #{resolved_versions.size} packages")
111
271
 
112
272
  manifest_paths.each { |manifest_path|
113
- remote_packages = ManifestParser.get_packages(manifest_path)
114
- check_packages(remote_packages, resolved_versions, manifest_path)
273
+ check_packages(manifest_packages(manifest_path), resolved_versions, manifest_path)
115
274
  }
116
- @warnings
275
+ result
276
+ end
277
+
278
+ # Check for SPM updates using one or more `Package.resolved` files as the
279
+ # source of dependencies. Version pins are compared directly with available
280
+ # tags; revision-only pins are reported only when check_revisions is enabled.
281
+ #
282
+ # @param [Array<String>] resolved_paths Paths to one or more Package.resolved files
283
+ # @raise [SpmVersionUpdates::ConfigurationError] if no paths are supplied
284
+ # @return [Result] Structured update records and parse warnings
285
+ def check_resolved(resolved_paths)
286
+ prepare_run
287
+ paths = normalized_resolved_paths(resolved_paths)
288
+ raise(SpmVersionUpdates::ConfigurationError, "package-resolved-paths must be set") if paths.empty?
289
+
290
+ check_existing_resolved_paths(paths)
291
+ result
117
292
  end
118
293
 
119
294
  private
120
295
 
296
+ def prepare_run
297
+ clear_updates
298
+ reset_version_tags_cache
299
+ normalize_ignore_repos
300
+ normalize_allow_hosts
301
+ end
302
+
303
+ def manifest_packages(manifest_path)
304
+ ManifestParser.get_packages(manifest_path) { |skip| record_parse_warning(skip, manifest_path) }
305
+ end
306
+
121
307
  def normalize_ignore_repos
122
308
  @ignore_repos = Array(@ignore_repos).map { |repo| GitOperations.trim_repo_url(repo) }
123
309
  end
@@ -127,7 +313,7 @@ class SpmChecker
127
313
  @allow_hosts = raw_allow_hosts.filter_map { |host| AllowHostNormalizer.normalize(host) }
128
314
  return unless invalid_allow_hosts_configuration?(raw_allow_hosts)
129
315
 
130
- raise(ArgumentError, "allow-hosts was configured, but no entries could be parsed as hostnames")
316
+ raise(SpmVersionUpdates::ConfigurationError, "allow-hosts was configured, but no entries could be parsed as hostnames")
131
317
  end
132
318
 
133
319
  def configured_allow_hosts
@@ -138,9 +324,19 @@ class SpmChecker
138
324
  raw_allow_hosts.any? && @allow_hosts.empty?
139
325
  end
140
326
 
141
- def clear_warnings
142
- @warnings.clear
143
- @warning_details.clear
327
+ def result
328
+ Result.new(updates: @updates, parse_warnings: @parse_warnings)
329
+ end
330
+
331
+ def clear_updates
332
+ @updates.clear
333
+ @parse_warnings.clear
334
+ end
335
+
336
+ def record_parse_warning(skip, manifest_path)
337
+ record = ParseWarning.record(**skip, source: manifest_path)
338
+ @parse_warnings << record
339
+ puts("WARNING: #{record['message']}")
144
340
  end
145
341
 
146
342
  def warn_for_empty_xcode_project(remote_packages, resolved_versions, xcodeproj_path)
@@ -167,16 +363,23 @@ class SpmChecker
167
363
  #
168
364
  # @return [Hash<String, String>]
169
365
  def merged_resolved_versions(manifest_paths, resolved_paths)
170
- paths = Array(resolved_paths).map(&:to_s).reject(&:empty?)
366
+ paths = normalized_resolved_paths(resolved_paths)
171
367
  paths = manifest_paths.map { |manifest| ManifestParser.default_resolved_path(manifest) } if paths.empty?
172
368
 
173
- missing = paths.reject { |path| File.exist?(path) }
174
- raise(ManifestParser::CouldNotFindResolvedFile, missing.join(", ")) unless missing.empty?
369
+ paths = existing_paths(paths)
175
370
 
176
371
  puts("Reading resolved packages from: #{paths}")
177
372
  paths.each_with_object({}) { |path, pins| pins.merge!(resolved_versions_from(path)) }
178
373
  end
179
374
 
375
+ def normalized_resolved_paths(paths)
376
+ Array(paths).map(&:to_s).reject(&:empty?)
377
+ end
378
+
379
+ def existing_paths(paths)
380
+ ResolvedPathList.new(paths, @missing_resolved_handler).existing
381
+ end
382
+
180
383
  def resolved_versions_from(path)
181
384
  PackageResolved.versions_from(path)
182
385
  rescue PackageResolved::MalformedFileError => error
@@ -186,6 +389,17 @@ class SpmChecker
186
389
  {}
187
390
  end
188
391
 
392
+ def packages_from_resolved(path)
393
+ ResolvedPackageEntries.new(path, @malformed_resolved_handler).packages_and_versions
394
+ end
395
+
396
+ def check_existing_resolved_paths(paths)
397
+ existing_paths(paths).each { |path|
398
+ remote_packages, resolved_versions = packages_from_resolved(path)
399
+ check_packages(remote_packages, resolved_versions, path)
400
+ }
401
+ end
402
+
189
403
  # Compare a set of declared dependencies against the resolved pins.
190
404
  #
191
405
  # Packages are keyed by their normalized repository URL, which is what we match
@@ -294,7 +508,7 @@ class SpmChecker
294
508
  persistent_cache = VersionTagsPersistentCache.new(directory: @version_tags_cache_dir, ttl_seconds: @version_tags_cache_ttl_seconds)
295
509
  results, errors = VersionTagFetcher.call(
296
510
  pending,
297
- worker_limit: VERSION_TAG_WORKER_COUNT,
511
+ worker_limit: @version_lookup_workers,
298
512
  persistent_cache:,
299
513
  raise_on_error: !@lookup_failure_handler
300
514
  )
@@ -368,6 +582,8 @@ class SpmChecker
368
582
  warn_for_new_versions(package, available_versions, :minor)
369
583
  when "versionRange"
370
584
  warn_for_new_versions_range(package, available_versions)
585
+ when "resolvedPin"
586
+ warn_for_new_versions_pin(package, available_versions)
371
587
  else
372
588
  puts("Not processing dependency rule '#{kind}' for #{package.name} (#{self.class.redact_credentials(repository_url)})")
373
589
  end
@@ -381,13 +597,12 @@ class SpmChecker
381
597
  end
382
598
 
383
599
  def record_warning(message, package, record)
384
- @warnings << [message, package.source_line].compact.join("\n")
385
- @warning_details << record
600
+ @updates << record
386
601
  puts("WARNING: #{message}#{package.source_suffix}")
387
602
  end
388
603
 
389
604
  def warning_detail_record(message, package, detail)
390
- detail.merge(message:, source: package.source).compact
605
+ WarningDetailRecord.new(message, package, detail).to_h
391
606
  end
392
607
 
393
608
  def warning_detail(type, package, available_version, note = nil)
@@ -488,6 +703,20 @@ class SpmChecker
488
703
  end
489
704
  end
490
705
 
706
+ def warn_for_new_versions_pin(package, available_versions)
707
+ resolved_version = PackageSemver.new(package).value
708
+ return unless resolved_version
709
+
710
+ newest_version = newest_reportable_version(available_versions)
711
+ return unless newest_version && newest_version > resolved_version
712
+
713
+ add_warning(
714
+ "Newer version of #{package.name}: #{newest_version}",
715
+ package,
716
+ warning_detail(:version, package, newest_version, "resolved pin")
717
+ )
718
+ end
719
+
491
720
  def warn_for_new_versions(package, available_versions, major_or_minor)
492
721
  name = package.name
493
722
  resolved_version_string = package.resolved_version
@@ -530,3 +759,4 @@ class SpmChecker
530
759
  )
531
760
  end
532
761
  end
762
+ # rubocop:enable Metrics/ClassLength
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpmVersionUpdates
4
- VERSION = "1.1.2"
4
+ VERSION = "2.0.0"
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "errors"
3
4
  require_relative "git_operations"
4
5
  require_relative "package_resolved"
5
6
  require_relative "xcode_project_package_reader"
@@ -62,10 +63,16 @@ module XcodeParser
62
63
  private_class_method :find_packages_resolved_file
63
64
 
64
65
  # Raised when Xcode project mode is invoked without a project path.
65
- class XcodeprojPathMustBeSet < StandardError
66
+ class XcodeprojPathMustBeSet < SpmVersionUpdates::ConfigurationError
67
+ def initialize(message = "Invalid Xcode project path")
68
+ super
69
+ end
66
70
  end
67
71
 
68
72
  # Raised when an Xcode project does not have a Package.resolved file.
69
- class CouldNotFindResolvedFile < StandardError
73
+ class CouldNotFindResolvedFile < SpmVersionUpdates::FileNotFoundError
74
+ def initialize(message = "Could not find a Package.resolved file for the Xcode project")
75
+ super
76
+ end
70
77
  end
71
78
  end
@@ -2,11 +2,14 @@
2
2
 
3
3
  require_relative "spm_version_updates/allow_host_normalizer"
4
4
  require_relative "spm_version_updates/credential_redactor"
5
+ require_relative "spm_version_updates/errors"
5
6
  require_relative "spm_version_updates/fail_on_threshold"
6
7
  require_relative "spm_version_updates/git_host_normalizer"
7
8
  require_relative "spm_version_updates/git_operations"
8
9
  require_relative "spm_version_updates/manifest_parser"
10
+ require_relative "spm_version_updates/manifest_updater"
9
11
  require_relative "spm_version_updates/package_resolved"
12
+ require_relative "spm_version_updates/parse_warning"
10
13
  require_relative "spm_version_updates/repository_link"
11
14
  require_relative "spm_version_updates/repository_update_rules"
12
15
  require_relative "spm_version_updates/semver"
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.require_paths = ["lib"]
41
41
  spec.metadata["rubygems_mfa_required"] = "true"
42
42
 
43
- spec.add_runtime_dependency("semverify", "~> 0.3")
43
+ spec.add_dependency("semverify", "~> 0.3")
44
44
  # Xcode-project mode additionally requires the "xcodeproj" gem (loaded
45
45
  # lazily); manifest mode works without it.
46
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spm_version_updates
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harold Martin
@@ -36,11 +36,14 @@ files:
36
36
  - lib/spm_version_updates.rb
37
37
  - lib/spm_version_updates/allow_host_normalizer.rb
38
38
  - lib/spm_version_updates/credential_redactor.rb
39
+ - lib/spm_version_updates/errors.rb
39
40
  - lib/spm_version_updates/fail_on_threshold.rb
40
41
  - lib/spm_version_updates/git_host_normalizer.rb
41
42
  - lib/spm_version_updates/git_operations.rb
42
43
  - lib/spm_version_updates/manifest_parser.rb
44
+ - lib/spm_version_updates/manifest_updater.rb
43
45
  - lib/spm_version_updates/package_resolved.rb
46
+ - lib/spm_version_updates/parse_warning.rb
44
47
  - lib/spm_version_updates/repository_link.rb
45
48
  - lib/spm_version_updates/repository_update_rules.rb
46
49
  - lib/spm_version_updates/semver.rb