Module: CapistranoMulticonfigParallel
- Includes:
- Configuration
- Defined in:
- lib/capistrano_multiconfig_parallel/base.rb,
lib/capistrano_multiconfig_parallel/cli.rb,
lib/capistrano_multiconfig_parallel/version.rb,
lib/capistrano_multiconfig_parallel/application.rb,
lib/capistrano_multiconfig_parallel/configuration.rb,
lib/capistrano_multiconfig_parallel/helpers/base_manager.rb,
lib/capistrano_multiconfig_parallel/celluloid/rake_worker.rb,
lib/capistrano_multiconfig_parallel/celluloid/child_process.rb,
lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb,
lib/capistrano_multiconfig_parallel/helpers/standard_deploy.rb,
lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb,
lib/capistrano_multiconfig_parallel/helpers/multi_app_manager.rb,
lib/capistrano_multiconfig_parallel/celluloid/celluloid_worker.rb,
lib/capistrano_multiconfig_parallel/helpers/single_app_manager.rb,
lib/capistrano_multiconfig_parallel/celluloid/celluloid_manager.rb,
lib/capistrano_multiconfig_parallel/multi_app_helpers/interactive_menu.rb,
lib/capistrano_multiconfig_parallel/multi_app_helpers/dependency_tracker.rb
Overview
Returns the version of the currently loaded gem as a Gem::Version
Defined Under Namespace
Modules: Configuration, VERSION
Classes: Application, BaseManager, CLI, CelluloidManager, CelluloidWorker, ChildProcess, DependencyTracker, InteractiveMenu, MultiAppManager, RakeWorker, SingleAppManager, StandardDeploy, StateMachine, TerminalTable
Constant Summary
collapse
- ENV_KEY_JOB_ID =
'multi_cap_job_id'
- MULTI_KEY =
'multi'
- SINGLE_KEY =
'single'
- CUSTOM_COMMANDS =
{
CapistranoMulticonfigParallel::MULTI_KEY => {
menu: 'show_menu',
stages: 'deploy_multi_stages'
},
CapistranoMulticonfigParallel::SINGLE_KEY => {
stages: 'deploy_multi_stages'
}
}
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.execute_in_sequence ⇒ Object
Returns the value of attribute execute_in_sequence.
26
27
28
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 26
def execute_in_sequence
@execute_in_sequence
end
|
Returns the value of attribute interactive_menu.
26
27
28
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 26
def
end
|
.logger ⇒ Object
Returns the value of attribute logger.
26
27
28
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 26
def logger
@logger
end
|
.show_task_progress ⇒ Object
Returns the value of attribute show_task_progress.
26
27
28
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 26
def show_task_progress
@show_task_progress
end
|
.show_task_progress_tree ⇒ Object
Returns the value of attribute show_task_progress_tree.
26
27
28
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 26
def show_task_progress_tree
@show_task_progress_tree
end
|
Class Method Details
.ask_confirm(message, default) ⇒ Object
32
33
34
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 32
def ask_confirm(message, default)
Ask.input message, default: default
end
|
.detect_root ⇒ Object
81
82
83
84
85
86
87
88
89
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 81
def detect_root
if ENV['MULTI_CAP_ROOT']
Pathname.new(ENV['MULTI_CAP_ROOT'])
elsif defined?(::Rails)
::Rails.root
else
try_detect_capfile
end
end
|
.enable_logging ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 56
def enable_logging
CapistranoMulticonfigParallel.configuration_valid?
return unless CapistranoMulticonfigParallel::CelluloidManager.debug_enabled
FileUtils.mkdir_p(log_directory)
log_file = File.open(main_log_file, 'w')
log_file.sync = true
self.logger = ::Logger.new(main_log_file)
Celluloid.logger = logger
end
|
.gem_version ⇒ Object
3
4
5
|
# File 'lib/capistrano_multiconfig_parallel/version.rb', line 3
def self.gem_version
Gem::Version.new VERSION::STRING
end
|
.log_directory ⇒ Object
44
45
46
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 44
def log_directory
File.join(CapistranoMulticonfigParallel.detect_root.to_s, 'log')
end
|
.log_message(message) ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 66
def log_message(message)
return unless logger.present?
error_message = message.respond_to?(:message) ? message.message : message.inspect
err_backtrace = message.respond_to?(:backtrace) ? message.backtrace.join("\n\n") : ''
if err_backtrace.present?
logger.debug(
class_name: message.class,
message: error_message,
backtrace: err_backtrace
)
else
logger.debug(message)
end
end
|
.main_log_file ⇒ Object
48
49
50
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 48
def main_log_file
File.join(log_directory, 'multi_cap.log')
end
|
.root ⇒ Object
28
29
30
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 28
def root
File.expand_path(File.dirname(__dir__))
end
|
.try_detect_capfile ⇒ Object
91
92
93
94
95
96
97
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 91
def try_detect_capfile
root = Pathname.new(FileUtils.pwd)
root = root.parent unless root.directory?
root = root.parent until root.children.find{|f| f.file? && f.basename.to_s.downcase == "capfile"}.present? || root.root?
raise "Can't detect Rails application root" if root.root?
root
end
|
.verify_app_dependencies(stages) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 36
def verify_app_dependencies(stages)
applications = stages.map { |stage| stage.split(':').reverse[1] }
wrong = CapistranoMulticonfigParallel.configuration.application_dependencies.find do |hash|
!applications.include?(hash[:app]) || (hash[:dependencies].present? && hash[:dependencies].find { |val| !applications.include?(val) })
end
raise ArgumentError, "invalid configuration for #{wrong.inspect}" if wrong.present?
end
|
.websokect_log_file ⇒ Object
52
53
54
|
# File 'lib/capistrano_multiconfig_parallel/base.rb', line 52
def websokect_log_file
File.join(log_directory, 'multi_cap_websocket.log')
end
|