Sha256: 238c1c067ec0c153fee99c84f880f5caced76620f9b7d2ca7cd58161b520c600

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

# frozen_string_literal: true
require_relative 'indexes_generator'
module KCommercial
  module Resources
    class FilesIndexesGenerator < IndexesGenerator

      def write_files
        asset_objects.each do |asset|
          asset.trait_rows.each do |row|
            path = root_path.join(row.resource.basename)
            FileUtils.cp row.resource, path
          end
        end
      end

      def indexes_filename
        'files'
      end

      def index_resources
        hash = super
        asset_objects.each do |asset|
          hash[asset.name] = asset.trait_rows.map do |row|
            {
              :traits => row.traits,
              :resource => row.resource.basename.to_s
            }
          end
        end
        hash
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
KCommercialPipeline-0.2.5.1 lib/KCommercialPipeline/core/resource/bundle/files_generator.rb