Class: DTK::Client::Operation::Module::Update

Inherits:
DTK::Client::Operation::Module show all
Defined in:
lib/client/operation/module/update.rb

Constant Summary

Constants inherited from DTK::Client::Operation::Module

BaseRoute, MODULE_LOCK, OPERATIONS

Constants inherited from DTK::Client::Operation

TYPES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DTK::Client::Operation::ModuleServiceCommon::ClassMixin

#method_missing, #respond_to?

Methods included from Auxiliary

#hash_to_yaml, #snake_form, #snake_to_camel_case, #yaml_to_hash

Instance Attribute Details

#module_refObject (readonly)

Returns the value of attribute module_ref.



21
22
23
# File 'lib/client/operation/module/update.rb', line 21

def module_ref
  @module_ref
end

#target_repo_dirObject (readonly)

Returns the value of attribute target_repo_dir.



21
22
23
# File 'lib/client/operation/module/update.rb', line 21

def target_repo_dir
  @target_repo_dir
end

#versionObject (readonly)

Returns the value of attribute version.



21
22
23
# File 'lib/client/operation/module/update.rb', line 21

def version
  @version
end

Class Method Details

.execute(args = Args.new) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/client/operation/module/update.rb', line 30

def self.execute(args = Args.new)
  wrap_operation(args) do |args|
    module_ref        = args.required(:module_ref)
    base_dsl_file_obj = args.required(:base_dsl_file_obj)
    directory_path    = args[:directory_path]
    new('dtkn', module_ref, directory_path).update({file_obj: base_dsl_file_obj})
  end
end

Instance Method Details

#update(opts = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/client/operation/module/update.rb', line 39

def update(opts = {})
  file_obj = opts[:file_obj]
  parsed_module = file_obj.parse_content(:common_module_summary)

  module_info = {
    name: module_ref.module_name,
    namespace: module_ref.namespace,
    version: @version,
    repo_dir: @target_repo_dir
  }

  response = DtkNetworkClient::Update.run(module_info, parsed_module: parsed_module)
  OsUtil.print_info("Dependencies updated successfully")

  nil
end