Class: Extension::Models::SpecificationHandlers::WebPixelExtension
- Inherits:
-
Default
- Object
- Default
- Extension::Models::SpecificationHandlers::WebPixelExtension
show all
- Defined in:
- lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb
Constant Summary
collapse
- SCRIPT_FILE =
"build/main.js"
Instance Attribute Summary
Attributes inherited from Default
#specification
Instance Method Summary
collapse
Methods inherited from Default
#argo_runtime, #build_resource_url, #choose_port?, #cli_package, #create, #establish_tunnel?, #extension_context, #graphql_identifier, #identifier, #initialize, #message_for_extension, #renderer_package, #serve, #server_config_file, #server_config_path, #supplies_resource_url?, #tagline, #valid_extension_contexts
Instance Method Details
#access_config_property(context, ext_config, key, &process_value) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb', line 21
def access_config_property(context, ext_config, key, &process_value)
context.abort(context.message("core.extension.push.web_pixel_extension.error.missing_config_key_error",
key)) unless ext_config.key?(key)
begin
process_value.nil? ? ext_config[key] : process_value.call(ext_config[key])
rescue StandardError
context.abort(context.message("core.extension.push.web_pixel_extension.error.invalid_config_value_error",
key))
end
end
|
#config(context) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb', line 33
def config(context)
begin
ext_config = WebPixelExtensionUtils::ScriptConfigYmlRepository.new(ctx: context).get!.content
rescue StandardError
context.abort(context.message("core.extension.push.web_pixel_extension.error.file_read_error",
WebPixelExtensionUtils::ScriptConfigYmlRepository.filename))
end
begin
script_contents = File.read(File.join(context.root, SCRIPT_FILE)).chomp
rescue
context.abort(context.message("core.extension.push.web_pixel_extension.error.file_read_error", SCRIPT_FILE))
end
{
runtime_context: access_config_property(context, ext_config, "runtime_context"),
serialized_script: Base64.strict_encode64(script_contents),
runtime_configuration_definition: access_config_property(context, ext_config,
"configuration", &:to_json),
config_version: access_config_property(context, ext_config,
"version", &:to_s),
}
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb', line 14
def name
"Web Pixel Extension"
end
|
#read_configuration ⇒ Object
18
19
|
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension.rb', line 18
def read_configuration
end
|