Class: VivlioStarter::CLI::SamovarCommands::IndexApplyCommand

Inherits:
VsCommand
  • Object
show all
Defined in:
lib/vivlio_starter/cli/samovar/index_command.rb

Overview

index:apply コマンド - レビュー結果を適用

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/vivlio_starter/cli/samovar/index_command.rb', line 166

def call
  return print_usage if options[:help]

  # 前提条件の検証(ProjectRoot ◎ / CatalogFile ◎ / ContentsDir ◎)
  guard_failure = Guards.precheck(
    Guards::ProjectRootCheck.new,
    Guards::CatalogFileCheck.new,
    Guards::ContentsDirCheck.new
  )
  return guard_failure if guard_failure

  ENV['VERBOSE'] = '1' if options[:verbose]

  manager = UnifiedIndexManager.new
  manager.apply_markdown_review!
  0
rescue SystemExit => e
  raise e
rescue StandardError => e
  Common.log_error("index:apply 実行中にエラー: #{e.message}")
  Common.log_error(e.backtrace.first(5).join("\n")) if ENV['VERBOSE']
  1
end