Class: Extension::Features::Argo

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/project_types/extension/features/argo.rb

Constant Summary collapse

SCRIPT_PATH =
%w(build main.js).freeze

Instance Method Summary collapse

Instance Method Details

#config(context, include_renderer_version: true) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/project_types/extension/features/argo.rb', line 26

def config(context, include_renderer_version: true)
  filepath = File.join(context.root, SCRIPT_PATH)
  context.abort(context.message("features.argo.missing_file_error")) unless File.exist?(filepath)

  renderer_version = nil
  if include_renderer_version
    renderer_version = renderer_package(context).version
  end

  begin
    {
      renderer_version: renderer_version,
      serialized_script: Base64.strict_encode64(File.read(filepath).chomp),
    }
  rescue StandardError
    context.abort(context.message("features.argo.script_prepare_error"))
  end
end

#create(directory_name, identifier, context) ⇒ Object



22
23
24
# File 'lib/project_types/extension/features/argo.rb', line 22

def create(directory_name, identifier, context)
  Features::ArgoSetup.new(git_template: git_template).call(directory_name, identifier, context)
end

#renderer_package(context) ⇒ Object



45
46
47
# File 'lib/project_types/extension/features/argo.rb', line 45

def renderer_package(context)
  Tasks::FindPackageFromJson.call(renderer_package_name, context: context)
end