Class: KCommercial::Resources::FilesIndexesGenerator

Inherits:
IndexesGenerator show all
Defined in:
lib/KCommercialPipeline/core/resource/bundle/files_generator.rb

Instance Attribute Summary

Attributes inherited from IndexesGenerator

#asset_objects, #root_path

Instance Method Summary collapse

Methods inherited from IndexesGenerator

#generate!, #initialize

Constructor Details

This class inherits a constructor from KCommercial::Resources::IndexesGenerator

Instance Method Details

#index_resourcesObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/KCommercialPipeline/core/resource/bundle/files_generator.rb', line 20

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

#indexes_filenameObject



16
17
18
# File 'lib/KCommercialPipeline/core/resource/bundle/files_generator.rb', line 16

def indexes_filename
  'files'
end

#write_filesObject



7
8
9
10
11
12
13
14
# File 'lib/KCommercialPipeline/core/resource/bundle/files_generator.rb', line 7

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