Class: Mxrb::Compiler::PageBundleBuilder
- Inherits:
-
Object
- Object
- Mxrb::Compiler::PageBundleBuilder
- Defined in:
- lib/mxrb/compiler/page_bundle_builder.rb
Overview
Writes one page entry module per source page and an auditable support manifest. rubocop:disable Metrics
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(source, web_root) ⇒ PageBundleBuilder
constructor
A new instance of PageBundleBuilder.
Constructor Details
#initialize(source, web_root) ⇒ PageBundleBuilder
Returns a new instance of PageBundleBuilder.
11 12 13 14 |
# File 'lib/mxrb/compiler/page_bundle_builder.rb', line 11 def initialize(source, web_root) @source = source @web_root = web_root end |
Instance Method Details
#build ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mxrb/compiler/page_bundle_builder.rb', line 16 def build destination = File.join(@web_root, 'pages') FileUtils.mkdir_p(destination) Dir.glob(File.join(destination, '**', '*.js')).each { FileUtils.rm_f(_1) } bundles = @source.units_of('Forms$Page').select { web_page?(_1) } .map { PageBundleCompiler.new(@source).compile(_1) } bundles.each { write_bundle(destination, _1) } layout_bundles = build_layouts write_manifest(bundles) bundles + layout_bundles end |