semverve 0.2.1 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b04f97b571e0eed652d155221cddb5afe06d703f2a27546f15c11e3d26a3d214
4
- data.tar.gz: 6c824db22d1967e9daa8de369ca199b6cc7969f6ab2179933600fbba34d1aa6e
3
+ metadata.gz: c12b376c6b4cb56170cff17c35f9545137b3011f1e1fe6314541dfe259351367
4
+ data.tar.gz: fae2d93ad6f546f69e081cfa5a7449d7d6de0c9eb25430421dbe41a274171d8c
5
5
  SHA512:
6
- metadata.gz: 31208572bd96d1d1bb00537673e9960594501a2b4226f821114d8cb624965fd0cd7282722d6284cf0666f80a908706174a3ca3d0bb4109a3b18dc882e9a26ecd
7
- data.tar.gz: 8deb952db13cfdf0f8a13fbbcffb07afc23c402ece2efc3d50899d4158ea7455a6bedc993cb79c9d3de8dfc83c8142981f87f52777ee79a8dba1c1b09bc58dcd
6
+ metadata.gz: 92980247baef342765f07bf2f9a398e38b191a3707302ae84f25ca0a322a9bfd428335f680c6da34cebc1039f533cdf7298117e1e062f159413c663e58966f2c
7
+ data.tar.gz: b9016a36d15e78aa46c6e7fea92feaa48bd5dec2627fcd8e47420e11a55eed4c7083f56eaeb06f95cb1a9baa50f3559f5c9d3e63fb2bc42dae720a49447df775
data/CONTRIBUTING.md CHANGED
@@ -116,6 +116,10 @@ versions as the generated version, `module` or `simple` as the format, and
116
116
  `rake 'semverve:generate[simple]'` and `rake 'semverve:generate[force]'`
117
117
  readable without requiring awkward empty slots.
118
118
 
119
+ Use Rake task arguments for one-off exact inputs, such as
120
+ `rake 'semverve:check[1.2.3]'` when a user wants to scan only for a specific
121
+ version.
122
+
119
123
  Reserve environment variables for cross-cutting runtime toggles that compose
