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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47ee80fbfe3bb88274af33c6ab9eddd9baddd131423dbc316f97017b3a006d69
4
- data.tar.gz: fc1fdefa52f298c9ebfac211657b9918b2973bbfd9faabd781cbdf37e35b1ea4
3
+ metadata.gz: 39f8768fb9d567d6d6472c88c5678de0ab0301239c448ec8c553c2289b3bb7e2
4
+ data.tar.gz: b316370020b96dc2b90737ddfb56019e6f9f2097c93d05a208fdb622a0cd2b1d
5
5
  SHA512:
6
- metadata.gz: 65131dff8afc4dd63206993ffcb99539c7914752aaabcaccc9224a6aa4f23847f87bf4ca49c354eea7878ce95d0bb47d73ab652ff0fa284354438bd92ccaafce
7
- data.tar.gz: 6ce9e3458a0391453b402d13412efdb9e129917988d827a15d17b0c6a5f59645785848f55cbffb03bb7692c3299ab35753c0d46054e4298d576e473697c6f8a5
6
+ metadata.gz: b63c59ddd943416c55cd7216cccf5797dd361f8c091b4b067b394c96f4d199d07760b608b7e2deae4d455bc0af3ce4910ead1f1ffa14ab4ed04df47ed548a8f7
7
+ data.tar.gz: a67d479d4a50a102c13fe0de1e7749170b26efdb2c330f1e40da0ee4641a0c5be1bc9384cee67a3e7811c1928ed8ae9010e7f42c3108138481d684c6a410310e
@@ -1,5 +1,11 @@
1
1
  # Capistrano::Magento2 Change Log
2
2
 
3
+ 0.8.0
4
+ ==========
5
+
6
+ * Added support for zero-down deployment (PR #104, issue #34)
7
+ * Added call to "composer dump-autoload --no-dev --optimize" following DI compliation (issue #102)
8
+
3
9
  0.7.3
4
10
  ==========
5
11
 
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
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Capistrano
11
11
  module Magento2
12
- VERSION = '0.7.3'
12
+ VERSION = '0.8.0'
13
13
  end
14
14
  end
@@ -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
- invoke 'magento:app:config:import'
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.7.3
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-01-17 00:00:00.000000000 Z
11
+ date: 2018-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano