Class: Locomotive::Mounter::Writer::FileSystem::ContentAssetsWriter

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/mounter/writer/file_system/content_assets_writer.rb

Instance Attribute Summary

Attributes inherited from Base

#mounting_point, #runner

Instance Method Summary collapse

Methods inherited from Base

#create_folder, #initialize, #open_file, #target_path

Constructor Details

This class inherits a constructor from Locomotive::Mounter::Writer::FileSystem::Base

Instance Method Details

#prepareObject

It creates the content assets folder



9
10
11
12
# File 'lib/locomotive/mounter/writer/file_system/content_assets_writer.rb', line 9

def prepare
  super
  self.create_folder 'public'
end

#writeObject

It writes all the content assets into files



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/locomotive/mounter/writer/file_system/content_assets_writer.rb', line 15

def write
  self.mounting_point.content_assets.each do |_, asset|
    self.output_resource_op asset

    self.open_file(self.target_asset_path(asset), 'wb') do |file|
      file.write(asset.content)
    end

    self.output_resource_op_status asset
  end
end