Class: Luban::Deployment::Worker::Base
Constant Summary
Parameters::Application::DefaultLogrotateInterval, Parameters::Application::DefaultLogrotateMaxAge
Parameters::General::DefaultLubanRootPath
Helpers::Utils::LogLevels
Instance Attribute Summary collapse
#backend
#config
Instance Method Summary
collapse
#env_name, #logrotate_count, #monitor_itself?, #monitorable?
#parameter
#monitor_defined?, #process_monitor_via
included
#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
#ask, #fetch, #find_template_file, #load_configuration_file, #primary, #release_roles, #role, #roles, #server, #set, #set_default, #syntax_error?
Constructor Details
#initialize(config:, backend:, **task, &blk) ⇒ Base
Returns a new instance of Base.
13
14
15
16
17
18
19
20
|
# File 'lib/luban/deployment/worker/base.rb', line 13
def initialize(config:, backend:, **task, &blk)
@config = config
@backend = backend
@run_blk = blk
@task = create_task(task)
init
validate
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &blk) ⇒ Object
41
42
43
44
45
46
47
48
|
# File 'lib/luban/deployment/worker/base.rb', line 41
def method_missing(sym, *args, &blk)
if args.empty? and blk.nil? and config.has_key?(sym)
singleton_class.send(:define_method, sym) { config.fetch(__method__) }
send(sym)
else
super
end
end
|
Instance Attribute Details
#task ⇒ Object
Returns the value of attribute task.
11
12
13
|
# File 'lib/luban/deployment/worker/base.rb', line 11
def task
@task
end
|
Instance Method Details
#dry_run? ⇒ Boolean
23
|
# File 'lib/luban/deployment/worker/base.rb', line 23
def dry_run?; task.opts.dry_run; end
|
#force? ⇒ Boolean
22
|
# File 'lib/luban/deployment/worker/base.rb', line 22
def force?; task.opts.force; end
|
#linux? ⇒ Boolean
26
|
# File 'lib/luban/deployment/worker/base.rb', line 26
def linux?; os_name == 'Linux'; end
|
#osx? ⇒ Boolean
25
|
# File 'lib/luban/deployment/worker/base.rb', line 25
def osx?; os_name == 'Darwin'; end
|
#packages ⇒ Object
35
|
# File 'lib/luban/deployment/worker/base.rb', line 35
def packages; task.opts.packages; end
|
#run ⇒ Object
37
38
39
|
# File 'lib/luban/deployment/worker/base.rb', line 37
def run
update_result(__return__: @run_blk ? run_with_block : run_with_command).to_h
end
|
#target_full_name ⇒ Object
29
|
# File 'lib/luban/deployment/worker/base.rb', line 29
def target_full_name; "#{target_name}-#{target_version}"; end
|
#target_major_version ⇒ Object
32
|
# File 'lib/luban/deployment/worker/base.rb', line 32
def target_major_version; task.opts.major_version || target_version; end
|
#target_name ⇒ Object
28
|
# File 'lib/luban/deployment/worker/base.rb', line 28
def target_name; task.opts.name; end
|
#target_patch_level ⇒ Object
33
|
# File 'lib/luban/deployment/worker/base.rb', line 33
def target_patch_level; task.opts.patch_level || ''; end
|
#target_version ⇒ Object
31
|
# File 'lib/luban/deployment/worker/base.rb', line 31
def target_version; task.opts.version; end
|