Class: VivlioStarter::CLI::SamovarCommands::CoverCommand

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

Overview

cover コマンドの Samovar 実装

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vivlio_starter/cli/samovar/cover_command.rb', line 28

def call
  return print_usage if options[:help]

  # 前提条件の検証(ProjectRoot ◎ / ImagesDir ○)
  guard_failure = Guards.precheck(
    Guards::ProjectRootCheck.new,
    Guards::RelaxedCheck.new(Guards::ImagesDirCheck.new)
  )
  return guard_failure if guard_failure

  case target || 'auto'
  when 'auto', 'all'
    CoverCommands.execute_generate(self)
  when 'a4'
    CoverCommands.execute_for_size(:a4, self)
  when 'b5'
    CoverCommands.execute_for_size(:b5, self)
  when 'a5'
    CoverCommands.execute_for_size(:a5, self)
  when 'epub'
    CoverCommands.execute_epub(self)
  else
    Common.log_error("未知のカバー種別です: #{target}")
    Common.log_info('指定可能な値: auto, a4, b5, a5, epub')
    return 1
  end

  0
end