Sha256: f7baf5b7ceb7518381a2716ff40d0962f5e1dbb71c42e558836af3ca2c56f662

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require 'avm/eac_asciidoctor_base0/documents_owner'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/fs/clearable_directory'

module Avm
  module EacAsciidoctorBase0
    module Instances
      class Build
        require_sub __FILE__
        include ::Avm::EacAsciidoctorBase0::DocumentsOwner
        enable_speaker
        enable_simple_cache
        enable_listable
        lists.add_symbol :option, :target_directory
        common_constructor :instance, :options, default: [{}] do
          self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
        end

        SOURCE_EXTNAMES = %w[.adoc .asc].freeze

        def perform
          infov 'Documents to build', root_document.tree_documents_count
          target_directory.clear
          root_document.perform
        end

        def default_target_directory
          source.path.join('build')
        end

        def root_document
          ::Avm::EacAsciidoctorBase0::Instances::Build::Document
            .new(self, nil, source.root_document)
        end

        # @return [Avm::EacAsciidoctorBase0::Sources::Base]
        def source
          instance.application.local_source
        end

        def target_directory
          ::EacRubyUtils::Fs::ClearableDirectory.new(
            options[OPTION_TARGET_DIRECTORY] || default_target_directory
          )
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
eac_tools-0.87.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
avm-eac_asciidoctor_base0-0.22.1 lib/avm/eac_asciidoctor_base0/instances/build.rb
eac_tools-0.86.13 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
avm-eac_asciidoctor_base0-0.22.0 lib/avm/eac_asciidoctor_base0/instances/build.rb
eac_tools-0.85.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
eac_tools-0.84.2 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
eac_tools-0.84.1 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
avm-eac_asciidoctor_base0-0.21.0 lib/avm/eac_asciidoctor_base0/instances/build.rb
eac_tools-0.84.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb