capistrano_multiconfig_parallel 0.16.1 → 0.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/img/interactive_menu.png +0 -0
- data/lib/capistrano_multiconfig_parallel/all.rb +0 -1
- data/lib/capistrano_multiconfig_parallel/base.rb +2 -83
- data/lib/capistrano_multiconfig_parallel/{configuration.rb → helpers/configuration.rb} +1 -1
- data/lib/capistrano_multiconfig_parallel/helpers/helper.rb +93 -5
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99e92a6da9184666f399d4821380706a6a361197
|
4
|
+
data.tar.gz: a3bb52d48c80affcad5d4a3541fb91a03cedfa21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b6cc7dea5188da7fd45f0297a97836d7ab8d98291a69318969b7850a36228c36ac2d9976a663b7901956040d4811c986f8b22d1ed94e62d36d3b9a759d072b7
|
7
|
+
data.tar.gz: f43866f7a24f267147e0f1b58124ebf992239b749ff8c71d83d9c2300c24086251ae1433ccbdf09dc3359447b7e925edb7e7633326f77b9f945610f49f2d5a9f
|
data/README.md
CHANGED
@@ -205,6 +205,10 @@ Will ask user if he wants to deploy the apps "foo" and "bar" , since they appear
|
|
205
205
|
bundle exec multi_cap deploy_multi_stages STAGES=development, staging, production
|
206
206
|
```
|
207
207
|
|
208
|
+
Demo:
|
209
|
+
|
210
|
+
[![capistrano multiconfig parallel ](img/interactive_menu.png)](#features)
|
211
|
+
|
208
212
|
NOTE: IF you want to execute a different command on all stages, you can specify environment variable **ACTION=task_name** either when you specify the STAGES, or can be done individually for each task when prompted about additional ENV options
|
209
213
|
|
210
214
|
If a branch is specified using **BRANCH=branch_name** it will deploy same branch to all stages.The branch environment variable is then passed to the capistrano task If you want different branches , capistrano will ask for additional ENV options for each stage, and can be specified then for each stage
|
Binary file
|
@@ -32,6 +32,5 @@ Gem.find_files('capistrano_multiconfig_parallel/helpers/**/*.rb').each { |path|
|
|
32
32
|
Gem.find_files('capistrano_multiconfig_parallel/celluloid/**/*.rb').each { |path| require path }
|
33
33
|
|
34
34
|
require_relative './version'
|
35
|
-
require_relative './configuration'
|
36
35
|
require_relative './base'
|
37
36
|
require_relative './application'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# base module that has the statis methods that this gem is using
|
2
2
|
module CapistranoMulticonfigParallel
|
3
|
-
include CapistranoMulticonfigParallel::Configuration
|
4
|
-
include Helper
|
5
3
|
|
6
4
|
ENV_KEY_JOB_ID = 'multi_cap_job_id'
|
7
5
|
MULTI_KEY = 'multi'
|
@@ -20,86 +18,7 @@ module CapistranoMulticonfigParallel
|
|
20
18
|
}
|
21
19
|
|
22
20
|
class << self
|
23
|
-
|
24
|
-
|
25
|
-
def root
|
26
|
-
File.expand_path(File.dirname(__dir__))
|
27
|
-
end
|
28
|
-
|
29
|
-
def check_terminal_tty
|
30
|
-
$stdin.sync = true if $stdin.isatty
|
31
|
-
$stdout.sync = true if $stdout.isatty
|
32
|
-
end
|
33
|
-
|
34
|
-
def ask_confirm(message, default)
|
35
|
-
`stty -raw echo`
|
36
|
-
check_terminal_tty
|
37
|
-
result = Ask.input message, default: default
|
38
|
-
$stdout.flush
|
39
|
-
`stty -raw echo`
|
40
|
-
return result
|
41
|
-
rescue
|
42
|
-
return nil
|
43
|
-
end
|
44
|
-
|
45
|
-
def log_directory
|
46
|
-
File.join(CapistranoMulticonfigParallel.detect_root.to_s, 'log')
|
47
|
-
end
|
48
|
-
|
49
|
-
def main_log_file
|
50
|
-
File.join(log_directory, 'multi_cap.log')
|
51
|
-
end
|
52
|
-
|
53
|
-
def websokect_log_file
|
54
|
-
File.join(log_directory, 'multi_cap_websocket.log')
|
55
|
-
end
|
56
|
-
|
57
|
-
def enable_logging
|
58
|
-
FileUtils.mkdir_p(log_directory) unless File.directory?(log_directory)
|
59
|
-
if CapistranoMulticonfigParallel::CelluloidManager.debug_enabled.to_s.downcase == 'true'
|
60
|
-
FileUtils.touch(main_log_file) unless File.file?(main_log_file)
|
61
|
-
log_file = File.open(main_log_file, 'w')
|
62
|
-
log_file.sync = true
|
63
|
-
self.logger = ::Logger.new(main_log_file)
|
64
|
-
else
|
65
|
-
self.logger = ::Logger.new(DevNull.new)
|
66
|
-
end
|
67
|
-
Celluloid.logger = CapistranoMulticonfigParallel.logger
|
68
|
-
Celluloid.task_class = Celluloid::TaskThread
|
69
|
-
end
|
70
|
-
|
71
|
-
def log_message(message)
|
72
|
-
return unless logger.present?
|
73
|
-
error_message = message.respond_to?(:message) ? message.message : message.inspect
|
74
|
-
err_backtrace = message.respond_to?(:backtrace) ? message.backtrace.join("\n\n") : ''
|
75
|
-
if err_backtrace.present?
|
76
|
-
logger.debug(
|
77
|
-
class_name: message.class,
|
78
|
-
message: error_message,
|
79
|
-
backtrace: err_backtrace
|
80
|
-
)
|
81
|
-
else
|
82
|
-
logger.debug(message)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
|
87
|
-
def detect_root
|
88
|
-
if ENV['MULTI_CAP_ROOT']
|
89
|
-
Pathname.new(ENV['MULTI_CAP_ROOT'])
|
90
|
-
elsif defined?(::Rails)
|
91
|
-
::Rails.root
|
92
|
-
else
|
93
|
-
try_detect_capfile
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def try_detect_capfile
|
98
|
-
root = Pathname.new(FileUtils.pwd)
|
99
|
-
root = root.parent unless root.directory?
|
100
|
-
root = root.parent until root.children.find { |f| f.file? && f.basename.to_s.downcase == 'capfile' }.present? || root.root?
|
101
|
-
raise "Can't detect Capfile in the application root".red if root.root?
|
102
|
-
root
|
103
|
-
end
|
21
|
+
include CapistranoMulticonfigParallel::Helper
|
22
|
+
include CapistranoMulticonfigParallel::Configuration
|
104
23
|
end
|
105
24
|
end
|
@@ -1,9 +1,97 @@
|
|
1
|
-
module
|
1
|
+
module CapistranoMulticonfigParallel
|
2
|
+
module Helper
|
3
|
+
extend ActiveSupport::Concern
|
2
4
|
|
3
|
-
|
5
|
+
included do
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
7
|
+
attr_accessor :logger, :original_args
|
8
|
+
|
9
|
+
def root
|
10
|
+
File.expand_path(File.dirname(File.dirname(__dir__)))
|
11
|
+
end
|
12
|
+
|
13
|
+
def check_terminal_tty
|
14
|
+
$stdin.sync = true if $stdin.isatty
|
15
|
+
$stdout.sync = true if $stdout.isatty
|
16
|
+
end
|
17
|
+
|
18
|
+
def ask_confirm(message, default)
|
19
|
+
`stty -raw echo`
|
20
|
+
check_terminal_tty
|
21
|
+
result = Ask.input message, default: default
|
22
|
+
$stdout.flush
|
23
|
+
`stty -raw echo`
|
24
|
+
return result
|
25
|
+
rescue
|
26
|
+
return nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def log_directory
|
30
|
+
File.join(CapistranoMulticonfigParallel.detect_root.to_s, 'log')
|
31
|
+
end
|
32
|
+
|
33
|
+
def main_log_file
|
34
|
+
File.join(log_directory, 'multi_cap.log')
|
35
|
+
end
|
36
|
+
|
37
|
+
def websokect_log_file
|
38
|
+
File.join(log_directory, 'multi_cap_websocket.log')
|
39
|
+
end
|
40
|
+
|
41
|
+
def enable_logging
|
42
|
+
FileUtils.mkdir_p(log_directory) unless File.directory?(log_directory)
|
43
|
+
if CapistranoMulticonfigParallel::CelluloidManager.debug_enabled.to_s.downcase == 'true'
|
44
|
+
FileUtils.touch(main_log_file) unless File.file?(main_log_file)
|
45
|
+
log_file = File.open(main_log_file, 'w')
|
46
|
+
log_file.sync = true
|
47
|
+
self.logger = ::Logger.new(main_log_file)
|
48
|
+
else
|
49
|
+
self.logger = ::Logger.new(DevNull.new)
|
50
|
+
end
|
51
|
+
Celluloid.logger = CapistranoMulticonfigParallel.logger
|
52
|
+
Celluloid.task_class = Celluloid::TaskThread
|
53
|
+
end
|
8
54
|
|
55
|
+
def log_message(message)
|
56
|
+
return unless logger.present?
|
57
|
+
error_message = message.respond_to?(:message) ? message.message : message.inspect
|
58
|
+
err_backtrace = message.respond_to?(:backtrace) ? message.backtrace.join("\n\n") : ''
|
59
|
+
if err_backtrace.present?
|
60
|
+
logger.debug(
|
61
|
+
class_name: message.class,
|
62
|
+
message: error_message,
|
63
|
+
backtrace: err_backtrace
|
64
|
+
)
|
65
|
+
else
|
66
|
+
logger.debug(message)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
def detect_root
|
72
|
+
if ENV['MULTI_CAP_ROOT']
|
73
|
+
Pathname.new(ENV['MULTI_CAP_ROOT'])
|
74
|
+
elsif defined?(::Rails)
|
75
|
+
::Rails.root
|
76
|
+
else
|
77
|
+
try_detect_capfile
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def try_detect_capfile
|
82
|
+
root = Pathname.new(FileUtils.pwd)
|
83
|
+
root = root.parent unless root.directory?
|
84
|
+
root = root.parent until root.children.find { |f| f.file? && f.basename.to_s.downcase == 'capfile' }.present? || root.root?
|
85
|
+
raise "Can't detect Capfile in the application root".red if root.root?
|
86
|
+
root
|
87
|
+
end
|
88
|
+
|
89
|
+
def find_loaded_gem(name)
|
90
|
+
Gem.loaded_specs.values.detect{|repo| repo.name == name }
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
9
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_multiconfig_parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.16.
|
4
|
+
version: 0.16.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -614,6 +614,7 @@ files:
|
|
614
614
|
- Rakefile
|
615
615
|
- bin/multi_cap
|
616
616
|
- capistrano_multiconfig_parallel.gemspec
|
617
|
+
- img/interactive_menu.png
|
617
618
|
- img/parallel_demo.png
|
618
619
|
- init.rb
|
619
620
|
- lib/capistrano_multiconfig_parallel.rb
|
@@ -628,8 +629,8 @@ files:
|
|
628
629
|
- lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb
|
629
630
|
- lib/capistrano_multiconfig_parallel/celluloid/web_server.rb
|
630
631
|
- lib/capistrano_multiconfig_parallel/cli.rb
|
631
|
-
- lib/capistrano_multiconfig_parallel/configuration.rb
|
632
632
|
- lib/capistrano_multiconfig_parallel/extensions/rake.rb
|
633
|
+
- lib/capistrano_multiconfig_parallel/helpers/configuration.rb
|
633
634
|
- lib/capistrano_multiconfig_parallel/helpers/dependency_tracker.rb
|
634
635
|
- lib/capistrano_multiconfig_parallel/helpers/helper.rb
|
635
636
|
- lib/capistrano_multiconfig_parallel/helpers/input_stream.rb
|