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

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

Direct Known Subclasses

Installer, Service::Worker

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 Worker::Paths::Remote

#app_archives_path, #app_bin_path, #app_path, #app_tmp_path, #archived_logs_path, #archives_path, #current_app_path, #downloads_path, #env_path, #envrc_file, #luban_install_path, #package_bin_path, #package_install_path, #project_path, #releases_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

#env_name, #logrotate_count, #monitor_itself?, #monitorable?

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

#parameter

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

#monitor_defined?, #process_monitor_via

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

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

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



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/luban/deployment/cli/package/worker.rb', line 16

def define_executable(*names)
  names.each do |name|
    define_method("#{name}_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



8
9
10
# File 'lib/luban/deployment/cli/package/worker.rb', line 8

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

.worker_class(worker, **opts) ⇒ Object



12
13
14
# File 'lib/luban/deployment/cli/package/worker.rb', line 12

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

Instance Method Details

#bin_pathObject



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

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

#child?Boolean

Returns:

  • (Boolean)


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

def child?; !parent.nil?; end

#current_bin_pathObject



40
41
42
# File 'lib/luban/deployment/cli/package/worker.rb', line 40

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

#current_pathObject



36
37
38
# File 'lib/luban/deployment/cli/package/worker.rb', line 36

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

#install_pathObject



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

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

#package_downloads_pathObject



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

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

#package_pathObject



44
45
46
# File 'lib/luban/deployment/cli/package/worker.rb', line 44

def package_path
  @package_path ||= luban_install_path.join('pkg', package_name)
end

#package_tmp_pathObject



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

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

#package_versions_pathObject



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

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

#parentObject



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

def parent; task.opts.parent; end