Class: EventEngine::DomainPackBuild

Inherits:
Object
  • Object
show all
Defined in:
lib/event_engine/domain_pack_build.rb

Constant Summary collapse

PORT_EMIT =
"EventEngine::Definition.publisher.publish"
SCHEMA_FILENAME =
"schema.json"
HEADER =
<<~RUBY.freeze
  # This file is authoritative in production.
  # It is generated from this pack's EventDefinitions.
  # Do not edit manually.

RUBY

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definitions, helper_path:, root_module:, header:, subject_registry:) ⇒ DomainPackBuild

Returns a new instance of DomainPackBuild.



32
33
34
35
36
37
38
# File 'lib/event_engine/domain_pack_build.rb', line 32

def initialize(definitions, helper_path:, root_module:, header:, subject_registry:)
  @definitions = definitions
  @helper_path = helper_path
  @root_module = root_module
  @header = header
  @subject_registry = subject_registry
end

Class Method Details

.run(definitions, helper_path:, root_module:, header: HEADER, subject_registry: SubjectRegistry.new) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/event_engine/domain_pack_build.rb', line 21

def self.run(definitions, helper_path:, root_module:, header: HEADER,
             subject_registry: SubjectRegistry.new)
  new(
    definitions,
    helper_path: helper_path,
    root_module: root_module,
    header: header,
    subject_registry: subject_registry
  ).run
end

Instance Method Details

#runObject



40
41
42
43
44
45
# File 'lib/event_engine/domain_pack_build.rb', line 40

def run
  event_schema = compile
  write_helper(event_schema)
  write_schema_json(event_schema)
  self
end

#schema_pathObject



47
48
49
# File 'lib/event_engine/domain_pack_build.rb', line 47

def schema_path
  File.join(File.dirname(@helper_path), SCHEMA_FILENAME)
end