class DTK::Client::Operation::Module::Update

Attributes

module_ref[R]
target_repo_dir[R]
version[R]

Public Class Methods

execute(args = Args.new) click to toggle source
# 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
new(catalog, module_ref, directory_path) click to toggle source
# File lib/client/operation/module/update.rb, line 22
def initialize(catalog, module_ref, directory_path)
  @catalog         = catalog
  @module_ref      = module_ref
  @target_repo_dir = directory_path || module_ref.client_dir_path
  @version         = module_ref.version
end

Public Instance Methods

update(opts = {}) click to toggle source
# 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