Class: Dapp::Dimg::Builder::Ruby2Go

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/dimg/builder/ruby2go.rb

Direct Known Subclasses

Ansible, None, Shell

Instance Attribute Summary

Attributes inherited from Base

#dimg

Instance Method Summary collapse

Methods inherited from Base

#before_build_check, #before_dimg_should_be_built_check, #before_install, #before_install?, #before_install_checksum, #before_setup, #before_setup?, #before_setup_checksum, #build_artifact, #build_artifact?, #build_artifact_checksum, #initialize, #install, #install?, #install_checksum, #setup, #setup?, #setup_checksum

Constructor Details

This class inherits a constructor from Dapp::Dimg::Builder::Base

Instance Method Details

#get_ruby2go_state_hashObject



40
41
42
43
44
45
# File 'lib/dapp/dimg/builder/ruby2go.rb', line 40

def get_ruby2go_state_hash
  {
    "TmpPath" => dimg.tmp_path.to_s,
    "ContainerDappPath" => dimg.container_dapp_path.to_s,
  }
end

#ruby2go_builder_command(command:, **options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dapp/dimg/builder/ruby2go.rb', line 23

def ruby2go_builder_command(command:, **options)
  (options[:options] ||= {}).merge!(host_docker_config_dir: dimg.dapp.class.host_docker_config_dir)
  builder = self.class.name.split("::").last.downcase
  command_options = {
    builder: builder,
    command: command,
    config: YAML.dump(dimg.config),
    extra: get_ruby2go_state_hash,
    artifact: dimg.artifact?
  }.merge(options)

  dimg.dapp.ruby2go_builder(command_options).tap do |res|
    raise Error::Build, code: :ruby2go_builder_command_failed_unexpected_error, data: { command: command, message: res["error"] } unless res["error"].nil?
    break res['data']
  end
end

#snake_case_to_camel_case(value) ⇒ Object



47
48
49
# File 'lib/dapp/dimg/builder/ruby2go.rb', line 47

def snake_case_to_camel_case(value)
  value.to_s.split('_').collect(&:capitalize).join
end