Class: Mxrb::Compiler::DeploymentAssetCopier

Inherits:
Object
  • Object
show all
Includes:
ModelValues
Defined in:
lib/mxrb/compiler/deployment_asset_copier.rb

Overview

Copies project-owned libraries, resources, and compiled theme assets into deployment.

Constant Summary collapse

SAFE_IDENTIFIER =
/\A[A-Za-z_][A-Za-z0-9_]*\z/

Instance Method Summary collapse

Constructor Details

#initialize(project_root, deployment, copier, source: nil) ⇒ DeploymentAssetCopier

Returns a new instance of DeploymentAssetCopier.



13
14
15
16
17
18
# File 'lib/mxrb/compiler/deployment_asset_copier.rb', line 13

def initialize(project_root, deployment, copier, source: nil)
  @project_root = project_root
  @deployment = deployment
  @copier = copier
  @source = source
end

Instance Method Details

#copyObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/mxrb/compiler/deployment_asset_copier.rb', line 20

def copy
  %w[userlib vendorlib].each do |name|
    @copier.call(File.join(@project_root, name), File.join(@deployment, 'model', 'lib', 'userlib'))
  end
  copy_root('resources', 'model/resources')
  copy_root('theme/web', 'web')
  copy_root('theme-cache/web', 'web')
  copy_theme_public_assets
  export_images if @source
end