Class: Glyphs::PruneRunner
- Inherits:
-
Object
- Object
- Glyphs::PruneRunner
- Defined in:
- lib/glyphs/prune_runner.rb
Overview
Defined Under Namespace
Classes: VerificationError
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(root: default_root, icons_root: default_icons_root, dry_run: true, config: Glyphs.configuration) ⇒ PruneRunner
constructor
A new instance of PruneRunner.
-
#verify! ⇒ Object
Asserts every kept icon resolves to a file on disk.
Constructor Details
#initialize(root: default_root, icons_root: default_icons_root, dry_run: true, config: Glyphs.configuration) ⇒ PruneRunner
Returns a new instance of PruneRunner.
18 19 20 21 22 23 |
# File 'lib/glyphs/prune_runner.rb', line 18 def initialize(root: default_root, icons_root: default_icons_root, dry_run: true, config: Glyphs.configuration) @root = root @icons_root = icons_root @dry_run = dry_run @config = config end |
Class Method Details
.call ⇒ Object
14 15 16 |
# File 'lib/glyphs/prune_runner.rb', line 14 def self.call(**) new(**).call end |
Instance Method Details
#call ⇒ Object
25 26 27 28 29 |
# File 'lib/glyphs/prune_runner.rb', line 25 def call report = pruner.call verify! unless @dry_run report end |
#verify! ⇒ Object
Asserts every kept icon resolves to a file on disk. Raises VerificationError listing the first few misses.
33 34 35 36 37 38 39 40 |
# File 'lib/glyphs/prune_runner.rb', line 33 def verify! missing = expected_files.reject { |path| File.exist?(path) } return if missing.empty? names = missing.first(10).map { |path| relative(path) } raise VerificationError, "#{missing.size} kept icon(s) missing after prune: #{names.join(', ')}" end |