Class: DTK::Client::Operation::Module::Install

Inherits:
DTK::Client::Operation::Module show all
Defined in:
lib/client/operation/module/install.rb,
lib/client/operation/module/install/mixin.rb,
lib/client/operation/module/install/module_ref.rb,
lib/client/operation/module/install/print_helper.rb,
lib/client/operation/module/install/common_module.rb,
lib/client/operation/module/install/dependent_modules.rb

Direct Known Subclasses

CommonModule

Defined Under Namespace

Modules: Mixin Classes: CommonModule, DependentModules, ModuleRef, PrintHelper, TerminateInstall

Constant Summary

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

BaseRoute, MODULE_LOCK, OPERATIONS

Constants inherited from DTK::Client::Operation

TYPES

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

Class Method Details

.execute(args = Args.new) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/client/operation/module/install.rb', line 37

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)
    has_directory_param    = args[:has_directory_param]
    has_remote_repo        = args[:has_remote_repo]
    update_deps            = args[:update_deps]
    install_from           = args[:install_from]

    case update_deps
    when "prompt"
      update_deps          = nil
    when false 
      no_update_deps       = true
    end

    if has_directory_param
      file_obj = args.required(:base_dsl_file_obj).raise_error_if_no_content_flag(:module_ref)
    else
      file_obj = args.required(:base_dsl_file_obj).raise_error_if_no_content
    end

    new(file_obj, module_ref, has_remote_repo, install_from).install(:update_deps => update_deps, :no_update_deps => no_update_deps)
  end
end

Instance Method Details

#install(opts = {}) ⇒ Object

opts can have keys:

:update_deps
:no_update_deps


66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/client/operation/module/install.rb', line 66

def install(opts = {})
  unless @base_module_ref
    raise Error::Usage, "No base module reference #{dsl_path_ref}"
  end

  if module_version_exists?(@base_module_ref)
    raise Error::Usage, "Module '#{@base_module_ref.print_form}' exists already"
  end

  @print_helper.print_continuation_installing_base_module

  base_path = @base_module_ref.client_dir_path || @file_obj.parent_dir?
  self.class.handle_error base_path do
    CommonModule.install(@base_module_ref, @file_obj, :has_remote_repo => @has_remote_repo)
  end

  @print_helper.print_done_message
  nil
end