Class: Luban::Deployment::Package::Worker

Inherits:
Worker::Base show all
Includes:
Base, Worker::Paths::Remote
Defined in:
lib/luban/deployment/cli/package/worker.rb

Direct Known Subclasses

Installer, Service::Worker

Defined Under Namespace

Modules: Base

Constant Summary

Constants included from Luban::Deployment::Parameters::Application

Luban::Deployment::Parameters::Application::DefaultLogrotateInterval, Luban::Deployment::Parameters::Application::DefaultLogrotateMaxAge

Constants included from Luban::Deployment::Parameters::General

Luban::Deployment::Parameters::General::DefaultLubanRootPath

Constants included from Helpers::Utils

Helpers::Utils::LogLevels

Instance Attribute Summary

Attributes inherited from Worker::Base

#task

Attributes included from Helpers::Utils

#backend

Attributes included from Helpers::Configuration

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#package_bin_path, #package_install_path, #packages_path

Methods included from Worker::Paths::Remote

#app_archives_path, #app_bin_path, #app_path, #app_tmp_path, #archived_logs_path, #archives_path, #current_app_path, #deployment_projects_path, #docker_root_path, #downloads_path, #env_path, #envrc_file, #packages_root_path, #project_path, #releases_root_path, #shared_path, #tmp_path, #unset_envrc_file

Methods inherited from Worker::Base

#dry_run?, #force?, #initialize, #linux?, #method_missing, #osx?, #packages, #run, #target_full_name, #target_major_version, #target_name, #target_patch_level, #target_version

Methods included from Luban::Deployment::Parameters::Application

#dockerize, #dockerized?, #env_name, #logrotate_count, #monitor_itself?, #monitorable?

Methods included from Luban::Deployment::Parameters::Base

#parameter

Methods included from Luban::Deployment::Parameters::Docker

#validate_for_docker_cert_path

Methods included from Luban::Deployment::Parameters::Project

#monitor_defined?, #process_monitor_via

Methods included from Luban::Deployment::Parameters::General

#current_uid, #current_user, included

Methods included from Helpers::Utils

#assure, #assure_dirs, #assure_symlink, #capture, #check_pass?, #chmod, #cp, #directory?, #exists?, #file?, #hardware_name, #host, #hostname, #ln, #match?, #md5_for, #md5_for_dir, #md5_for_file, #md5_matched?, #mkdir, #mv, #now, #os_name, #os_release, #readlink, #render_template, #revision_match?, #rm, #rmdir, #sudo, #symlink?, #touch, #truncate, #upload_by_template, #url_exists?, #user_home, #with_clean_env

Methods included from Helpers::Configuration

#ask, #fetch, #find_template_file, #load_configuration_file, #primary, #release_roles, #role, #roles, #server, #set, #set_default, #syntax_error?

Constructor Details

This class inherits a constructor from Luban::Deployment::Worker::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Luban::Deployment::Worker::Base

Class Method Details

.define_executable(*names) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/luban/deployment/cli/package/worker.rb', line 33

def define_executable(*names)
  names.each do |name|
    define_method("#{name.gsub('-', '_')}_executable") do
      if instance_variable_defined?("@#{__method__}")
        instance_variable_get("@#{__method__}")
      else
        instance_variable_set("@#{__method__}", bin_path.join(name))
      end
    end
  end
end

.package_class(package) ⇒ Object



25
26
27
# File 'lib/luban/deployment/cli/package/worker.rb', line 25

def package_class(package)
  Luban::Deployment::Package::Base.package_class(package)
end

.worker_class(worker, **opts) ⇒ Object



29
30
31
# File 'lib/luban/deployment/cli/package/worker.rb', line 29

def worker_class(worker, **opts)
  Luban::Deployment::Package::Base.worker_class(worker, **opts)
end

Instance Method Details

#bin_pathObject



73
74
75
# File 'lib/luban/deployment/cli/package/worker.rb', line 73

def bin_path
  @bin_path ||= install_path.join('bin')
end

#child?Boolean

Returns:

  • (Boolean)


51
# File 'lib/luban/deployment/cli/package/worker.rb', line 51

def child?; !parent.nil?; end

#current_bin_pathObject



57
58
59
# File 'lib/luban/deployment/cli/package/worker.rb', line 57

def current_bin_path
  @current_bin_path ||= current_path.join('bin')
end

#current_pathObject



53
54
55
# File 'lib/luban/deployment/cli/package/worker.rb', line 53

def current_path
  @current_path ||= app_path.join(package_name)
end

#install_pathObject



69
70
71
# File 'lib/luban/deployment/cli/package/worker.rb', line 69

def install_path
  @install_path ||= package_versions_path.join(package_version)
end

#package_downloads_pathObject



81
82
83
# File 'lib/luban/deployment/cli/package/worker.rb', line 81

def package_downloads_path
  @package_downloads_path ||= downloads_path.join(package_name)
end

#package_pathObject



61
62
63
# File 'lib/luban/deployment/cli/package/worker.rb', line 61

def package_path
  @package_path ||= packages_path.join(package_name)
end

#package_tmp_pathObject



77
78
79
# File 'lib/luban/deployment/cli/package/worker.rb', line 77

def package_tmp_path
  @package_tmp_path ||= package_path.join('tmp')
end

#package_versions_pathObject



65
66
67
# File 'lib/luban/deployment/cli/package/worker.rb', line 65

def package_versions_path
  @package_versions_path ||= package_path.join('versions')
end

#parentObject



50
# File 'lib/luban/deployment/cli/package/worker.rb', line 50

def parent; task.opts.parent; end