Class: Inquirex::Tools::VersionChecker
- Inherits:
-
Object
- Object
- Inquirex::Tools::VersionChecker
- Defined in:
- lib/inquirex/tools/version_checker.rb
Overview
Reports version parity across the lockstep packages.
Read-only by construction: nothing here writes a version file. Bumping is VersionBumper's job. The split means a check can be run anywhere — CI, a dirty tree, a colleague's checkout — with no chance of editing something, and the two behaviours no longer share a flag that decides which happens.
Instance Method Summary collapse
-
#call ⇒ Boolean
Prints the current state of every lockstep package.
-
#initialize(workspace: Workspace.new, out: $stdout) ⇒ VersionChecker
constructor
A new instance of VersionChecker.
-
#preflight ⇒ Boolean
Parity plus git readiness: clean tree, on main, tagged at the version.
Constructor Details
#initialize(workspace: Workspace.new, out: $stdout) ⇒ VersionChecker
Returns a new instance of VersionChecker.
20 21 22 23 |
# File 'lib/inquirex/tools/version_checker.rb', line 20 def initialize(workspace: Workspace.new, out: $stdout) @workspace = workspace @out = out end |
Instance Method Details
#call ⇒ Boolean
Prints the current state of every lockstep package.
28 29 30 31 32 |
# File 'lib/inquirex/tools/version_checker.rb', line 28 def call versions = workspace.versions print_table(versions) verdict(versions) end |
#preflight ⇒ Boolean
Parity plus git readiness: clean tree, on main, tagged at the version.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/inquirex/tools/version_checker.rb', line 37 def preflight ok = call target = workspace.versions.values.compact.uniq.first out.puts out.puts "Release readiness:" Workspace::LOCKSTEP.each_key do |name| problems = readiness_problems(name, target) # `.green`, not `.bright_green`: colored2 defines no such method, so # the ready branch raised NoMethodError — and only the ready branch, # which is why a preflight that found problems looked fine. out.puts format(" %<name>-16s %<state>s", name: name, state: problems.empty? ? "ready".green : problems.join(", ").red) ok &&= problems.empty? end out.puts out.puts ok ? "ALL READY — publish with `gem push` / `npm publish`" : "NOT READY — resolve the above" ok end |