Class: Luban::Deployment::Application::Publisher
Constant Summary
Parameters::Application::DefaultLogrotateInterval, Parameters::Application::DefaultLogrotateMaxAge
Parameters::General::DefaultLubanRootPath
Helpers::Utils::LogLevels
Instance Attribute Summary
Attributes inherited from Worker::Base
#task
#backend
#config
Instance Method Summary
collapse
#linked_dirs, #linked_files, #linked_files_dir, #linked_files_from, #linked_files_root
Methods inherited from Worker
#bundle_command, #bundle_executable, #gemfile, #has_gemfile?, #profile_name, #release_path, #ruby_bin_path, #shell_setup
#control_file_name, #control_file_path, #log_file_name, #log_file_path, #log_path, #output_redirection, #pid_file_name, #pid_file_path, #pids_path, #profile_name, #profile_path, #service_entry, #shell_command, #shell_delimiter, #shell_output, #shell_prefix, #shell_setup
#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, #shared_path, #tmp_path, #unset_envrc_file
#dry_run?, #force?, #initialize, #linux?, #method_missing, #osx?, #packages, #run, #target_full_name, #target_major_version, #target_name, #target_patch_level, #target_version
#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?
Instance Method Details
#after_publish ⇒ Object
86
87
88
89
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 86
def after_publish
create_symlinks
bundle_gems if has_gemfile?
end
|
#bundle_config_path ⇒ Object
32
33
34
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 32
def bundle_config_path
@bundle_config_path ||= shared_path.join('.bundle')
end
|
#bundle_flags ⇒ Object
48
49
50
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 48
def bundle_flags
@bundle_flags ||= %w(--deployment --quiet)
end
|
#bundle_linked_dirs ⇒ Object
52
53
54
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 52
def bundle_linked_dirs
@bundle_linked_dirs ||= %w(.bundle vendor/cache vendor/bundle)
end
|
#bundle_path ⇒ Object
36
37
38
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 36
def bundle_path
@bundle_path ||= shared_path.join('vendor', 'bundle')
end
|
#bundle_without ⇒ Object
44
45
46
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 44
def bundle_without
@bundle_without ||= %w(development test)
end
|
#bundled_gems ⇒ Object
12
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 12
def bundled_gems; task.opts.release_pack[:bundled_gems]; end
|
#deprecate ⇒ Object
79
80
81
82
83
84
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 79
def deprecate
if directory?(release_path)
rmdir(release_path)
update_result "Successfully deprecated published release #{release_name}."
end
end
|
#gems ⇒ Object
15
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 15
def gems; bundled_gems[:gems]; end
|
#gems_cache_path ⇒ Object
40
41
42
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 40
def gems_cache_path
@gems_cache_path ||= shared_path.join('vendor', 'cache')
end
|
#gems_source ⇒ Object
14
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 14
def gems_source; bundled_gems[:gems_cache]; end
|
#locked_gemfile ⇒ Object
13
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 13
def locked_gemfile; bundled_gems[:locked_gemfile]; end
|
#publish ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 58
def publish
assure_dirs(releases_path)
if published?
if force?
rmdir(release_path)
publish!
else
update_result "Skipped! ALREADY published #{release_name}.", status: :skipped
return
end
else
publish!
end
if published?
update_result "Successfully published #{release_name}."
else
update_result "FAILED to publish #{release_name}.", status: :failed, level: :error
end
end
|
#publish_app? ⇒ Boolean
17
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 17
def publish_app?; release_type == 'app'; end
|
#publish_profile? ⇒ Boolean
18
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 18
def publish_profile?; release_type == 'profile'; end
|
#published? ⇒ Boolean
56
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 56
def published?; directory?(release_path); end
|
#release_md5 ⇒ Object
11
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 11
def release_md5; task.opts.release_pack[:md5]; end
|
#release_name ⇒ Object
20
21
22
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 20
def release_name
@release_name ||= "#{application}:#{release_type}:#{release_tag}"
end
|
#release_package_path ⇒ Object
10
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 10
def release_package_path; task.opts.release_pack[:path]; end
|
#release_tag ⇒ Object
9
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 9
def release_tag; task.opts.release_pack[:tag]; end
|
#release_type ⇒ Object
7
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 7
def release_type; task.opts.release_pack[:type]; end
|
#release_version ⇒ Object
8
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 8
def release_version; task.opts.release_pack[:version]; end
|
#releases_log_path ⇒ Object
28
29
30
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 28
def releases_log_path
@releases_log_path ||= app_path.join('releases.log')
end
|
#releases_path ⇒ Object
24
25
26
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 24
def releases_path
@releases_path ||= super.dirname.join(release_type)
end
|