capistrano-magento2 0.7.3 → 0.8.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/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/capistrano/magento2/version.rb +1 -1
- data/lib/capistrano/tasks/deploy.rake +5 -1
- data/lib/capistrano/tasks/magento.rake +70 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39f8768fb9d567d6d6472c88c5678de0ab0301239c448ec8c553c2289b3bb7e2
|
4
|
+
data.tar.gz: b316370020b96dc2b90737ddfb56019e6f9f2097c93d05a208fdb622a0cd2b1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63c59ddd943416c55cd7216cccf5797dd361f8c091b4b067b394c96f4d199d07760b608b7e2deae4d455bc0af3ce4910ead1f1ffa14ab4ed04df47ed548a8f7
|
7
|
+
data.tar.gz: a67d479d4a50a102c13fe0de1e7749170b26efdb2c330f1e40da0ee4641a0c5be1bc9384cee67a3e7811c1928ed8ae9010e7f42c3108138481d684c6a410310e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -266,7 +266,7 @@ set :magento_deploy_pending_warn, false
|
|
266
266
|
### Pending Changes Configuration
|
267
267
|
|
268
268
|
| setting | what it does
|
269
|
-
| -------------------------------- |
|
269
|
+
| -------------------------------- | ----------
|
270
270
|
| `:magento_deploy_pending_role` | Role to check for pending changes on; defaults to `:all`
|
271
271
|
| `:magento_deploy_pending_warn` | Set this to `false` to disable confirmational warning on zero-change deployments
|
272
272
|
| `:magento_deploy_pending_format` | Can be used to set a custom change log format; refer to `defaults.rb` for example
|
@@ -30,8 +30,10 @@ namespace :deploy do
|
|
30
30
|
invoke 'magento:deploy:mode:production'
|
31
31
|
invoke 'magento:setup:static-content:deploy'
|
32
32
|
invoke 'magento:setup:di:compile'
|
33
|
+
invoke 'magento:composer:dump-autoload'
|
33
34
|
end
|
34
35
|
invoke 'magento:setup:permissions'
|
36
|
+
invoke 'magento:maintenance:check'
|
35
37
|
invoke 'magento:maintenance:enable' if fetch(:magento_deploy_maintenance)
|
36
38
|
|
37
39
|
on release_roles :all do
|
@@ -49,7 +51,9 @@ namespace :deploy do
|
|
49
51
|
on primary fetch(:magento_deploy_setup_role) do
|
50
52
|
within release_path do
|
51
53
|
if test :magento, 'app:config:import --help >/dev/null 2>&1'
|
52
|
-
|
54
|
+
if fetch(:magento_deploy_maintenance)
|
55
|
+
invoke 'magento:app:config:import'
|
56
|
+
end
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
@@ -124,6 +124,22 @@ namespace :magento do
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
desc 'Run composer dump-autoload'
|
128
|
+
task 'dump-autoload' do
|
129
|
+
|
130
|
+
on release_roles :all do
|
131
|
+
within release_path do
|
132
|
+
composer_flags = '--no-dev --no-interaction'
|
133
|
+
|
134
|
+
if fetch(:magento_deploy_production)
|
135
|
+
composer_flags += ' --optimize'
|
136
|
+
end
|
137
|
+
|
138
|
+
execute :composer, "dump-autoload #{composer_flags} 2>&1"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
127
143
|
task :auth_config do
|
128
144
|
on release_roles :all do
|
129
145
|
within release_path do
|
@@ -382,7 +398,60 @@ namespace :magento do
|
|
382
398
|
end
|
383
399
|
end
|
384
400
|
end
|
385
|
-
|
401
|
+
|
402
|
+
# Internal command used to check if maintenance mode is neeeded and disable when zero-down deploy is possible
|
403
|
+
task :check do
|
404
|
+
on primary fetch(:magento_deploy_setup_role) do
|
405
|
+
within release_path do
|
406
|
+
# Do not disable maintenance mode by default; require a postive id on database status output
|
407
|
+
disable_maintenance = false
|
408
|
+
|
409
|
+
# The setup:db:status command is only available in Magento 2.2.2 and later
|
410
|
+
if not test :magento, 'setup:db:status --help >/dev/null 2>&1'
|
411
|
+
info "Magento CLI command setup:db:status is not available. Maintenance mode will be used by default."
|
412
|
+
else
|
413
|
+
info "Checking database status..."
|
414
|
+
# Check setup:db:status output and disable maintenance mode if all modules are up-to-date
|
415
|
+
database_status = capture :magento, 'setup:db:status' , raise_on_non_zero_exit: false
|
416
|
+
|
417
|
+
if database_status.to_s.include? 'All modules are up to date'
|
418
|
+
info "All modules are up to date. No database updates should occur during this release."
|
419
|
+
puts ""
|
420
|
+
disable_maintenance = true
|
421
|
+
else
|
422
|
+
puts " #{database_status.gsub("\n", "\n ").sub("Run 'setup:upgrade' to update your DB schema and data.", "")}"
|
423
|
+
end
|
424
|
+
|
425
|
+
# Gather md5sums of app/etc/config.php on current and new release
|
426
|
+
config_hash_release = capture :md5sum, "#{release_path}/app/etc/config.php"
|
427
|
+
if test "[ -f #{current_path}/app/etc/config.php ]"
|
428
|
+
config_hash_current = capture :md5sum, "#{current_path}/app/etc/config.php"
|
429
|
+
else
|
430
|
+
config_hash_current = ("%-34s" % "n/a") + "#{current_path}/app/etc/config.php"
|
431
|
+
end
|
432
|
+
|
433
|
+
# Output some informational messages showing the config.php hash values
|
434
|
+
info "<release_path>/app/etc/config.php hash: #{config_hash_release.split(" ")[0]}"
|
435
|
+
info "<current_path>/app/etc/config.php hash: #{config_hash_current.split(" ")[0]}"
|
436
|
+
info ""
|
437
|
+
|
438
|
+
# If hashes differ, maintenance mode should not be disabled even if there are no database changes.
|
439
|
+
if config_hash_release.split(" ")[0] != config_hash_current.split(" ")[0]
|
440
|
+
info "Configuration hashes do not match. Maintenance mode will be used by default."
|
441
|
+
disable_maintenance = false
|
442
|
+
end
|
443
|
+
|
444
|
+
if disable_maintenance
|
445
|
+
info "Disabling use of maintenance mode for a zero-down deployment."
|
446
|
+
set :magento_deploy_maintenance, false
|
447
|
+
else
|
448
|
+
info "Maintenance mode usage will be enforced per :magento_deploy_maintenance (enabled by default)"
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
386
455
|
desc 'Disable maintenance mode'
|
387
456
|
task :disable do
|
388
457
|
on release_roles :all do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-magento2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Alger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|