Class: VivlioStarter::CLI::BuildCommands::UnifiedBuildPipeline
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::BuildCommands::UnifiedBuildPipeline
- Defined in:
- lib/vivlio_starter/cli/build/pipeline.rb
Overview
UnifiedBuildPipeline: フル/単章ビルド統合パイプライン
- BuildCommands#build から利用し、各 Step の処理と計時を一元管理する。
- mode: :full(全章ビルド)または :single(単章/複数章ビルド)
- single mode では Step 6〜12, 14 をスキップし、Step 5 で entries.js + pdf を生成
Defined Under Namespace
Classes: Step
Constant Summary collapse
- PHASE_ORDER =
相の実行順(build-target-parallelization-spec.md §1.1)。 :shared = 両ターゲットが読む中間物を作る共通前段 :pdf = 閲覧用・入稿用 PDF の枝 / :epub = EPUB・Kindle の枝 :join = 両枝の完了後(ワークスペースの掃除) :pdf と :epub は互いに独立なので、両方に仕事があるときは並列に走らせる。 :single / :preflight モードは相を持たない(すべて :shared 扱い)。
%i[shared pdf epub join].freeze
- PARALLEL_NOTICE =
分岐した直後に 1 行だけ出す予告。EPUB 枝のログは合流時にまとめて出るので、 黙っていると「何も起きていない時間」に見える。
'[parallel] EPUB/Kindle を並行生成しています(ログは完了時にまとめて出ます)'
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#generated_pdf_name ⇒ Object
readonly
Returns the value of attribute generated_pdf_name.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#parallel_step_labels ⇒ Object
readonly
Returns the value of attribute parallel_step_labels.
-
#targets ⇒ Object
readonly
Returns the value of attribute targets.
-
#timings ⇒ Object
readonly
Returns the value of attribute timings.
-
#wall_time ⇒ Object
Returns the value of attribute wall_time.
Instance Method Summary collapse
-
#initialize(command, entries: [], mode: :full, targets: nil) ⇒ UnifiedBuildPipeline
constructor
A new instance of UnifiedBuildPipeline.
-
#run ⇒ Object
登録済みステップを相の順に実行し、経過時間を収集する。 :pdf と :epub は互いに独立なので、両方に仕事があるときは並列に走らせる。.
Constructor Details
#initialize(command, entries: [], mode: :full, targets: nil) ⇒ UnifiedBuildPipeline
Returns a new instance of UnifiedBuildPipeline.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 53 def initialize(command, entries: [], mode: :full, targets: nil) @command = command @entries = Array(entries) @mode = mode @options = command. @targets = targets || Build::Targets.resolve @timings = [] @steps = [] @generated_pdf_name = nil @parallel_step_labels = [] @aborted = false register_steps end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def entries @entries end |
#generated_pdf_name ⇒ Object (readonly)
Returns the value of attribute generated_pdf_name.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def generated_pdf_name @generated_pdf_name end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def mode @mode end |
#parallel_step_labels ⇒ Object (readonly)
Returns the value of attribute parallel_step_labels.
45 46 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 attr_reader :timings, :mode, :entries, :generated_pdf_name, :targets, :wall_time, :parallel_step_labels |
#targets ⇒ Object (readonly)
Returns the value of attribute targets.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def targets @targets end |
#timings ⇒ Object (readonly)
Returns the value of attribute timings.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def timings @timings end |
#wall_time ⇒ Object
Returns the value of attribute wall_time.
45 46 47 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 45 def wall_time @wall_time end |
Instance Method Details
#run ⇒ Object
登録済みステップを相の順に実行し、経過時間を収集する。 :pdf と :epub は互いに独立なので、両方に仕事があるときは並列に走らせる。
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/vivlio_starter/cli/build/pipeline.rb', line 69 def run ensure_entry_files_exist! Common.ensure_build_workspace! Common.reset_vivliostyle_build_timings # 回転テーブルの画像を PDF 枝が用意する構成でだけ、Kindle 枝を待たせる。 # 待つ相手がいないビルドで永久に待たないよう、ここで明示的に宣言する。 Build::RotateTableImages.arm!(mode == :full && rotate_table_images?) started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) run_phase(:shared) fork_branches? ? run_branches_in_parallel : run_branches_sequentially run_phase(:join) timings ensure @wall_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started_at if started_at end |