Class: Luban::Deployment::Application::Publisher
- Inherits:
-
Worker
show all
- Defined in:
- lib/luban/deployment/cli/application/publisher.rb
Constant Summary
Parameters::General::DefaultLubanRootPath
Helpers::Utils::LogLevels
Instance Attribute Summary
Attributes inherited from Worker::Base
#task
#backend
#config
Instance Method Summary
collapse
Methods inherited from Worker
#package_bin_path, #package_path, #package_version, #packages, #release_path, #service_entry, #shell_setup_commands
#compose_command, #control_file_name, #control_file_path, #log_file_name, #log_file_path, #log_path, #logrotate_file_name, #logrotate_file_path, #pid_file_name, #pid_file_path, #pids_path, #profile_path, #service_entry, #shell_setup_commands
#app_bin_path, #app_path, #app_tmp_path, #current_app_path, #downloads_path, #env_path, #envrc_file, #etc_path, #logrotate_path, #luban_install_path, #project_path, #shared_path, #tmp_path, #unset_envrc_file
#dry_run?, #env_name, #force?, #initialize, #linux?, #osx?, #run, #target_full_name, #target_major_version, #target_name, #target_patch_level, #target_version
#parameter
included
#assure, #assure_dirs, #assure_symlink, #capture, #check_pass?, #chmod, #cp, #directory?, #file?, #hardware_name, #host, #hostname, #ln, #match?, #md5_for_file, #md5_matched?, #method_missing, #mkdir, #mv, #now, #os_name, #os_release, #readlink, #render_template, #revision_match?, #rm, #rmdir, #sudo, #symlink?, #upload_by_template, #url_exists?, #user_home
#ask, #default_templates_paths, #fetch, #find_template_file, #load_configuration_file, #primary, #release_roles, #role, #roles, #server, #set, #set_default, #syntax_error?
Instance Method Details
#after_publish ⇒ Object
91
92
93
94
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 91
def after_publish
create_symlinks
bundle_gems unless gems.empty?
end
|
#bundle_cmd ⇒ Object
34
35
36
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 34
def bundle_cmd
@bundle_cmd ||= app_bin_path.join('bundle')
end
|
#bundle_config_path ⇒ Object
38
39
40
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 38
def bundle_config_path
@bundle_config_path ||= shared_path.join('.bundle')
end
|
#bundle_flags ⇒ Object
54
55
56
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 54
def bundle_flags
@bundle_flags ||= %w(--deployment --quiet)
end
|
#bundle_linked_dirs ⇒ Object
58
59
60
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 58
def bundle_linked_dirs
@bundle_linked_dirs ||= %w(.bundle vendor/cache vendor/bundle)
end
|
#bundle_path ⇒ Object
42
43
44
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 42
def bundle_path
@bundle_path ||= shared_path.join('vendor', 'bundle')
end
|
#bundle_without ⇒ Object
50
51
52
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 50
def bundle_without
@bundle_without ||= %w(development test)
end
|
#bundled_gems ⇒ Object
10
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 10
def bundled_gems; task.opts.release_pack[:bundled_gems]; end
|
#deprecate ⇒ Object
84
85
86
87
88
89
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 84
def deprecate
if directory?(release_path)
rmdir(release_path)
update_result "Successfully deprecated published release #{release_name}."
end
end
|
#gemfile ⇒ Object
30
31
32
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 30
def gemfile
@gemfile ||= release_path.join('Gemfile')
end
|
#gems ⇒ Object
13
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 13
def gems; bundled_gems[:gems]; end
|
#gems_cache_path ⇒ Object
46
47
48
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 46
def gems_cache_path
@gems_cache_path ||= shared_path.join('vendor', 'cache')
end
|
#gems_source ⇒ Object
12
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 12
def gems_source; bundled_gems[:gems_cache]; end
|
#locked_gemfile ⇒ Object
11
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 11
def locked_gemfile; bundled_gems[:locked_gemfile]; end
|
#publish ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 64
def publish
assure_dirs(releases_path)
if published?
if force?
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
15
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 15
def publish_app?; release_type == 'app'; end
|
#publish_profile? ⇒ Boolean
16
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 16
def publish_profile?; release_type == 'profile'; end
|
#published? ⇒ Boolean
62
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 62
def published?; directory?(release_path); end
|
#release_md5 ⇒ Object
9
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 9
def release_md5; task.opts.release_pack[:md5]; end
|
#release_name ⇒ Object
18
19
20
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 18
def release_name
@release_name ||= "#{application}:#{release_type}:#{release_tag}"
end
|
#release_package_path ⇒ Object
8
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 8
def release_package_path; task.opts.release_pack[:path]; end
|
#release_tag ⇒ Object
7
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 7
def release_tag; task.opts.release_pack[:tag]; end
|
#release_type ⇒ Object
5
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 5
def release_type; task.opts.release_pack[:type]; end
|
#release_version ⇒ Object
6
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 6
def release_version; task.opts.release_pack[:version]; end
|
#releases_log_path ⇒ Object
26
27
28
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 26
def releases_log_path
@releases_log_path ||= app_path.join('releases.log')
end
|
#releases_path ⇒ Object
22
23
24
|
# File 'lib/luban/deployment/cli/application/publisher.rb', line 22
def releases_path
@releases_path ||= super.dirname.join(release_type)
end
|