capistrano-magento2 0.8.8 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1ecc432d10021f836a35005807a6dc5127499d561a2081bd31168c2d1fc76a3
4
- data.tar.gz: ba295633cb33ae700bb1b9ddf5c99d418469079b91ef2c87173c5425e72bd20f
3
+ metadata.gz: eaad2347f8c69fd68747d7a8494e38558b1ae3cdd5d75e6a71d04ee1225ad2ef
4
+ data.tar.gz: 764b2205316cbc49e6f13ea576eb0e54e93db5c719dcbc2df246219412052da1
5
5
  SHA512:
6
- metadata.gz: 45e6e75fc726d56da63cbb53c46c17852e37472e5d6d34c53b8652417d4d3c35dac4fd6cb7ce5c5556f2cda7907b890415497cd6b57f0a5b9efa94cff02c9879
7
- data.tar.gz: 6db56c44607d0e4258fcb5dd84a3ee0e2d148dd010765b64fca5db056f3a89610f27ce1e1d507499eeeb6d931ef13457dfd6b152b93b8b2d68e9da712f56c37b
6
+ metadata.gz: 4660f8b4ca18c8b2e01689521c21c474dc8e7e79f7771de843e8e5c3b48b91585b45d4166cf7f00e9d368bd7203a425e4a22ffb375fcde3086258d591a611867
7
+ data.tar.gz: 9cf38dee19d05b07354542618b85e82fb1f09c96c80285c59e76b20a0a6bbf4b6866d55ba494404306b3766528b73902d6a4bd6189907f70797de676fb443cb8
@@ -1,5 +1,57 @@
1
1
  # Capistrano::Magento2 Change Log
2
2
 
