Class: Lyman::CLI::Commands::Update
- Inherits:
-
Object
- Object
- Lyman::CLI::Commands::Update
- Defined in:
- lib/lyman/cli/commands/update.rb
Overview
lyman update — walks the manifest (never the filesystem) and
reconciles every managed artifact against the current lyman release.
Three tiers per docs/design/deployment.md: managed artifacts either
replace silently (pristine) or halt with a structured message
(modified/missing); owned artifacts are the user's and are skipped;
ejected artifacts get a one-time advisory. Artifacts not in the
manifest are never even looked at.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(thor, source_root:) ⇒ Update
constructor
A new instance of Update.
Constructor Details
#initialize(thor, source_root:) ⇒ Update
Returns a new instance of Update.
12 13 14 15 |
# File 'lib/lyman/cli/commands/update.rb', line 12 def initialize(thor, source_root:) @thor = thor @source_root = source_root end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lyman/cli/commands/update.rb', line 17 def call project_root = Manifest.find! manifest = Manifest.load(project_root) updated = [] up_to_date = [] halted = [] advisories = [] manifest.artifacts.each_key.to_a.each do |name| spec = Registry::ARTIFACTS[name] next unless spec # unknown-to-this-release entries are left alone entry = manifest.artifact(name) case entry["status"] when "managed" reconcile_managed(manifest, project_root, name, spec, entry, updated, up_to_date, halted) when "owned" next # the user's file; update never touches it when "ejected" reconcile_ejected(manifest, name, spec, entry, advisories) end end manifest.save summarize(updated, up_to_date, halted, advisories) exit 1 unless halted.empty? end |