Sha256: ff618ef842b99cb7e55a63dd5f42f462e1d792359ed8301a710ea1c3166ab306

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/fs/clearable_directory'

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

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

      def run
        infov 'Files to build', source_files.count
        target_directory.clear
        source_files.each(&:run)
      end

      def default_target_directory
        project.root.join('build')
      end

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

      def source_files_uncached
        r = []
        project.root.children.each do |child|
          next unless SOURCE_EXTNAMES.include?(child.extname)

          r << ::Avm::EacAsciidoctorBase0::Build::File.new(self, child.basename)
        end
        r
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
avm-tools-0.96.0 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.95.0 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.94.3 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.94.2 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.94.1 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.94.0 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.93.0 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.92.0 lib/avm/eac_asciidoctor_base0/build.rb
avm-tools-0.91.0 lib/avm/eac_asciidoctor_base0/build.rb