capistrano_multiconfig_parallel 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/capistrano_multiconfig_parallel.gemspec +1 -1
- data/lib/capistrano_multiconfig_parallel/application.rb +13 -8
- data/lib/capistrano_multiconfig_parallel/classes/job.rb +1 -3
- data/lib/capistrano_multiconfig_parallel/classes/job_command.rb +10 -4
- data/lib/capistrano_multiconfig_parallel/cli.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/helpers/configuration.rb +1 -0
- data/lib/capistrano_multiconfig_parallel/helpers/internal_helper.rb +5 -2
- data/lib/capistrano_multiconfig_parallel/helpers/stages_helper.rb +26 -7
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e4e281f62d3965250a0fad971db85075dffbbaf
|
4
|
+
data.tar.gz: d82ae614107778723f6f46641e9fb89259f619ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05340433f5514d4f03fe8ca127b605e4db51b9ae87d39342d8a78232c7df88ee23648b6ea62656a052f5c24d1674e493483ddfdcc2cdadaca65018b2d17bd3e
|
7
|
+
data.tar.gz: 1671007d8457df58e1b12ea834b9fff175c872c0704296dbddceaae0101c0fa01b5e55fde6af7e388a74306db7b0b242002a11b24805c7ebeac698cde83f963e
|
data/README.md
CHANGED
@@ -18,12 +18,17 @@ IMPORTANT! The whole reason for this gem was for using [Caphub](https://github.c
|
|
18
18
|
CAUTION!! PLEASE READ CAREFULLY!! Capistrano is not thread-safe. However in order to work around this problem, each of the task is executing inside a thread that spawns a new process in order to run capistrano tasks The thread monitors the process. This works well, however if the tasks you are executing is working with files, you might get into deadlocks because multiple proceses try to access same resource. Instead of using files , please consider using StringIO instead.
|
19
19
|
|
20
20
|
|
21
|
-
NEW Improvements
|
21
|
+
NEW Improvements in version 2.2.0
|
22
22
|
-------------------------------------------------------------------------------------
|
23
23
|
- the websocket server will automatically detect an unused port and use that, in case port is not set
|
24
24
|
|
25
25
|
|
26
|
-
NEW Improvements
|
26
|
+
NEW Improvements in version 2.1.0
|
27
|
+
-------------------------------------------------------------------------------------
|
28
|
+
- some internal refactoring and updates for activesupport
|
29
|
+
|
30
|
+
|
31
|
+
NEW Improvements in version 2.0.0
|
27
32
|
-------------------------------------------------------------------------------------
|
28
33
|
|
29
34
|
- Code for handling websocket events when a task is invoked was moved to a new gem [capistrano_sentinel](https://github.com/bogdanRada/capistrano_sentinel)
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_runtime_dependency 'configliere', '~> 0.4', '>=0.4'
|
31
31
|
s.add_runtime_dependency 'inquirer', '~> 0.2', '>= 0.2'
|
32
32
|
s.add_runtime_dependency 'devnull','~> 0.1', '>= 0.1'
|
33
|
-
s.add_runtime_dependency 'capistrano_sentinel', '>= 0.0', '>= 0.0.
|
33
|
+
s.add_runtime_dependency 'capistrano_sentinel', '>= 0.0', '>= 0.0.18'
|
34
34
|
s.add_runtime_dependency 'powerbar', '~> 1.0', '>= 1.0.17'
|
35
35
|
|
36
36
|
s.add_development_dependency 'rake', '>= 10.4', '>= 10.4'
|
@@ -73,8 +73,14 @@ module CapistranoMulticonfigParallel
|
|
73
73
|
raise_invalid_job_config
|
74
74
|
end
|
75
75
|
|
76
|
-
def raise_invalid_job_config
|
77
|
-
|
76
|
+
def raise_invalid_job_config(path = nil)
|
77
|
+
if independent_deploy?(path)
|
78
|
+
puts 'Invalid execution, please call something such as `multi_cap app_name:production deploy`, where production is a stage you have defined and the "app_name" is a name that you defined in your multi_cap.yml file'.red
|
79
|
+
elsif application_supports_multi_apps?
|
80
|
+
puts 'Invalid execution, please call something such as `multi_cap app_name:production deploy`, where production is a stage you have defined and the "app_name" is name that you have defined in your application'.red
|
81
|
+
else
|
82
|
+
puts 'Invalid execution, please call something such as `multi_cap production deploy`, where production is a stage you have defined'.red
|
83
|
+
end
|
78
84
|
exit(false)
|
79
85
|
end
|
80
86
|
|
@@ -236,7 +242,10 @@ module CapistranoMulticonfigParallel
|
|
236
242
|
|
237
243
|
def prepare_job(options)
|
238
244
|
options = options.stringify_keys
|
239
|
-
|
245
|
+
app = options.fetch('app', '')
|
246
|
+
path = job_path(options) rescue nil
|
247
|
+
# raise [app, @stage_apps, job_stage(options) , stages(job_path(options))].inspect
|
248
|
+
return raise_invalid_job_config(path) if (app.present? && !@stage_apps.include?(app)) || !job_stage_valid?(options)
|
240
249
|
app = options.fetch('app', '')
|
241
250
|
box = options['env_options'][boxes_key]
|
242
251
|
message = box.present? ? "BOX #{box}:" : "stage #{options['stage']}:"
|
@@ -253,10 +262,6 @@ module CapistranoMulticonfigParallel
|
|
253
262
|
path: job_path(options)
|
254
263
|
|
255
264
|
))
|
256
|
-
raise "Please make sure you have a Gemfile in the project root directory #{job.job_path}" unless job.job_gemfile.present?
|
257
|
-
if job.find_capfile.blank?
|
258
|
-
raise "Please make sure you have a Capfile in the project root directory #{job.job_path}"
|
259
|
-
end
|
260
265
|
|
261
266
|
if configuration.check_app_bundler_dependencies.to_s.downcase == 'true' && job.job_gemfile.present?
|
262
267
|
if !@checked_job_paths.include?(job.job_path)
|
@@ -283,7 +288,7 @@ module CapistranoMulticonfigParallel
|
|
283
288
|
end
|
284
289
|
|
285
290
|
def job_stage(options)
|
286
|
-
|
291
|
+
options['stage']
|
287
292
|
end
|
288
293
|
|
289
294
|
|
@@ -16,9 +16,6 @@ module CapistranoMulticonfigParallel
|
|
16
16
|
@options = options.stringify_keys
|
17
17
|
@application = application
|
18
18
|
@manager = @application.manager
|
19
|
-
end
|
20
|
-
|
21
|
-
def gitflow
|
22
19
|
@gitflow ||= command.gitflow_enabled?
|
23
20
|
end
|
24
21
|
|
@@ -125,6 +122,7 @@ module CapistranoMulticonfigParallel
|
|
125
122
|
|
126
123
|
def setup_additional_env_variables(value)
|
127
124
|
value["#{env_variable}"] = id
|
125
|
+
#value["capistrano_version"] = job_capistrano_version
|
128
126
|
end
|
129
127
|
|
130
128
|
def finished?
|
@@ -34,6 +34,8 @@ module CapistranoMulticonfigParallel
|
|
34
34
|
|
35
35
|
def find_capfile(custom_path = job_path)
|
36
36
|
@capfile_path ||= find_file_by_names(custom_path, 'capfile').first
|
37
|
+
raise "Please make sure you have a Capfile in the project root directory #{custom_path}".red if @capfile_path.blank?
|
38
|
+
@capfile_path
|
37
39
|
end
|
38
40
|
|
39
41
|
def capfile_name
|
@@ -45,11 +47,15 @@ module CapistranoMulticonfigParallel
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def job_gemfile
|
48
|
-
File.join(job_path, 'Gemfile')
|
50
|
+
@job_gemfile ||=File.join(job_path, 'Gemfile')
|
51
|
+
raise "Please make sure you have a Gemfile in the project root directory #{job_path}".red unless File.exists?(@job_gemfile)
|
52
|
+
@job_gemfile
|
49
53
|
end
|
50
54
|
|
51
55
|
def job_gemfile_lock
|
52
|
-
|
56
|
+
@job_gemfile_lock ||= "#{job_gemfile}.lock"
|
57
|
+
raise "Please make sure you have a Gemfile.lock in the project root directory #{job_path}".reds unless File.exists?(@job_gemfile_lock)
|
58
|
+
@job_gemfile_lock
|
53
59
|
end
|
54
60
|
|
55
61
|
def job_gem_version(gem_name)
|
@@ -93,7 +99,7 @@ module CapistranoMulticonfigParallel
|
|
93
99
|
end
|
94
100
|
|
95
101
|
def job_stage
|
96
|
-
|
102
|
+
app.present? && application_supports_multi_apps?(job_path) ? "#{app}:#{stage}" : "#{stage}"
|
97
103
|
end
|
98
104
|
|
99
105
|
def capistrano_action
|
@@ -293,7 +299,7 @@ module CapistranoMulticonfigParallel
|
|
293
299
|
CMD
|
294
300
|
f.write(cmd)
|
295
301
|
end
|
296
|
-
FileUtils.copy(
|
302
|
+
FileUtils.copy(job_gemfile_lock, "#{job_gemfile_multi}.lock")
|
297
303
|
end
|
298
304
|
end
|
299
305
|
|
@@ -47,6 +47,7 @@ module CapistranoMulticonfigParallel
|
|
47
47
|
config_file_path = @fetched_config.config_dir.present? ? File.join(@fetched_config.config_dir, 'multi_cap.yml') : nil
|
48
48
|
end
|
49
49
|
config_file = File.expand_path(config_file_path || File.join(detect_root.to_s, 'config', 'multi_cap.yml'))
|
50
|
+
@fetched_config.config_dir = File.dirname(config_file)
|
50
51
|
@fetched_config.log_dir = config_file_path.present? ? File.dirname(config_file) : File.dirname(File.dirname(config_file))
|
51
52
|
@fetched_config.read config_file if File.file?(config_file)
|
52
53
|
end
|
@@ -117,9 +117,12 @@ module CapistranoMulticonfigParallel
|
|
117
117
|
pathnames.present? && pathnames.is_a?(Array) ? pathnames.compact : pathnames
|
118
118
|
end
|
119
119
|
|
120
|
+
def try_detect_file_in_dir(filename = 'multi_cap.yml', dirs = ['config'])
|
121
|
+
root = dirs.is_a?(Array) && dirs.present? ? Pathname.new(File.join(FileUtils.pwd, *dirs)) : pwd_parent_dir
|
122
|
+
try_detect_file(filename, root)
|
123
|
+
end
|
120
124
|
|
121
|
-
def try_detect_file(filename = 'capfile')
|
122
|
-
root = pwd_parent_dir
|
125
|
+
def try_detect_file(filename = 'capfile', root = pwd_parent_dir )
|
123
126
|
root = root.parent until find_file_in_directory(root, filename)
|
124
127
|
pathname_is_root?(root) ? nil : root
|
125
128
|
end
|
@@ -5,24 +5,43 @@ module CapistranoMulticonfigParallel
|
|
5
5
|
module_function
|
6
6
|
|
7
7
|
def stages(path = nil)
|
8
|
-
path.
|
8
|
+
stages = path.present? ? fetch_stages_app(path) : []
|
9
|
+
if path.blank?
|
10
|
+
root = detect_root rescue nil
|
11
|
+
if root.present?
|
12
|
+
stages = stages.concat(fetch_stages_app(nil))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
stages
|
9
16
|
end
|
10
17
|
|
11
18
|
def multi_apps?(path = nil)
|
12
|
-
|
19
|
+
independent_deploy?(path) ? true : stages(path).find { |stage| stage.include?(':') }.present?
|
20
|
+
end
|
21
|
+
|
22
|
+
def application_supports_multi_apps?(path = nil)
|
23
|
+
fetch_stages_app(path).find { |stage| stage.include?(':') }.present?
|
13
24
|
end
|
14
25
|
|
15
|
-
def
|
26
|
+
def fetch_apps_from_file
|
16
27
|
configuration.application_dependencies.map { |hash| hash[:app] }
|
17
28
|
end
|
18
29
|
|
19
30
|
def app_names_from_stages
|
20
|
-
independent_deploy? ?
|
31
|
+
independent_deploy? ? fetch_apps_from_file : stages.map { |stage| stage.split(':').reverse[1] }.uniq
|
32
|
+
end
|
33
|
+
|
34
|
+
def configuration_has_valid_path?(hash)
|
35
|
+
hash[:path].present? && File.directory?(hash[:path])
|
36
|
+
end
|
37
|
+
|
38
|
+
def fetch_paths_from_file
|
39
|
+
configuration.application_dependencies.select { |hash| configuration_has_valid_path?(hash) }.map{ |hash| hash[:path] }
|
21
40
|
end
|
22
41
|
|
23
|
-
def independent_deploy?
|
24
|
-
|
25
|
-
configuration.config_dir.present? &&
|
42
|
+
def independent_deploy?(path = nil)
|
43
|
+
app_with_path = configuration.application_dependencies.find { |hash| configuration_has_valid_path?(hash).present? }
|
44
|
+
configuration.config_dir.present? && app_with_path.present? && (path.nil? || (path.present? && fetch_paths_from_file.include?(path))) ? true : false
|
26
45
|
end
|
27
46
|
|
28
47
|
def fetch_stages_app(path)
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|
@@ -247,7 +247,7 @@ dependencies:
|
|
247
247
|
version: '0.0'
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
|
-
version: 0.0.
|
250
|
+
version: 0.0.18
|
251
251
|
type: :runtime
|
252
252
|
prerelease: false
|
253
253
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -257,7 +257,7 @@ dependencies:
|
|
257
257
|
version: '0.0'
|
258
258
|
- - ">="
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version: 0.0.
|
260
|
+
version: 0.0.18
|
261
261
|
- !ruby/object:Gem::Dependency
|
262
262
|
name: powerbar
|
263
263
|
requirement: !ruby/object:Gem::Requirement
|