120
124
  across related tasks, such as `SEMVERVE_REPORT_IGNORED=true rake
121
125
  semverve:check`. Avoid generic environment variables like `VERSION`, `FORMAT`,
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- semverve (0.2.1)
4
+ semverve (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -95,7 +95,7 @@ Semverve.configure do |config|
95
95
  config.rubygems_host = "https://rubygems.org"
96
96
  config.version_code_reference_files.append("lib/**/*.rb")
97
97
  config.version_doc_reference_files.append("doc/**/*.md")
98
- config.version_reference_mode = :non_current
98
+ config.version_match_mode = :non_current
99
99
  end
100
100
  ```
101
101
 
@@ -109,7 +109,7 @@ Semverve.configure do |config|
109
109
  config.version_checks = [:doc_references, :code_references, :metadata]
110
110
  config.release_checks = []
111
111
  config.rubygems_host = "https://rubygems.org"
112
- config.version_reference_mode = :older
112
+ config.version_match_mode = :older
113
113
  config.version_code_reference_files = Rake::FileList[]
114
114
  config.version_code_reference_pattern =
115
115
  /^\s*(?:(?:[A-Z]\w*::)*(?:[A-Z]\w*VERSION[A-Z0-9_]*|VERSION)|(?:[a-z_]\w*|self)\.version)\s*=\s*(?<quote>["'])(?<version>\d+\.\d+\.\d+)\k<quote>/
@@ -375,6 +375,18 @@ rake semverve:fix:metadata
375
375
  `semverve:fix:metadata` rewrites literal gemspec versions when safe and
376
376
  runs `bundle lock` for `Gemfile.lock` drift.
377
377
 
378
+ Pass a semantic version when you want to check or fix only that exact version in
379
+ doc references and code literals:
380
+
381
+ ```sh
382
+ rake 'semverve:check[1.2.2]'
383
+ rake 'semverve:fix:references[1.2.2]'
384
+ ```
385
+
386
+ Metadata checks still compare metadata to the current version. If you target the
387
+ current version, check tasks list those matches but fix tasks are no-ops because
388
+ the text is already current.
389
+
378
390
  ### Version references
379
391
  Version references are prose-like references to versions. These are usually in
380
392
  README files, docs, guides, or comments. By default, Semverve scans README files
@@ -410,20 +422,21 @@ end
410
422
  Ruby files are scanned only in comments. Text files with `.md`, `.markdown`,
411
423
  `.txt`, `.rdoc`, and `.adoc` extensions are scanned as full text.
412
424
 
413
- The default reference mode is `:older`, which flags only semantic versions lower
414
- than the current version:
425
+ The default version match mode is `:older`, which flags only semantic versions
426
+ lower than the current version in doc references and code literals:
415
427
 
416
428
  ```ruby
417
429
  Semverve.configure do |config|
418
- config.version_reference_mode = :older
430
+ config.version_match_mode = :older
419
431
  end
420
432
  ```
421
433
 
422
- Use `:non_current` when every reference should match the current version:
434
+ Use `:non_current` when every doc reference and code literal should match the
435
+ current version:
423
436
 
424
437
  ```ruby
425
438
  Semverve.configure do |config|
426
- config.version_reference_mode = :non_current
439
+ config.version_match_mode = :non_current
427
440
  end
428
441
  ```
429
442
 
@@ -439,6 +452,7 @@ check tasks:
439
452
 
440
453
  ```sh
441
454
  SEMVERVE_REPORT_IGNORED=true rake semverve:check
455
+ SEMVERVE_REPORT_IGNORED=true rake 'semverve:check[1.2.2]'
442
456
  ```
443
457
 
444
458
  ### Code version literals
@@ -526,7 +540,7 @@ current version file against:
526
540
  - the matching `Gemfile.lock` entry, when a lockfile exists
527
541
 
528
542
  Metadata always requires an exact match, regardless of
529
- `config.version_reference_mode`.
543
+ `config.version_match_mode`.
530
544
 
531
545
  No file-list configuration is needed for these checks. Semverve resolves the
532
546
  gemspec from the project root and reads `Gemfile.lock` when one exists.
@@ -113,10 +113,10 @@ module Semverve
113
113
  attr_reader :version_checks
114
114
 
115
115
  ##
116
- # Version-reference comparison mode.
116
+ # Version matching mode for reference and code-literal checks.
117
117
  #
118
118
  # @return [Symbol, String]
119
- attr_accessor :version_reference_mode
119
+ attr_accessor :version_match_mode
120
120
 
121
121
  ##
122
122
  # Initializes configuration with Semverve's default settings.
@@ -137,7 +137,7 @@ module Semverve
137
137
  "tmp/**/*",
138
138
  "vendor/**/*"
139
139
  )
140
- @version_reference_mode = :older
140
+ @version_match_mode = :older
141
141
  self.release_checks = []
142
142
  self.version_checks = VALID_VERSION_CHECKS
143
143
  end
@@ -163,7 +163,7 @@ module Semverve
163
163
  version_code_reference_files: version_code_reference_files,
164
164
  version_code_reference_pattern: version_code_reference_pattern,
165
165
  version_doc_reference_files: version_doc_reference_files,
166
- version_reference_mode: normalized_version_reference_mode
166
+ version_match_mode: normalized_version_match_mode
167
167
  )
168
168
  end
169
169
 
@@ -305,11 +305,11 @@ module Semverve
305
305
  end
306
306
 
307
307
  ##
308
- # Configured version-reference mode normalized for lookup.
308
+ # Configured version matching mode normalized for lookup.
309
309
  #
310
310
  # @return [Symbol]
311
- def normalized_version_reference_mode
312
- version_reference_mode.to_sym
311
+ def normalized_version_match_mode
312
+ version_match_mode.to_sym
313
313
  end
314
314
 
315
315
  ##
@@ -478,10 +478,10 @@ module Semverve
478
478
  attr_reader :version_doc_reference_files
479
479
 
480
480
  ##
481
- # Resolved version-reference comparison mode.
481
+ # Resolved version matching mode for reference and code-literal checks.
482
482
  #
483
483
  # @return [Symbol]
484
- attr_reader :version_reference_mode
484
+ attr_reader :version_match_mode
485
485
 
486
486
  ##
487
487
  # Initializes a resolved configuration.
@@ -499,7 +499,7 @@ module Semverve
499
499
  # @param [Rake::FileList] version_code_reference_files
500
500
  # @param [Regexp] version_code_reference_pattern
501
501
  # @param [Rake::FileList] version_doc_reference_files
502
- # @param [Symbol] version_reference_mode
502
+ # @param [Symbol] version_match_mode
503
503
  #
504
504
  # @return [Semverve::ResolvedConfiguration]
505
505
  def initialize(
@@ -516,7 +516,7 @@ module Semverve
516
516
  version_code_reference_files:,
517
517
  version_code_reference_pattern:,
518
518
  version_doc_reference_files:,
519
- version_reference_mode:
519
+ version_match_mode:
520
520
  )
521
521
  @bundle_lock = bundle_lock
522
522
  @command_runner = command_runner
@@ -531,7 +531,7 @@ module Semverve
531
531
  @version_code_reference_files = version_code_reference_files
532
532
  @version_code_reference_pattern = version_code_reference_pattern
533
533
  @version_doc_reference_files = version_doc_reference_files
534
- @version_reference_mode = version_reference_mode
534
+ @version_match_mode = version_match_mode
535
535
  end
536
536
 
537
537
  ##
data/lib/semverve/task.rb CHANGED
@@ -115,19 +115,19 @@ module Semverve
115
115
  end
116
116
 
117
117
  desc "Check version references, code literals, and metadata"
118
- task :check do
119
- check
118
+ task :check, [:version] do |_task, args|
119
+ check(args)
120
120
  end
121
121
 
122
122
  namespace :check do
123
123
  desc "Check configured files for stale version references"
124
- task :references do
125
- check_references
124
+ task :references, [:version] do |_task, args|
125
+ check_references(args)
126
126
  end
127
127
 
128
128
  desc "Check configured code files for version literals"
129
- task :code do
130
- check_code
129
+ task :code, [:version] do |_task, args|
130
+ check_code(args)
131
131
  end
132
132
 
133
133
  desc "Check gem metadata for version mismatches"
@@ -147,19 +147,19 @@ module Semverve
147
147
  end
148
148
 
149
149
  desc "Fix version references, code literals, and metadata"
150
- task :fix do
151
- fix
150
+ task :fix, [:version] do |_task, args|
151
+ fix(args)
152
152
  end
153
153
 
154
154
  namespace :fix do
155
155
  desc "Replace stale version references in configured files"
156
- task :references do
157
- fix_references
156
+ task :references, [:version] do |_task, args|
157
+ fix_references(args)
158
158
  end
159
159
 
160
160
  desc "Replace safe code version literals in configured files"
161
- task :code do
162
- fix_code
161
+ task :code, [:version] do |_task, args|
162
+ fix_code(args)
163
163
  end
164
164
 
165
165
  desc "Fix safe gem metadata version mismatches"
@@ -203,11 +203,14 @@ module Semverve
203
203
  # Checks all version-maintenance surfaces.
204
204
  #
205
205
  # @return [void]
206
- def check
206
+ def check(args = nil)
207
207
  configuration, current_version = check_context
208
+ target_version = target_version_argument(args, "semverve:check")
208
209
  report_findings(
209
- check_groups(configuration, current_version),
210
+ check_groups(configuration, current_version, target_version),
210
211
  current_version,
212
+ target_version: target_version,
213
+ fix_task_name: "semverve:fix",
211
214
  clean_message: "Version checks passed."
212
215
  )
213
216
  end
@@ -216,20 +219,34 @@ module Semverve
216
219
  # Fixes all check surfaces.
217
220
  #
218
221
  # @return [void]
219
- def fix
222
+ def fix(args = nil)
220
223
  configuration, current_version = check_context
221
- report_fix_results(fix_results(configuration, current_version))
224
+ target_version = target_version_argument(args, "semverve:fix")
225
+ return report_current_target_noop(target_version) if target_version == current_version
226
+
227
+ report_fix_results(fix_results(configuration, current_version, target_version))
222
228
  end
223
229
 
224
230
  ##
225
231
  # Checks configured files for stale version references.
226
232
  #
227
233
  # @return [void]
228
- def check_references
234
+ def check_references(args = nil)
229
235
  configuration, current_version = check_context
236
+ target_version = target_version_argument(args, "semverve:check:references")
230
237
  report_findings(
231
- [["version reference", VersionReferences.new(configuration, current_version, include_ignored: report_ignored?).findings]],
238
+ [[
239
+ "version reference",
240
+ VersionReferences.new(
241
+ configuration,
242
+ current_version,
243
+ include_ignored: report_ignored?,
244
+ target_version: target_version
245
+ ).findings
246
+ ]],
232
247
  current_version,
248
+ target_version: target_version,
249
+ fix_task_name: "semverve:fix:references",
233
250
  clean_message: "Version references are current."
234
251
  )
235
252
  end
@@ -238,10 +255,16 @@ module Semverve
238
255
  # Replaces stale version references in configured files.
239
256
  #
240
257
  # @return [void]
241
- def fix_references
258
+ def fix_references(args = nil)
242
259
  configuration, current_version = check_context
260
+ target_version = target_version_argument(args, "semverve:fix:references")
261
+ return report_current_target_noop(target_version) if target_version == current_version
262
+
243
263
  report_fix_results(
244
- [["version reference", VersionReferences.new(configuration, current_version).fix]],
264
+ [[
265
+ "version reference",
266
+ VersionReferences.new(configuration, current_version, target_version: target_version).fix
267
+ ]],
245
268
  clean_message: "Version references are current."
246
269
  )
247
270
  end
@@ -250,11 +273,22 @@ module Semverve
250
273
  # Checks configured code files for version literals.
251
274
  #
252
275
  # @return [void]
253
- def check_code
276
+ def check_code(args = nil)
254
277
  configuration, current_version = check_context
278
+ target_version = target_version_argument(args, "semverve:check:code")
255
279
  report_findings(
256
- [["code version literal", VersionCodeReferences.new(configuration, current_version, include_ignored: report_ignored?).findings]],
280
+ [[
281
+ "code version literal",
282
+ VersionCodeReferences.new(
283
+ configuration,
284
+ current_version,
285
+ include_ignored: report_ignored?,
286
+ target_version: target_version
287
+ ).findings
288
+ ]],
257
289
  current_version,
290
+ target_version: target_version,
291
+ fix_task_name: "semverve:fix:code",
258
292
  clean_message: "Code version literals are current."
259
293
  )
260
294
  end
@@ -263,10 +297,16 @@ module Semverve
263
297
  # Replaces safe code version literals in configured files.
264
298
  #
265
299
  # @return [void]
266
- def fix_code
300
+ def fix_code(args = nil)
267
301
  configuration, current_version = check_context
302
+ target_version = target_version_argument(args, "semverve:fix:code")
303
+ return report_current_target_noop(target_version) if target_version == current_version
304
+
268
305
  report_fix_results(
269
- [["code version literal", VersionCodeReferences.new(configuration, current_version).fix]],
306
+ [[
307
+ "code version literal",
308
+ VersionCodeReferences.new(configuration, current_version, target_version: target_version).fix
309
+ ]],
270
310
  clean_message: "Code version literals are current."
271
311
  )
272
312
  end
@@ -336,14 +376,32 @@ module Semverve
336
376
  # @param [Semverve::ResolvedConfiguration] configuration
337
377
  # @param [Semverve::SemanticVersion] current_version
338
378
  #
379
+ # @param [Semverve::SemanticVersion, nil] target_version
380
+ #
339
381
  # @return [Array<Array(String, Array)>]
340
- def check_groups(configuration, current_version)
382
+ def check_groups(configuration, current_version, target_version = nil)
341
383
  groups = []
342
384
  if configuration.version_checks.include?(:doc_references)
343
- groups << ["version reference", VersionReferences.new(configuration, current_version, include_ignored: report_ignored?).findings]
385
+ groups << [
386
+ "version reference",
387
+ VersionReferences.new(
388
+ configuration,
389
+ current_version,
390
+ include_ignored: report_ignored?,
391
+ target_version: target_version
392
+ ).findings
393
+ ]
344
394
  end
345
395
  if configuration.version_checks.include?(:code_references)
346
- groups << ["code version literal", VersionCodeReferences.new(configuration, current_version, include_ignored: report_ignored?).findings]
396
+ groups << [
397
+ "code version literal",
398
+ VersionCodeReferences.new(
399
+ configuration,
400
+ current_version,
401
+ include_ignored: report_ignored?,
402
+ target_version: target_version
403
+ ).findings
404
+ ]
347
405
  end
348
406
  if configuration.version_checks.include?(:metadata)
349
407
  groups << [nil, VersionMetadata.new(configuration, current_version).findings]
@@ -412,20 +470,43 @@ module Semverve
412
470
  version
413
471
  end
414
472
 
473
+ ##
474
+ # Optional exact version argument for check and fix tasks.
475
+ #
476
+ # @param [Rake::TaskArguments, nil] args
477
+ # @param [String] task_name
478
+ #
479
+ # @return [Semverve::SemanticVersion, nil]
480
+ def target_version_argument(args, task_name)
481
+ version = args&.[](:version)
482
+ return nil if version.nil? || version.empty?
483
+
484
+ SemanticVersion.parse(version)
485
+ rescue Error
486
+ raise Error, "Run rake '#{task_name}[MAJOR.MINOR.PATCH]'."
487
+ end
488
+
415
489
  ##
416
490
  # Fix results enabled for the umbrella fix task.
417
491
  #
418
492
  # @param [Semverve::ResolvedConfiguration] configuration
419
493
  # @param [Semverve::SemanticVersion] current_version
494
+ # @param [Semverve::SemanticVersion, nil] target_version
420
495
  #
421
496
  # @return [Array<Array(String, #replacement_count, #changed_files)>]
422
- def fix_results(configuration, current_version)
497
+ def fix_results(configuration, current_version, target_version = nil)
423
498
  results = []
424
499
  if configuration.version_checks.include?(:doc_references)
425
- results << ["version reference", VersionReferences.new(configuration, current_version).fix]
500
+ results << [
501
+ "version reference",
502
+ VersionReferences.new(configuration, current_version, target_version: target_version).fix
503
+ ]
426
504
  end
427
505
  if configuration.version_checks.include?(:code_references)
428
- results << ["code version literal", VersionCodeReferences.new(configuration, current_version).fix]
506
+ results << [
507
+ "code version literal",
508
+ VersionCodeReferences.new(configuration, current_version, target_version: target_version).fix
509
+ ]
429
510
  end
430
511
  if configuration.version_checks.include?(:metadata)
431
512
  results << ["metadata version", VersionMetadata.new(configuration, current_version).fix]
@@ -438,10 +519,12 @@ module Semverve
438
519
  #
439
520
  # @param [Array<Array(String, Array)>] groups
440
521
  # @param [Semverve::SemanticVersion] current_version
522
+ # @param [Semverve::SemanticVersion, nil] target_version
523
+ # @param [String, nil] fix_task_name
441
524
  # @param [String] clean_message
442
525
  #
443
526
  # @return [void]
444
- def report_findings(groups, current_version, clean_message:)
527
+ def report_findings(groups, current_version, clean_message:, target_version: nil, fix_task_name: nil)
445
528
  findings = groups.flat_map do |(label, group_findings)|
446
529
  group_findings.map { |finding| [label || finding.label, finding] }
447
530
  end
@@ -454,11 +537,36 @@ module Semverve
454
537
  findings.each do |(label, finding)|
455
538
  puts "#{finding.path}:#{finding.line}:#{finding.column}: #{label} #{finding.version} -> #{current_version}"
456
539
  end
540
+ if target_version == current_version && fix_task_name && reference_or_code_findings?(findings)
541
+ puts "Target version #{target_version} is already current; #{fix_task_name}[#{target_version}] will not change these references."
542
+ end
457
543
 
458
544
  issue = findings.one? ? "issue" : "issues"
459
545
  raise Error, "Found #{findings.count} version check #{issue}."
460
546
  end
461
547
 
548
+ ##
549
+ # Prints a no-op message for exact fix requests targeting the current version.
550
+ #
551
+ # @param [Semverve::SemanticVersion, nil] target_version
552
+ #
553
+ # @return [void]
554
+ def report_current_target_noop(target_version)
555
+ puts "Target version #{target_version} is already current; nothing to fix."
556
+ end
557
+
558
+ ##
559
+ # Whether findings include references controlled by exact-target fixes.
560
+ #
561
+ # @param [Array<Array(String, Object)>] findings
562
+ #
563
+ # @return [Boolean]
564
+ def reference_or_code_findings?(findings)
565
+ findings.any? do |(label, _finding)|
566
+ ["version reference", "code version literal"].include?(label)
567
+ end
568
+ end
569
+
462
570
  ##
463
571
  # Prints fix results.
464
572
  #
@@ -15,13 +15,13 @@ module Semverve
15
15
  # Minor version.
16
16
  #
17
17
  # @return [Integer]
18
- MINOR = 2
18
+ MINOR = 3
19
19
 
20
20
  ##
21
21
  # Patch version.
22
22
  #
23
23
  # @return [Integer]
24
- PATCH = 1
24
+ PATCH = 0
25
25
 
26
26
  module_function
27
27
 
@@ -99,10 +99,11 @@ module Semverve
99
99
  # @param [Semverve::SemanticVersion] current_version
100
100
  #
101
101
  # @return [Semverve::VersionCodeReferences]
102
- def initialize(configuration, current_version, include_ignored: false)
102
+ def initialize(configuration, current_version, include_ignored: false, target_version: nil)
103
103
  @configuration = configuration
104
104
  @current_version = current_version
105
105
  @include_ignored = include_ignored
106
+ @target_version = target_version
106
107
  end
107
108
 
108
109
  ##
@@ -155,6 +156,12 @@ module Semverve
155
156
  # @return [Boolean]
156
157
  attr_reader :include_ignored
157
158
 
159
+ ##
160
+ # Exact version to match, when supplied by the task invocation.
161
+ #
162
+ # @return [Semverve::SemanticVersion, nil]
163
+ attr_reader :target_version
164
+
158
165
  ##
159
166
  # Absolute configured project root.
160
167
  #
@@ -198,7 +205,7 @@ module Semverve
198
205
  next unless match
199
206
 
200
207
  version = SemanticVersion.parse(match[:version])
201
- next if version == current_version
208
+ next unless report?(version)
202
209
 
203
210
  Finding.new(
204
211
  path: relative_path(path),
@@ -226,7 +233,7 @@ module Semverve
226
233
  next line unless match
227
234
 
228
235
  version = SemanticVersion.parse(match[:version])
229
- next line if version == current_version
236
+ next line unless report?(version)
230
237
 
231
238
  replacement_count += 1
232
239
  replace_matched_version(line)
@@ -252,6 +259,25 @@ module Semverve
252
259
  previous_nonblank_line&.include?(IGNORE_MARKER)
253
260
  end
254
261
 
262
+ ##
263
+ # Whether a referenced version should be reported or fixed.
264
+ #
265
+ # @param [Semverve::SemanticVersion] version
266
+ #
267
+ # @return [Boolean]
268
+ def report?(version)
269
+ return version == target_version if target_version
270
+
271
+ case configuration.version_match_mode
272
+ when :older
273
+ version < current_version
274
+ when :non_current
275
+ version != current_version
276
+ else
277
+ raise Error, "Unknown version match mode #{configuration.version_match_mode.inspect}. Use :older or :non_current."
278
+ end
279
+ end
280
+
255
281
  ##
256
282
  # Replaces only the named version capture in the first pattern match.
257
283
  #
@@ -107,10 +107,11 @@ module Semverve
107
107
  # @param [Semverve::SemanticVersion] current_version
108
108
  #
109
109
  # @return [Semverve::VersionReferences]
110
- def initialize(configuration, current_version, include_ignored: false)
110
+ def initialize(configuration, current_version, include_ignored: false, target_version: nil)
111
111
  @configuration = configuration
112
112
  @current_version = current_version
113
113
  @include_ignored = include_ignored
114
+ @target_version = target_version
114
115
  end
115
116
 
116
117
  ##
@@ -163,6 +164,12 @@ module Semverve
163
164
  # @return [Boolean]
164
165
  attr_reader :include_ignored
165
166
 
167
+ ##
168
+ # Exact version to match, when supplied by the task invocation.
169
+ #
170
+ # @return [Semverve::SemanticVersion, nil]
171
+ attr_reader :target_version
172
+
166
173
  ##
167
174
  # Absolute configured project root.
168
175
  #
@@ -377,13 +384,15 @@ module Semverve
377
384
  #
378
385
  # @return [Boolean]
379
386
  def report?(version)
380
- case configuration.version_reference_mode
387
+ return version == target_version if target_version
388
+
389
+ case configuration.version_match_mode
381
390
  when :older
382
391
  version < current_version
383
392
  when :non_current
384
393
  version != current_version
385
394
  else
386
- raise Error, "Unknown version reference mode #{configuration.version_reference_mode.inspect}. Use :older or :non_current."
395
+ raise Error, "Unknown version match mode #{configuration.version_match_mode.inspect}. Use :older or :non_current."
387
396
  end
388
397
  end
389
398
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semverve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Gray