Class: Ea::Spa::Output::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/spa/output/strategy.rb

Overview

Abstract output strategy. Concrete subclasses project the same SPA artifacts (skeleton, search index, shards) to disk in different layouts.

Adding a new layout = new subclass + registration in Generator::OUTPUT_STRATEGIES. No edit to Projector or existing strategies.

Direct Known Subclasses

ShardedMultiFileStrategy, SingleFileStrategy

Constant Summary collapse

SIZE_THRESHOLD_BYTES =

2 MB

2 * 1024 * 1024
FRONTEND_DIST_DIR =

Path to the pre-built Vue IIFE bundle shipped with the gem. Built from frontend/ via npm run build; committed so the gem never needs npm at install time. Resolved lazily so a missing bundle raises a clear error pointing at frontend/.

File.expand_path("../../../../frontend/dist", __dir__)
FRONTEND_APP_JS =
File.join(FRONTEND_DIST_DIR, "app.iife.js")
FRONTEND_STYLE_CSS =
File.join(FRONTEND_DIST_DIR, "style.css")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_path) ⇒ Strategy

Returns a new instance of Strategy.



28
29
30
# File 'lib/ea/spa/output/strategy.rb', line 28

def initialize(output_path)
  @output_path = output_path
end

Instance Attribute Details

#output_pathObject (readonly)

Returns the value of attribute output_path.



26
27
28
# File 'lib/ea/spa/output/strategy.rb', line 26

def output_path
  @output_path
end

Instance Method Details

#render(_projector) ⇒ Object

Raises:

  • (NotImplementedError)


32
33
34
35
# File 'lib/ea/spa/output/strategy.rb', line 32

def render(_projector)
  raise NotImplementedError,
        "#{self.class} must implement #render"
end