Module: VivlioStarter::CLI::Guards

Defined in:
lib/vivlio_starter/cli/guards.rb,
lib/vivlio_starter/cli/guards/base_check.rb,
lib/vivlio_starter/cli/guards/node_check.rb,
lib/vivlio_starter/cli/guards/relaxed_check.rb,
lib/vivlio_starter/cli/guards/code_fence_check.rb,
lib/vivlio_starter/cli/guards/images_dir_check.rb,
lib/vivlio_starter/cli/guards/container_scanner.rb,
lib/vivlio_starter/cli/guards/orphan_file_check.rb,
lib/vivlio_starter/cli/guards/catalog_file_check.rb,
lib/vivlio_starter/cli/guards/contents_dir_check.rb,
lib/vivlio_starter/cli/guards/pdf_artifact_check.rb,
lib/vivlio_starter/cli/guards/project_root_check.rb,
lib/vivlio_starter/cli/guards/chapter_target_check.rb,
lib/vivlio_starter/cli/guards/image_filename_check.rb,
lib/vivlio_starter/cli/guards/catalog_entries_check.rb,
lib/vivlio_starter/cli/guards/config_validity_check.rb,
lib/vivlio_starter/cli/guards/container_class_check.rb,
lib/vivlio_starter/cli/guards/container_fence_check.rb

Defined Under Namespace

Modules: ContainerScanner, Guard Classes: BaseCheck, CatalogEntriesCheck, CatalogFileCheck, ChapterTargetCheck, CodeFenceCheck, ConfigValidityCheck, ContainerClassCheck, ContainerFenceCheck, ContentsDirCheck, GuardError, ImageFilenameCheck, ImagesDirCheck, NodeCheck, OrphanFileCheck, PdfArtifactCheck, ProjectRootCheck, RelaxedCheck, Violation

Class Method Summary collapse

Class Method Details

.precheck(*checks) ⇒ Object

コマンドの call 冒頭用ヘルパー。Guard を実行し、 違反時は要約を 🔴 で表示して終了コード 1 を返す(合格時は nil)。

使用例:

guard_failure = Guards.precheck(Guards::ProjectRootCheck.new)
return guard_failure if guard_failure


90
91
92
93
94
95
96
# File 'lib/vivlio_starter/cli/guards.rb', line 90

def precheck(*checks)
  Guard.run!(*checks)
  nil
rescue GuardError => e
  Common.log_error(e.message)
  1
end