capistrano_multiconfig_parallel 0.21.8 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/capistrano_multiconfig_parallel.gemspec +1 -0
- data/lib/capistrano_multiconfig_parallel.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/all.rb +12 -10
- data/lib/capistrano_multiconfig_parallel/application.rb +7 -8
- data/lib/capistrano_multiconfig_parallel/celluloid/child_process.rb +3 -3
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/classes/job.rb +6 -6
- data/lib/capistrano_multiconfig_parallel/cli.rb +0 -1
- data/lib/capistrano_multiconfig_parallel/helpers/application_helper.rb +4 -0
- data/lib/capistrano_multiconfig_parallel/helpers/core_helper.rb +15 -12
- data/lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb +4 -3
- data/lib/capistrano_multiconfig_parallel/version.rb +2 -2
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e48073b8b6708baeb5b39f98744f373ab3abab
|
4
|
+
data.tar.gz: 1052b93deab26bec15a3ba72c30c9f690c41a605
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3da4fd7ec16bc1d1a089c5d1ebf681250c3e65c711945114374ebe9c4c1e2567de44554582e152c3ff4b8f2661cd9d0d86ba31058876ea91cc6b5741bd2c255d
|
7
|
+
data.tar.gz: 76ac0e57d3c78760b9f710207c54efcc6356f5beef76479d3f1636f17105cc9b31c2cd2167cb9d57471b3fef3ef62603086ae4feea61066932e22ad09ea7c209
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_runtime_dependency 'eventmachine', '~> 1.0', '>= 1.0.3'
|
26
26
|
s.add_runtime_dependency 'right_popen', '~> 1.1', '>= 1.1.3'
|
27
27
|
s.add_runtime_dependency 'capistrano','~> 3.0','>= 3.0'
|
28
|
+
s.add_runtime_dependency 'capistrano-multiconfig','~> 3.0','>= 3.0.8'
|
28
29
|
s.add_runtime_dependency 'activesupport', '~> 4.0','>= 4.0'
|
29
30
|
s.add_runtime_dependency 'configliere', '~> 0.4', '>=0.4'
|
30
31
|
s.add_runtime_dependency 'inquirer', '~> 0.2', '>= 0.2'
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require 'capistrano_multiconfig_parallel/all'
|
@@ -1,35 +1,37 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler'
|
3
3
|
require 'bundler/setup'
|
4
|
-
require 'rake'
|
5
4
|
require 'active_support/core_ext/object/blank'
|
6
5
|
require 'active_support/core_ext/hash/keys'
|
7
6
|
require 'active_support/concern'
|
7
|
+
|
8
8
|
require 'celluloid/autostart'
|
9
9
|
require 'celluloid/pmap'
|
10
|
+
|
10
11
|
require 'composable_state_machine'
|
11
12
|
require 'eventmachine'
|
12
13
|
require 'right_popen'
|
13
14
|
require 'colorize'
|
14
|
-
require 'logger'
|
15
15
|
require 'terminal-table'
|
16
|
-
|
17
16
|
require 'celluloid_pubsub'
|
18
|
-
require 'capistrano/all'
|
19
|
-
require 'fileutils'
|
20
|
-
|
21
17
|
require 'configliere'
|
22
|
-
require 'pp'
|
23
18
|
require 'devnull'
|
24
19
|
require 'inquirer'
|
20
|
+
|
21
|
+
require 'logger'
|
22
|
+
require 'fileutils'
|
23
|
+
require 'pp'
|
25
24
|
require 'yaml'
|
26
25
|
require 'stringio'
|
26
|
+
|
27
|
+
# capistrano requirements
|
28
|
+
require 'rake'
|
29
|
+
require 'capistrano/all'
|
30
|
+
|
27
31
|
# fix error with not files that can not be found
|
28
32
|
Gem.find_files('composable_state_machine/**/*.rb').each { |path| require path }
|
29
33
|
|
30
|
-
Gem.find_files('capistrano_multiconfig_parallel
|
31
|
-
Gem.find_files('capistrano_multiconfig_parallel/helpers/**/*.rb').each { |path| require path }
|
32
|
-
Gem.find_files('capistrano_multiconfig_parallel/celluloid/**/*.rb').each { |path| require path }
|
34
|
+
Gem.find_files('capistrano_multiconfig_parallel/**/*.rb').each { |path| require path }
|
33
35
|
|
34
36
|
require_relative './version'
|
35
37
|
require_relative './base'
|
@@ -6,12 +6,11 @@ module CapistranoMulticonfigParallel
|
|
6
6
|
include Celluloid::Logger
|
7
7
|
include CapistranoMulticonfigParallel::ApplicationHelper
|
8
8
|
|
9
|
-
attr_reader :
|
9
|
+
attr_reader :stage_apps, :top_level_tasks, :jobs, :branch_backup, :condition, :manager, :dependency_tracker, :application, :stage, :name, :args, :argv, :default_stage
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
Celluloid.boot
|
13
|
-
@
|
14
|
-
@stage_apps = multi_apps? ? @stages.map { |stage| stage.split(':').reverse[1] }.uniq : []
|
13
|
+
@stage_apps = multi_apps? ? stages.map { |stage| stage.split(':').reverse[1] }.uniq : []
|
15
14
|
collect_command_line_tasks(CapistranoMulticonfigParallel.original_args)
|
16
15
|
@jobs = []
|
17
16
|
end
|
@@ -55,14 +54,14 @@ module CapistranoMulticonfigParallel
|
|
55
54
|
|
56
55
|
def custom_command?
|
57
56
|
if multi_apps?
|
58
|
-
|
57
|
+
!stages.include?(@top_level_tasks.first) && custom_commands.include?(@top_level_tasks.first)
|
59
58
|
else
|
60
|
-
|
59
|
+
!stages.include?(@top_level_tasks.second) && stages.include?(@top_level_tasks.first) && custom_commands.include?(@top_level_tasks.second)
|
61
60
|
end
|
62
61
|
end
|
63
62
|
|
64
63
|
def multi_apps?
|
65
|
-
|
64
|
+
stages.find { |stage| stage.include?(':') }.present?
|
66
65
|
end
|
67
66
|
|
68
67
|
def initialize_data
|
@@ -220,8 +219,8 @@ module CapistranoMulticonfigParallel
|
|
220
219
|
job_env_options = custom_command? && env_options['ACTION'].present? ? env_options.except('ACTION') : env_options
|
221
220
|
|
222
221
|
job = CapistranoMulticonfigParallel::Job.new(Actor.current, options.merge(
|
223
|
-
|
224
|
-
|
222
|
+
action: custom_command? && env_options['ACTION'].present? ? env_options['ACTION'] : options['action'],
|
223
|
+
env_options: job_env_options
|
225
224
|
))
|
226
225
|
@jobs << job
|
227
226
|
end
|
@@ -27,8 +27,8 @@ module CapistranoMulticonfigParallel
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
EM.error_handler do|e|
|
30
|
-
log_to_file("Error during event loop for worker #{@job_id}: #{e.inspect}", @job_id)
|
31
|
-
log_to_file(e.backtrace, @job_id)
|
30
|
+
log_to_file("Error during event loop for worker #{@job_id}: #{e.inspect}", job_id: @job_id)
|
31
|
+
log_to_file(e.backtrace, job_id: @job_id)
|
32
32
|
EM.stop
|
33
33
|
end
|
34
34
|
end
|
@@ -93,7 +93,7 @@ module CapistranoMulticonfigParallel
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def io_callback(io, data)
|
96
|
-
log_to_file("#{io.upcase} ---- #{data}", @job_id)
|
96
|
+
log_to_file("#{io.upcase} ---- #{data}", job_id: @job_id)
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
@@ -25,7 +25,7 @@ module CapistranoMulticonfigParallel
|
|
25
25
|
|
26
26
|
def notify_time_change(_topic, _message)
|
27
27
|
table = Terminal::Table.new(title: 'Deployment Status Table', headings: ['Job ID', 'Job UUID', 'App/Stage', 'Action', 'ENV Variables', 'Current Task'])
|
28
|
-
jobs = @manager.alive? ? @manager.jobs : []
|
28
|
+
jobs = @manager.alive? ? @manager.jobs.dup : []
|
29
29
|
setup_table_jobs(table, jobs)
|
30
30
|
display_table_on_terminal(table)
|
31
31
|
end
|
@@ -9,11 +9,11 @@ module CapistranoMulticonfigParallel
|
|
9
9
|
attr_writer :status, :exit_status
|
10
10
|
|
11
11
|
delegate :job_stage,
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
:capistrano_action,
|
13
|
+
:build_capistrano_task,
|
14
|
+
:execute_standard_deploy,
|
15
|
+
:setup_command_line_standard,
|
16
|
+
to: :command
|
17
17
|
|
18
18
|
def initialize(application, options)
|
19
19
|
@options = options
|
@@ -35,7 +35,7 @@ module CapistranoMulticonfigParallel
|
|
35
35
|
{ value: id.to_s },
|
36
36
|
{ value: job_stage },
|
37
37
|
{ value: capistrano_action },
|
38
|
-
{ value: setup_command_line_standard(filtered_keys: [
|
38
|
+
{ value: setup_command_line_standard(filtered_keys: [env_variable]).join("\n") },
|
39
39
|
{ value: worker_state }
|
40
40
|
]
|
41
41
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative './all'
|
2
|
-
Gem.find_files('capistrano_multiconfig_parallel/initializers/**/*.rb').each { |path| require path }
|
3
2
|
module CapistranoMulticonfigParallel
|
4
3
|
# this is the class that will be invoked from terminal , and willl use the invoke task as the primary function.
|
5
4
|
class CLI
|
@@ -16,10 +16,6 @@ module CapistranoMulticonfigParallel
|
|
16
16
|
$stdout.sync = true if $stdout.isatty
|
17
17
|
end
|
18
18
|
|
19
|
-
def find_loaded_gem(name)
|
20
|
-
Gem.loaded_specs.values.find { |repo| repo.name == name }
|
21
|
-
end
|
22
|
-
|
23
19
|
def ask_stdout_confirmation(message, default)
|
24
20
|
result = Ask.input message, default: default
|
25
21
|
$stdout.flush
|
@@ -54,18 +50,25 @@ module CapistranoMulticonfigParallel
|
|
54
50
|
return if error_filtered?(error)
|
55
51
|
message = format_error(error)
|
56
52
|
puts(message) if output.present?
|
57
|
-
log_to_file(message)
|
53
|
+
log_to_file(message, log_method: 'fatal')
|
58
54
|
end
|
59
55
|
|
60
|
-
def format_error(
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
def format_error(exception)
|
57
|
+
message = "\n#{exception.class} (#{exception.respond_to?(:message) ? exception.message : exception.inspect}):\n"
|
58
|
+
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
|
59
|
+
message << ' ' << exception.backtrace.join("\n ") if exception.respond_to?(:backtrace)
|
60
|
+
message
|
64
61
|
end
|
65
62
|
|
66
|
-
def log_to_file(message,
|
67
|
-
worker_log = job_id.present? ? find_worker_log(job_id) : logger
|
68
|
-
worker_log.
|
63
|
+
def log_to_file(message, options = {})
|
64
|
+
worker_log = options.fetch(:job_id, '').present? ? find_worker_log(options[:job_id]) : logger
|
65
|
+
print_to_log_file(worker_log, options.merge(message: message)) if worker_log.present? && app_debug_enabled?
|
66
|
+
end
|
67
|
+
|
68
|
+
def print_to_log_file(worker_log, options = {})
|
69
|
+
ActiveSupport::Deprecation.silence do
|
70
|
+
worker_log.send(options.fetch(:log_method, 'debug'), "#{options.fetch(:message, '')}\n")
|
71
|
+
end
|
69
72
|
end
|
70
73
|
|
71
74
|
def find_worker_log(job_id)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module CapistranoMulticonfigParallel
|
2
2
|
# module used to fetch the stages (code taken from https://github.com/railsware/capistrano-multiconfig)
|
3
3
|
# TODO: find a way to do this without copying code. Can't currently use gem specification to require that gem
|
4
|
-
# because
|
4
|
+
# because seems to not work properly after capistrano/all is required. It seems to only work in Capfile if is required.
|
5
|
+
# Still investigating how to make that work.
|
5
6
|
module StagesHelper
|
6
7
|
module_function
|
7
8
|
|
8
|
-
def
|
9
|
+
def stages
|
9
10
|
fetch_stages_paths do |paths|
|
10
11
|
checks_paths(paths)
|
11
12
|
end
|
@@ -25,7 +26,7 @@ module CapistranoMulticonfigParallel
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def stages_paths
|
28
|
-
stages_root = 'config/deploy'
|
29
|
+
stages_root = File.expand_path(File.join(detect_root, 'config/deploy'))
|
29
30
|
Dir["#{stages_root}/**/*.rb"].map do |file|
|
30
31
|
file.slice(stages_root.size + 1..-4).tr('/', ':')
|
31
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_multiconfig_parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-pmap
|
@@ -170,6 +170,26 @@ dependencies:
|
|
170
170
|
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '3.0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: capistrano-multiconfig
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '3.0'
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 3.0.8
|
183
|
+
type: :runtime
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '3.0'
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 3.0.8
|
173
193
|
- !ruby/object:Gem::Dependency
|
174
194
|
name: activesupport
|
175
195
|
requirement: !ruby/object:Gem::Requirement
|