Sha256: 66b435c350db297575c43e914692b8ec1b936893d7a6fe967d581f256580d229

Contents?: true

Size: 1.37 KB

Versions: 69

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module Avm
  module Files
    module Appendable
      require_sub __FILE__

      attr_reader :variables_source

      def appended
        @appended ||= []
      end

      def append_templatized_directories(directories)
        directories.each { |directory| append_templatized_directory(directory) }
        self
      end

      def append_plain_directory(directory)
        appended << ::Avm::Files::Appendable::PlainDirectory.new(self, directory)
        self
      end

      def append_tar_output_command(tar_command)
        appended << ::Avm::Files::Appendable::TarOutputCommand.new(self, tar_command)
        self
      end

      def append_templatized_directory(directory)
        appended << ::Avm::Files::Appendable::TemplatizedDirectory.new(self, directory)
        self
      end

      def append_file_content(target_path, content)
        appended << ::Avm::Files::Appendable::FileContent
                    .new(self, target_path, content)
        self
      end

      def variables_source_set(source)
        @variables_source = source
        self
      end

      def write_appended_on(target_dir)
        target_dir = target_dir.to_pathname
        raise "\"#{target_dir}\" is not a directory" unless target_dir.directory?

        appended.each { |append| append.write_on(target_dir) }
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 3 rubygems

Version Path
avm-tools-0.116.1 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.116.0 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.115.0 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.114.2 sub/avm-files/lib/avm/files/appendable.rb
avm-files-0.3.0 lib/avm/files/appendable.rb
avm-tools-0.114.1 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.114.0 sub/avm-files/lib/avm/files/appendable.rb
avm-files-0.2.1 lib/avm/files/appendable.rb
avm-tools-0.113.6 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.113.5 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.113.4 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.113.3 sub/avm-files/lib/avm/files/appendable.rb
avm-tools-0.113.2 sub/avm-files/lib/avm/files/appendable.rb
avm-files-0.2.0 lib/avm/files/appendable.rb
avm-tools-0.110.0 vendor/avm-files/lib/avm/files/appendable.rb
avm-tools-0.109.1 vendor/avm-files/lib/avm/files/appendable.rb
avm-files-0.1.0 lib/avm/files/appendable.rb
avm-tools-0.109.0 vendor/avm-files/lib/avm/files/appendable.rb
avm-0.5.0 lib/avm/files/appendable.rb
avm-tools-0.108.0 vendor/avm/lib/avm/files/appendable.rb