class DTK::Client::Operation::Module::Install::DependentModules::ComponentModule

Constants

BaseRoute

Public Class Methods

install_or_pull?(module_ref, prompt_helper, print_helper) click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 31
def self.install_or_pull?(module_ref, prompt_helper, print_helper)
  new(module_ref, prompt_helper, print_helper).install_or_pull?
end
install_or_pull_new?(module_ref, prompt_helper, print_helper) click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 35
def self.install_or_pull_new?(module_ref, prompt_helper, print_helper)
  new(module_ref, prompt_helper, print_helper).install_or_pull_new?
end
new(module_ref, prompt_helper, print_helper) click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 24
def initialize(module_ref, prompt_helper, print_helper)
  @module_ref    = module_ref
  @prompt_helper = prompt_helper
  @print_helper  = print_helper.set_module_ref!(module_ref)
end

Public Instance Methods

install_or_pull?() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 39
def install_or_pull?
  if @module_ref.module_installed?(self)
    if @module_ref.is_master_version?
      pull_module_update?
    else
      @print_helper.print_using_installed_dependent_module
    end
  else
    install_module
  end
end
install_or_pull_new?() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 51
def install_or_pull_new?
  if @module_ref.module_installed?(self)
    if @module_ref.is_master_version?
      pull_module_update_new?
    else
      @print_helper.print_using_installed_dependent_module
    end
  else
    install_module
  end
end
query_if_component_module_is_installed?() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 63
def query_if_component_module_is_installed?
  module_version_exists?(@module_ref)
end

Private Instance Methods

install_module() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 111
def install_module
  @print_helper.print_continuation_installing_dependency

  post_body = {
    :module_name => module_name,
    :namespace   => namespace,
    :rsa_pub_key => SSHUtil.rsa_pub_key_content,
    :version?    => version
  }

  response = rest_post "#{BaseRoute}/install_component_info", PostBody.new(post_body)

  @print_helper.print_done_message
  response
end
pull_module_update?() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 90
      def pull_module_update?
        return unless @prompt_helper.pull_module_update?(@print_helper)
        @print_helper.print_continuation_pulling_dependency_update

        post_body = {
          :module_name => module_name,
          :namespace   => namespace,
          :rsa_pub_key => SSHUtil.rsa_pub_key_content,
          :version?    => version,
          :force       => true # TODO: hardwired
        }
        response = rest_post "#{BaseRoute}/pull_component_info_from_remote", PostBody.new(post_body)

        if (response.data(:diffs) || {}).empty?
#          OsUtil.print("No changes to pull from remote.", :yellow) unless response['errors']
          OsUtil.print("No changes to pull from remote.", :yellow) 
        else
          OsUtil.print("Changes pulled from remote", :green)
        end
      end
pull_module_update_new?() click to toggle source
# File lib/client/operation/module/install/dependent_modules/component_module.rb, line 69
      def pull_module_update_new?
        # return unless @prompt_helper.pull_module_update?(@print_helper)
        @print_helper.print_continuation_pulling_dependency_update

        post_body = {
          :module_name => module_name,
          :namespace   => namespace,
          :rsa_pub_key => SSHUtil.rsa_pub_key_content,
          :version?    => version,
          :force       => true # TODO: hardwired
        }
        response = rest_post "#{BaseRoute}/pull_component_info_from_remote", PostBody.new(post_body)

        if (response.data(:diffs) || {}).empty?
#          OsUtil.print("No changes to pull from remote.", :yellow) unless response['errors']
          OsUtil.print("No changes to pull from remote.", :yellow) 
        else
          OsUtil.print("Changes pulled from remote", :green)
        end
      end