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.



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

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



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

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



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

def run
  event_schema = compile
  FileUtils.mkdir_p(File.dirname(@helper_path))
  write_helper(event_schema)
  write_schema_json(event_schema)
  self
end

#schema_pathObject



49
50
51
# File 'lib/event_engine/domain_pack_build.rb', line 49

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