3
+ 0.9.3
4
+ =========
5
+
6
+ * Updated to now specify `--non-interactive` flag on `app:config:import` so CLI command will not hang trying for user input.
7
+
8
+ 0.9.2
9
+ =========
10
+
11
+ * Fixed issue preventing use of `after` tasks on `magento:cache:flush` from being used to trigger service reloads at end of deployment ([issue #143](https://github.com/davidalger/capistrano-magento2/issues/143))
12
+ * Updated to use DSL method `invoke!` to call iterant tasks ([see capistrano/capistrano/pull/1911](https://github.com/capistrano/capistrano/pull/1911)))
13
+
14
+ 0.9.1
15
+ =========
16
+
17
+ * Fixed regression in 0.9.0 where relying on the `-l` flag broke multilingual static content deployment ([issue #141](https://github.com/davidalger/capistrano-magento2/issues/141))
18
+
19
+ 0.9.0
20
+ =========
21
+
22
+ **Upgrade Notes:**
23
+
24
+ As of this release only Magento 2.3 and later are supported and **support has been dropped for prior versions** which have long since reached their end-of-life. Moving forward versions past their EOL will no longer be supported by subsequent releases of this gem. Older versions of this gem may continue to be used to deploy older and EOL versions.
25
+
26
+ If using a `Gemfile` with Bundler to lock versions of dependencies used for execution, the version lock on `capistrano` should be updated to `~>1.13` to match the minimal requirement of this release, otherwise `bundle update` will fail to update to version `0.9.0` of this gem. The following is recommended:
27
+
28
+ ```
29
+ gem 'capistrano', '~> 3.14'
30
+ gem 'capistrano-magento2', '~> 0.9'
31
+ ```
32
+
33
+ If a capistrano version lock is present in a projects `deploy.rb` it will also need to be updated:
34
+
35
+ ```
36
+ lock '~> 3.14'
37
+ ```
38
+
39
+ **Change Summary:**
40
+
41
+ * Dropped support for EOL versions of Magento and scrubbed all gated logic around legacy behaviors in 2.1.x and 2.2.x
42
+ * Removed `magento:deploy:version_check` task and associated warning when attempting to deploy unsupported versions of Magento
43
+ * Updated required version of `capistrano` to `~> 1.13` (>=1.13 and less than 2.0)
44
+ * Resolved inability to use `--dry-run` flag ([issue #128](https://github.com/davidalger/capistrano-magento2/issues/128)) as made possible by the removal of all version related gating logic.
45
+ * Dropped explicit default of `:magento_deploy_languages`; will now only be passed to `bin/magento` call when set in project configuration.
46
+ * Updated zero-down deployment logic to rely on `app:config:status` to detect config changes rather than the md5sum of config.php in current and release directories.
47
+ * Added `magento:app:config:status` to available commands for manual execution.
48
+ * Fixes issue in 2.3.4 and later where app:config:import may fail if cache:flush is not run immediately prior ([issue #138](https://github.com/davidalger/capistrano-magento2/issues/138))
49
+
50
+ 0.8.9
51
+ =========
52
+
53
+ * Fixed issue with RabbitMQ settings caused by app:config:import running after setup-upgrade step vs prior to the database upgrades (which connects to RabbitMQ in recurring data upgrade scripts)
54
+
3
55
  0.8.8
4
56
  ==========
5
57
 
data/README.md CHANGED
@@ -6,7 +6,10 @@ A Capistrano extension for Magento 2 deployments. Takes care of specific Magento
6
6
 
7
7
  ## Supported Magento Versions
8
8
 
9
- **As of version 0.7.0 this gem only supports deployment of Magento 2.1.1 or later; please use an earlier version to deploy older releases of Magento 2**
9
+ The following describes minimum Magento versions supported by releases of this gem. Please use an earlier version to deploy older releases of Magento not supported by the most recent iterations of this gem.
10
+
11
+ * Version 0.9.x supports deployment of Magento 2.3.0 and later.
12
+ * Version 0.7.x supports deployment of Magento 2.1.1 and later.
10
13
 
11
14
  ## Installation
12
15
 
@@ -118,35 +121,33 @@ Before you can use Capistrano to deploy, you must configure the `config/deploy.r
118
121
 
119
122
  ### Magento Deploy Settings
120
123
 
121
- | setting | default | what it does
122
- | ------------------------------ | ------- | ---
123
- | `:magento_deploy_setup_role` | `:all` | Role from which primary host is chosen to run things like setup:upgrade on
124
- | `:magento_deploy_cache_shared` | `true` | If true, cache operations are restricted to the primary node in setup role
125
- | `:magento_deploy_languages` | `['en_US']` | Array of languages passed to static content deploy routine
126
- | `:magento_deploy_themes` | `[]` | Array of themes passed to static content deploy
127
- | `:magento_deploy_jobs` | `4` | Number of threads to use for static content deploy
128
- | `:magento_deploy_composer` | `true` | Enables composer install behaviour in the built-in deploy routine
129
- | `:magento_deploy_production` | `true` | Enables production specific DI compilation and static content generation
130
- | `:magento_deploy_no_dev` | `true` | Enables use of --no-dev flag on composer install
131
- | `:magento_deploy_maintenance` | `true` | Enables use of maintenance mode while magento:setup:upgrade runs
132
- | `:magento_deploy_confirm` | `[]` | Used to require confirmation of deployment to a set of capistrano stages
133
- | `:magento_deploy_chmod_d` | `2770` | Default permissions applied to all directories in the release path
134
- | `:magento_deploy_chmod_f` | `0660` | Default permissions applied to all non-executable files in the release path
124
+ | setting | default | what it does
125
+ | ------------------------------ | -------- | ---
126
+ | `:magento_deploy_setup_role` | `:all` | Role from which primary host is chosen to run things like setup:upgrade on
127
+ | `:magento_deploy_cache_shared` | `true` | If true, cache operations are restricted to the primary node in setup role
128
+ | `:magento_deploy_languages` | `[]` | Array of languages passed to static content deploy routine
129
+ | `:magento_deploy_themes` | `[]` | Array of themes passed to static content deploy
130
+ | `:magento_deploy_jobs` | `nil` | Number of threads to use for static content deploy
131
+ | `:magento_deploy_composer` | `true` | Enables composer install behavior in the built-in deploy routine
132
+ | `:magento_deploy_production` | `true` | Enables production specific DI compilation and static content generation
133
+ | `:magento_deploy_no_dev` | `true` | Enables use of --no-dev flag on composer install
134
+ | `:magento_deploy_maintenance` | `true` | Enables use of maintenance mode while magento:setup:upgrade runs
135
+ | `:magento_deploy_confirm` | `[]` | Used to require confirmation of deployment to a set of capistrano stages
136
+ | `:magento_deploy_chmod_d` | `'2770'` | Default permissions applied to all directories in the release path
137
+ | `:magento_deploy_chmod_f` | `'0660'` | Default permissions applied to all non-executable files in the release path
135
138
  | `:magento_deploy_chmod_x` | `['bin/magento']` | Default list of files in release path to set executable bit on
136
- | `:magento_deploy_strategy` | `nil` | Can be `quick`, `standard` or `compact`; supported by Magento 2.2 or later
139
+ | `:magento_deploy_strategy` | `nil` | Can be `quick`, `standard` or `compact`
137
140
 
138
141
  #### Example Usage
139
142
 
140
143
  Add a line similar to the following in `config/deploy.rb` to set a custom value on one of the above settings:
141
144
 
142
145
  ```ruby
146
+ set :magento_deploy_jobs, '$(nproc)'
147
+ set :magento_deploy_themes, ['Magento/backend', 'Magento/blank']
143
148
  set :magento_deploy_languages, ['en_US', 'en_CA']
144
149
  ```
145
150
 
146
- ```ruby
147
- set :magento_deploy_composer, false
148
- ```
149
-
150
151
  ### Capistrano Built-Ins
151
152
 
152
153
  For the sake of simplicity in new project setups `:linked_dirs` and `:linked_files` are pre-configured per the following.
@@ -154,7 +155,6 @@ For the sake of simplicity in new project setups `:linked_dirs` and `:linked_fil
154
155
  ```ruby
155
156
  set :linked_files, [
156
157
  'app/etc/env.php',
157
- 'app/etc/config.local.php',
158
158
  'var/.setup_cronjob_status',
159
159
  'var/.update_cronjob_status'
160
160
  ]
@@ -178,8 +178,6 @@ If you would like to customize the linked files or directories for your project,
178
178
  append :linked_dirs, 'path/to/link'
179
179
  ```
180
180
 
181
- Support for a `app/etc/config.local.php` configuration file was added to Magento 2.1.6. This file will be linked in from the `shared/app/etc` directory as of v0.6.4 of this gem. If this file is present in the project repository, the file will not be linked.
182
-
183
181
  ### Composer Auth Credentials
184
182
 
185
183
  Magento 2's composer repository requires auth credentials to install. These can be set on target servers in a global composer `auth.json` file, the project's `composer.json` or by setting them in your deployment configuration using the following two settings:
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency 'capistrano', '~> 3.1'
30
+ spec.add_dependency 'capistrano', '~> 3.14'
31
31
 
32
- spec.add_development_dependency 'bundler', '~> 2.0'
33
- spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'bundler', '~> 2.1'
33
+ spec.add_development_dependency 'rake', '~> 13.0'
34
34
  end
@@ -14,10 +14,6 @@ SSHKit.config.command_map[:magento] = "/usr/bin/env php -f bin/magento --"
14
14
  module Capistrano
15
15
  module Magento2
16
16
  module Helpers
17
- def magento_version
18
- return Gem::Version::new((capture :php, "-f #{release_path}/bin/magento -- -V --no-ansi").split(' ').pop)
19
- end
20
-
21
17
  def disabled_modules
22
18
  output = capture :magento, 'module:status --no-ansi'
23
19
  output = output.split("disabled modules:\n", 2)[1]
@@ -34,24 +30,6 @@ module Capistrano
34
30
  end
35
31
 
36
32
  module Setup
37
- def static_content_deploy params
38
- if magento_version >= Gem::Version.new('2.2.0-rc')
39
- # Using -f here just in case MAGE_MODE environment variable in shell is set to something other than production
40
- execute :magento, "setup:static-content:deploy -f #{params}"
41
- else
42
- # Sets pipefail option in shell allowing command exit codes to halt execution when piping command output
43
- if not SSHKit.config.command_map[:magento].include? 'set -o pipefail' # avoids trouble on multi-host deploys
44
- @@pipefail_less = SSHKit.config.command_map[:magento].dup
45
- SSHKit.config.command_map[:magento] = "set -o pipefail; #{@@pipefail_less}"
46
- end
47
-
48
- execute :magento, "setup:static-content:deploy #{params} | stdbuf -o0 tr -d ."
49
-
50
- # Unsets pipefail option in shell so it won't affect future command executions
51
- SSHKit.config.command_map[:magento] = @@pipefail_less
52
- end
53
- end
54
-
55
33
  def deployed_version
56
34
  # Generate a static content version string, but only if one has not already been set on a previous call
57
35
  if not fetch(:magento_static_deployed_version)
@@ -9,14 +9,12 @@
9
9
 
10
10
  set :linked_files, fetch(:linked_files, []).push(
11
11
  'app/etc/env.php',
12
- 'app/etc/config.local.php',
13
12
  'var/.setup_cronjob_status',
14
13
  'var/.update_cronjob_status'
15
14
  )
16
15
 
17
16
  set :linked_files_touch, fetch(:linked_files_touch, []).push(
18
17
  'app/etc/env.php',
19
- 'app/etc/config.local.php',
20
18
  'var/.setup_cronjob_status',
21
19
  'var/.update_cronjob_status'
22
20
  )
@@ -47,13 +45,13 @@ set :magento_deploy_chmod_x, fetch(:magento_deploy_chmod_x, ['bin/magento'])
47
45
  # deploy configuration defaults
48
46
  set :magento_deploy_composer, fetch(:magento_deploy_composer, true)
49
47
  set :magento_deploy_confirm, fetch(:magento_deploy_confirm, [])
50
- set :magento_deploy_languages, fetch(:magento_deploy_languages, ['en_US'])
48
+ set :magento_deploy_languages, fetch(:magento_deploy_languages, [])
51
49
  set :magento_deploy_maintenance, fetch(:magento_deploy_maintenance, true)
52
50
  set :magento_deploy_production, fetch(:magento_deploy_production, true)
53
51
  set :magento_deploy_no_dev, fetch(:magento_deploy_no_dev, true)
54
52
  set :magento_deploy_themes, fetch(:magento_deploy_themes, [])
55
- set :magento_deploy_jobs, fetch(:magento_deploy_jobs, nil) # this defaults to 4 when supported by bin/magento
56
- set :magento_deploy_strategy, fetch(:magento_deploy_strategy, nil) # Magento 2.2 or later only: http://bit.ly/2yhMvVv
53
+ set :magento_deploy_jobs, fetch(:magento_deploy_jobs, nil)
54
+ set :magento_deploy_strategy, fetch(:magento_deploy_strategy, nil)
57
55
 
58
56
  # deploy targetting defaults
59
57
  set :magento_deploy_setup_role, fetch(:magento_deploy_setup_role, :all)
@@ -9,6 +9,6 @@
9
9
 
10
10
  module Capistrano
11
11
  module Magento2
12
- VERSION = '0.8.8'
12
+ VERSION = '0.9.3'
13
13
  end
14
14
  end
@@ -11,7 +11,6 @@ include Capistrano::Magento2::Helpers
11
11
 
12
12
  namespace :deploy do
13
13
  before 'deploy:check:linked_files', 'magento:deploy:check'
14
- before 'deploy:symlink:linked_files', 'magento:deploy:local_config'
15
14
 
16
15
  # If both 'scopes' and 'themes' are available in app/etc/config.php then the build should not require database or
17
16
  # cache backend configuration to deploy. Removing the link to app/etc/env.php in this case prevents any possible
@@ -50,7 +49,6 @@ namespace :deploy do
50
49
  task :updated do
51
50
  invoke 'magento:deploy:verify'
52
51
  invoke 'magento:composer:install' if fetch(:magento_deploy_composer)
53
- invoke 'magento:deploy:version_check'
54
52
  invoke 'magento:setup:permissions'
55
53
 
56
54
  if fetch(:magento_deploy_production)
@@ -65,7 +63,7 @@ namespace :deploy do
65
63
  invoke 'magento:deploy:mode:production'
66
64
  end
67
65
 
68
- invoke 'magento:setup:permissions'
66
+ invoke! 'magento:setup:permissions'
69
67
  invoke 'magento:maintenance:check'
70
68
  invoke 'magento:maintenance:enable' if fetch(:magento_deploy_maintenance)
71
69
 
@@ -77,18 +75,15 @@ namespace :deploy do
77
75
  end
78
76
  end
79
77
 
80
- invoke 'magento:setup:db:schema:upgrade' if not fetch(:magento_internal_zero_down_flag)
81
- invoke 'magento:setup:db:data:upgrade' if not fetch(:magento_internal_zero_down_flag)
82
-
83
- # The app:config:import command was introduced in 2.2.0; check if it exists before invoking it
84
- on primary fetch(:magento_deploy_setup_role) do
85
- within release_path do
86
- if test :magento, 'app:config:import --help >/dev/null 2>&1'
87
- if not fetch(:magento_internal_zero_down_flag)
88
- invoke 'magento:app:config:import'
89
- end
78
+ if not fetch(:magento_internal_zero_down_flag)
79
+ on cache_hosts do
80
+ within release_path do
81
+ execute :magento, 'cache:flush'
90
82
  end
91
83
  end
84
+ invoke 'magento:app:config:import'
85
+ invoke 'magento:setup:db:schema:upgrade'
86
+ invoke 'magento:setup:db:data:upgrade'
92
87
  end
93
88
 
94
89
  on primary fetch(:magento_deploy_setup_role) do
@@ -27,7 +27,16 @@ namespace :magento do
27
27
  task :import do
28
28
  on primary fetch(:magento_deploy_setup_role) do
29
29
  within release_path do
30
- execute :magento, 'app:config:import'
30
+ execute :magento, 'app:config:import --no-interaction'
31
+ end
32
+ end
33
+ end
34
+
35
+ desc 'Checks if config propagation requires update'
36
+ task :status do
37
+ on primary fetch(:magento_deploy_setup_role) do
38
+ within release_path do
39
+ execute :magento, 'app:config:status'
31
40
  end
32
41
  end
33
42
  end
@@ -184,19 +193,6 @@ namespace :magento do
184
193
  end
185
194
  end
186
195
 
187
- task :version_check do
188
- on release_roles(:all), in: :sequence, wait: 1 do
189
- within release_path do
190
- _magento_version = magento_version
191
- unless _magento_version >= Gem::Version.new('2.1.1')
192
- error "\e[0;31mVersion 0.7.0 and later of this gem only support deployment of Magento 2.1.1 or newer; " +
193
- "attempted to deploy v" + _magento_version.to_s + ". Please try again using an earlier version of this gem!\e[0m"
194
- exit 1 # only need to check a single server, exit immediately
195
- end
196
- end
197
- end
198
- end
199
-
200
196
  task :check do
201
197
  on release_roles :all do
202
198
  next unless any? :linked_files_touch
@@ -231,17 +227,6 @@ namespace :magento do
231
227
  end
232
228
  exit 1 if is_err
233
229
  end
234
-
235
- task :local_config do
236
- on release_roles :all do
237
- if test "[ -f #{release_path}/app/etc/config.local.php ]"
238
- info "The repository contains app/etc/config.local.php, removing from :linked_files list."
239
- _linked_files = fetch(:linked_files, [])
240
- _linked_files.delete('app/etc/config.local.php')
241
- set :linked_files, _linked_files
242
- end
243
- end
244
- end
245
230
  end
246
231
 
247
232
  namespace :setup do
@@ -258,7 +243,7 @@ namespace :magento do
258
243
  end
259
244
 
260
245
  namespace :db do
261
- desc 'Checks if database schema and/or data require upgrading'
246
+ desc 'Checks if DB schema or data requires upgrade'
262
247
  task :status do
263
248
  on primary fetch(:magento_deploy_setup_role) do
264
249
  within release_path do
@@ -311,7 +296,6 @@ namespace :magento do
311
296
  end
312
297
  end
313
298
  end
314
- Rake::Task['magento:setup:permissions'].reenable ## make task perpetually callable
315
299
  end
316
300
 
317
301
  namespace :di do
@@ -320,12 +304,7 @@ namespace :magento do
320
304
  on release_roles :all do
321
305
  within release_path do
322
306
  with mage_mode: :production do
323
- output = capture :magento, 'setup:di:compile --no-ansi', verbosity: Logger::INFO
324
-
325
- # 2.1.x doesn't return a non-zero exit code for certain errors (see davidalger/capistrano-magento2#41)
326
- if output.to_s.include? 'Errors during compilation'
327
- raise Exception, 'DI compilation command execution failed'
328
- end
307
+ execute :magento, "setup:di:compile"
329
308
  end
330
309
  end
331
310
  end
@@ -337,62 +316,36 @@ namespace :magento do
337
316
  task :deploy do
338
317
  on release_roles :all do
339
318
  with mage_mode: :production do
340
- _magento_version = magento_version
319
+ deploy_languages = fetch(:magento_deploy_languages)
320
+ if deploy_languages.count() > 0
321
+ deploy_languages = deploy_languages.join(' ').prepend(' ')
322
+ else
323
+ deploy_languages = nil
324
+ end
341
325
 
342
326
  deploy_themes = fetch(:magento_deploy_themes)
343
- deploy_jobs = fetch(:magento_deploy_jobs)
344
-
345
327
  if deploy_themes.count() > 0
346
328
  deploy_themes = deploy_themes.join(' -t ').prepend(' -t ')
347
329
  else
348
330
  deploy_themes = nil
349
331
  end
350
332
 
333
+ deploy_jobs = fetch(:magento_deploy_jobs)
351
334
  if deploy_jobs
352
- deploy_jobs = "--jobs #{deploy_jobs} "
335
+ deploy_jobs = " --jobs #{deploy_jobs}"
353
336
  else
354
337
  deploy_jobs = nil
355
338
  end
356
339
 
357
- # Workaround core-bug with multi-lingual deployments on Magento 2.1.3 and greater. In these versions each
358
- # language must be iterated individually. See issue #72 for details.
359
- if _magento_version >= Gem::Version.new('2.1.3')
360
- deploy_languages = fetch(:magento_deploy_languages)
361
- else
362
- deploy_languages = [fetch(:magento_deploy_languages).join(' ')]
363
- end
364
-
365
- # Magento 2.2 introduced static content compilation strategies that can be one of the following:
340
+ # Static content compilation strategies that can be one of the following:
366
341
  # quick (default), standard (like previous versions) or compact
367
342
  compilation_strategy = fetch(:magento_deploy_strategy)
368
- if compilation_strategy and _magento_version >= Gem::Version.new('2.2.0')
369
- compilation_strategy = "-s #{compilation_strategy} "
370
- else
371
- compilation_strategy = nil
343
+ if compilation_strategy
344
+ compilation_strategy = " -s #{compilation_strategy}"
372
345
  end
373
346
 
374
347
  within release_path do
375
- # Magento 2.1 will fail to deploy if this file does not exist and static asset signing is enabled
376
- execute :touch, "#{release_path}/pub/static/deployed_version.txt"
377
-
378
- # This loop exists to support deploy on versions where each language must be deployed seperately
379
- deploy_languages.each do |lang|
380
- static_content_deploy "#{compilation_strategy}#{deploy_jobs}#{lang}#{deploy_themes}"
381
- end
382
- end
383
-
384
- # Run again with HTTPS env var set to 'on' to pre-generate secure versions of RequireJS configs. A
385
- # single run on these Magento versions will fail to generate the secure requirejs-config.js file.
386
- if _magento_version < Gem::Version.new('2.1.8')
387
- deploy_flags = ['css', 'less', 'images', 'fonts', 'html', 'misc', 'html-minify']
388
- .join(' --no-').prepend(' --no-');
389
-
390
- within release_path do with(https: 'on') {
391
- # This loop exists to support deploy on versions where each language must be deployed seperately
392
- deploy_languages.each do |lang|
393
- static_content_deploy "#{compilation_strategy}#{deploy_jobs}#{lang}#{deploy_themes}#{deploy_flags}"
394
- end
395
- } end
348
+ execute :magento, "setup:static-content:deploy#{compilation_strategy}#{deploy_jobs}#{deploy_languages}#{deploy_themes}"
396
349
  end
397
350
 
398
351
  # Set the deployed_version of static content to ensure it matches across all hosts
@@ -450,51 +403,43 @@ namespace :magento do
450
403
  end
451
404
 
452
405
  within release_path do
453
- # The setup:db:status command is only available in Magento 2.2.2 and later
454
- if not test :magento, 'setup:db:status --help >/dev/null 2>&1'
455
- info "Magento CLI command setup:db:status is not available. Maintenance mode will be used by default."
456
- else
457
- info "Checking database status..."
458
- # Check setup:db:status output and disable maintenance mode if all modules are up-to-date
459
- database_status = capture :magento, 'setup:db:status', raise_on_non_zero_exit: false
460
-
461
- if database_status.to_s.include? 'All modules are up to date'
462
- info "All modules are up to date. No database updates should occur during this release."
463
- info ""
464
- disable_maintenance = true
465
- else
466
- puts " #{database_status.gsub("\n", "\n ").sub("Run 'setup:upgrade' to update your DB schema and data.", "")}"
467
- end
406
+ info "Checking database status..."
407
+ # Check setup:db:status output and if out-of-date do not disable maintenance mode
408
+ database_status = capture :magento, 'setup:db:status', raise_on_non_zero_exit: false
409
+ database_uptodate = false
468
410
 
469
- # Gather md5sums of app/etc/config.php on current and new release
470
- info "Checking config status..."
471
- config_hash_release = capture :md5sum, "#{release_path}/app/etc/config.php"
472
- if test "[ -f #{current_path}/app/etc/config.php ]"
473
- config_hash_current = capture :md5sum, "#{current_path}/app/etc/config.php"
474
- else
475
- config_hash_current = ("%-34s" % "n/a") + "#{current_path}/app/etc/config.php"
476
- end
411
+ if database_status.to_s.include? 'All modules are up to date'
412
+ info "All modules are up to date."
413
+ info ""
414
+ database_uptodate = true
415
+ else
416
+ puts " #{database_status.gsub("\n", "\n ").sub(" Run 'setup:upgrade' to update your DB schema and data.", "")}"
417
+ end
477
418
 
478
- # Output some informational messages showing the config.php hash values
479
- info "<release_path>/app/etc/config.php hash: #{config_hash_release.split(" ")[0]}"
480
- info "<current_path>/app/etc/config.php hash: #{config_hash_current.split(" ")[0]}"
419
+ # Check app:config:status output and if out-of-date do not disable maintenance mode
420
+ info "Checking config status..."
421
+ config_status = capture :magento, 'app:config:status', raise_on_non_zero_exit: false
422
+ config_uptodate = false
481
423
 
482
- # If hashes differ, maintenance mode should not be disabled even if there are no database changes.
483
- if config_hash_release.split(" ")[0] != config_hash_current.split(" ")[0]
484
- info "Maintenance mode will not be disabled (config hashes differ)."
485
- disable_maintenance = false
486
- end
487
- info ""
424
+ if config_status.to_s.include? 'Config files are up to date'
425
+ info "Config files are up to date."
426
+ config_uptodate = true
427
+ else
428
+ puts " #{config_status.gsub("\n", "\n ").sub(" Run app:config:import or setup:upgrade command to synchronize configuration.", "")}"
488
429
  end
430
+ info ""
489
431
 
490
- if maintenance_enabled or disable_maintenance
491
- info "Disabling maintenance mode management..."
432
+ # If both checks above reported up-to-date status checks disable maintenance mode
433
+ if database_uptodate and config_uptodate
434
+ disable_maintenance = true
492
435
  end
493
436
 
494
437
  if maintenance_enabled
438
+ info "Disabling maintenance mode management..."
495
439
  info "Maintenance mode was already active prior to deploy."
496
440
  set :magento_deploy_maintenance, false
497
441
  elsif disable_maintenance
442
+ info "Disabling maintenance mode management..."
498
443
  info "There are no database updates or config changes. This is a zero-down deployment."
499
444
  set :magento_internal_zero_down_flag, true # Set internal flag to stop db schema/data upgrades from running
500
445
  set :magento_deploy_maintenance, false # Disable maintenance mode management since it is not neccessary
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.8.8
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Alger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-12 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '3.14'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '3.14'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '2.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  description: A Capistrano extension for Magento 2 deployments. Takes care of specific
56
56
  Magento 2 requirements and adds tasks specific to the Magento 2 application.
57
57
  email:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.0.3
103
+ rubygems_version: 3.1.2
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: A Capistrano extension for Magento 2 deployments.