capistrano-sozo_magento2 1.2.1 → 1.5.0

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: 808960e0120a734084b78112c9497f68ed02df489515f806d9ffc0108c368ed2
4
- data.tar.gz: dd00b79984f21952466e405443b006263e820517c2a0661cea0e4961a02991d2
3
+ metadata.gz: 3fa61acab72e33f1a3789e0269e74ceacf1f60378d2f7bb64d69e51dfde72db8
4
+ data.tar.gz: 01e1f815d06be786694d9838f388f9af67276011e7b76e22347734c102a24210
5
5
  SHA512:
6
- metadata.gz: a95a1a495572c06f9dcda5c8e535bc4785349044b0fb5c95702fc3aa8191b1337a3f64c9e977b97a914905b2c2a54278a2cb0df1473703850b6869179999803e
7
- data.tar.gz: 5d32ba014c057f5a3e7116d99c68dad25a2432102688de1905b19793c2920f3ab477816eacfaf19b29f8a5b6e4d01af9fc8a5b60561efcc31da658301c4b3d04
6
+ metadata.gz: 45fb372601ec28fd07b4ce2b5f3b061de594fa2f3a3aa2e0b9c6527ec5b6d49884f09e6d5bce481141db73d794a10ef11a0389c6decf7f0cd9171a98ea915eda
7
+ data.tar.gz: f537d26e505bcdef55174db3a93f396aceb5222006a5605d72775a453b77147c8385d2c294fbd4c52e0eb43610a6695838d91018f619a2be6f85df07cc170854
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --protected
2
+ --no-private
3
+ -
4
+ CHANGELOG.md
5
+ LICENSE
data/CHANGELOG.md CHANGED
@@ -21,14 +21,52 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
21
21
 
22
22
  ## [Unreleased]
23
23
 
24
- ## [v1.2.1] - 2020-05-06
24
+ ## [v1.5.0] - 2022-02-22
25
+ ### Added
26
+ - Option to not clear files if the deployment fails via the `:clear_failures` option
27
+ - Option to await user input before putting site in maintenance mode with `:magento_deploy_confirm_roles`
28
+
29
+ ### Changed
30
+ - Deployment task order to lower site downtime.
31
+ - WordPress twentytwentyone theme removed now by default.
32
+
33
+ ### Removed
34
+ - magento:patches:apply command removed as it's part of the composer.bash ran at install time.
35
+
36
+
37
+ ## [v1.4.0] - 2021-08-03
38
+ ### Added
39
+ - New `deploy:check` info output with key information displayed.
40
+ - Magento Cron control now included in the deployment methods with `:handle_cron` option (default false).
41
+ - New check `sozo:git:check` to see if the branch exists in the repository before deployment begins.
42
+ - Documented code with Yardoc
43
+
44
+ ### Changed
45
+ - Delay added (3 seconds) before trying to delete a failed deployment to allow file or disk activity to finish.
46
+ - Added sudo to failed deployments release deleting.
47
+ - Changed maintenance mode path to use the `deploy_root` location from `current_path`
48
+ - Checked all boolean values against string "true" or "false" using .to_s == 'true'
49
+
50
+
51
+ ## [v1.3.1] - 2021-07-29
52
+ ### Changed
53
+ - Changed ENV options for WordPress plugins and themes removal.
54
+ - Multi-PHP support via ability to pass PHP version via the command map.
55
+
56
+
57
+ ## [v1.3.0] - 2021-05-14
58
+ ### Added
59
+ - New task to check for ece-patches file `.magento.env.yaml` and to apply if it finds one.
60
+
61
+
62
+ ## [v1.2.1] - 2021-05-06
25
63
  ### Fixed
26
64
  - WordPress backup not respecting the :wp_backup false option
27
65
  - Erroneous symlink created inside release directories
28
66
  - Added simple text output in Slack message
29
67
 
30
68
 
31
- ## [v1.2.0] - 2020-03-25
69
+ ## [v1.2.0] - 2021-03-25
32
70
  ### Added
33
71
  - New variable `clear_failures` for future use.
34
72
  - New Slack class to control the message template.
@@ -45,7 +83,7 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
45
83
  - Fix issue when there were less than CAP_KEEP_BACKUPS available.
46
84
 
47
85
 
48
- ## [v1.1.0] - 2020-02-24
86
+ ## [v1.1.0] - 2021-02-24
49
87
  ### Added
50
88
  - Added defaults for the :wp_backup, :keep_backups and :slack_channel instead of using ENV's
51
89
  - Added BUILD.md for reminders on how to build and publish the gem.
@@ -61,7 +99,7 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
61
99
  - Confirm command now using correct symbols to display against roles.
62
100
 
63
101
 
64
- ## [v1.0.1] - 2020-02-20
102
+ ## [v1.0.1] - 2021-02-20
65
103
  ### Added
66
104
  - CHANGELOG.md
67
105
  - License text
@@ -71,5 +109,5 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
71
109
  - Documentation references to the gem.
72
110
 
73
111
 
74
- ### [v1.0.0] - 2020-02-20
112
+ ### [v1.0.0] - 2021-02-20
75
113
  - Initial release
data/README.md CHANGED
@@ -7,7 +7,7 @@ It is advised to use bundler.
7
7
 
8
8
  1. Add the following to your projects `Gemfile`
9
9
  ```
10
- gem "capistrano-sozo_magento2", "~> 1.2"
10
+ gem "capistrano-sozo_magento2", "~> 1.5"
11
11
  ```
12
12
  2. Install
13
13
  ```
@@ -62,6 +62,20 @@ If you would like to customize the linked files or directories for your project,
62
62
  append :linked_dirs, 'path/to/link'
63
63
  ```
64
64
 
65
+ ## Command Mapping
66
+ The module assumes the following bin files are in the following locations:
67
+ 1. `php` in your path accessible from the command line as php
68
+ 2. `composer` in `/usr/local/bin/composer`
69
+ 3. `n98-magerun` in `/usr/local/bin/n98-magerun`
70
+
71
+ Composer and n98-magerun command are both prefixed with the PHP path (for multi-php support), if you are overwriting these commands via the command map you will need to include the php bin in your `stage.rb` file similar to the following.
72
+ ```
73
+ SSHKit.config.command_map[:php] = '/usr/bin/env php74 -dmemory_limit=-1'
74
+ SSHKit.config.command_map[:composer] = SSHKit.config.command_map[:php], '-f /usr/local/bin/composer'
75
+ SSHKit.config.command_map[:n98magerun] = SSHKit.config.command_map[:php], '-f /usr/local/bin/n98-magerun'
76
+ SSHKit.config.command_map[:magento] = SSHKit.config.command_map[:php], '-f bin/magento --'
77
+ ```
78
+
65
79
  ## Versioning
66
80
  We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/sozo-design/capistrano-sozo-magento2/tags) or [CHANGELOG.md](./CHANGELOG.md).
67
81
 
@@ -27,9 +27,14 @@ set :composer_require_dev_flags, '--optimize-autoloader --prefer-dist'
27
27
  set :date_path, Time.now.strftime("%Y%m%d%H%M%S")
28
28
  set :backupdir, ->{ "#{fetch(:deploy_root)}/backups" }
29
29
  set :backupdirdate, ->{ "#{fetch(:backupdir)}/#{fetch(:date_path)}" }
30
- set :wp_backup, fetch(:wp_backup, true)
31
30
  set :keep_backups, fetch(:keep_backups, 10)
32
31
 
32
+ # WordPress integration defaults
33
+ set :wp_backup, fetch(:wp_backup, true)
34
+ set :wp_delete_themes, fetch(:wp_delete_themes, 'twentyseventeen twentynineteen twentytwenty twentytwentyone')
35
+ set :wp_delete_plugins, fetch(:wp_delete_plugins, 'hello')
36
+ set :wp_disable_plugins, fetch(:wp_disable_plugins, '')
37
+
33
38
  # Slack defaults
34
39
  set :slack_channel, fetch(:slack_channel, '#deployments')
35
40
  set :slack_webhook, 'https://hooks.slack.com/services/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'
@@ -37,6 +42,9 @@ set :slack_webhook, 'https://hooks.slack.com/services/T06K8GR2L/
37
42
  # Deployment defaults
38
43
  set :magento_deploy_confirm_roles, fetch(:magento_deploy_confirm_roles, [])
39
44
 
45
+ # Handle removing and installing of cron tasks?
46
+ set :handle_cron, fetch(:handle_cron, false)
47
+
40
48
  # Other defaults (for future use)
41
49
  # Clear or leave the failed deployment dirs
42
- set :clear_failures, fetch(:clear_failures, true)
50
+ set :clear_failures, fetch(:clear_failures, true)
@@ -0,0 +1,64 @@
1
+ require "capistrano/doctor/output_helpers"
2
+
3
+ include Capistrano::DSL
4
+
5
+ # @author Clive Walkden
6
+ module SozoMagento2
7
+ # Class to out key information at the end of the deploy:check command
8
+ module Info
9
+ # Class to out key information at the end of the deploy:check command
10
+ class Info
11
+ WHITELIST = %i(
12
+ branch
13
+ environment
14
+ handle_cron
15
+ slack_channel
16
+ url
17
+ ).freeze
18
+ private_constant :WHITELIST
19
+
20
+ include Capistrano::Doctor::OutputHelpers
21
+
22
+ # Initialize the class with access to env data
23
+ def initialize(env=Capistrano::Configuration.env)
24
+ @env = env
25
+ end
26
+
27
+ # Output the key information in the CLI
28
+ def call
29
+ title("Deployment Info")
30
+
31
+ values = inspect_all_values
32
+
33
+ table(values.keys.sort_by(&:to_s)) do |key, row|
34
+ row.yellow if values[key] == "\"production\""
35
+ row << key.inspect
36
+ row << ''
37
+ row << values[key]
38
+ end
39
+
40
+ puts("")
41
+ warning("Make sure you check these values before deploying!")
42
+ puts("")
43
+ end
44
+
45
+ private
46
+
47
+ attr_reader :env
48
+
49
+ # Read all variables in
50
+ def variables
51
+ env.variables
52
+ end
53
+
54
+ # Only include variables in the whitelist
55
+ def inspect_all_values
56
+ variables.keys.each_with_object({}) do |key, inspected|
57
+ if WHITELIST.include?(key)
58
+ inspected[key] = variables.peek(key).inspect
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -2,8 +2,12 @@ require 'json'
2
2
 
3
3
  include Capistrano::DSL
4
4
 
5
+ # @author Clive Walkden
5
6
  module SozoMagento2
7
+ # Slack message template
6
8
  module Slack
9
+ # Slack message template
10
+ # @return [String] the template hash
7
11
  def message_hash
8
12
  {
9
13
  "channel" => fetch(:slack_channel),
@@ -1,5 +1,9 @@
1
+ # @author Clive Walkden
1
2
  module Capistrano
3
+ # The plugin version number
2
4
  module SozoMagento2
3
- VERSION = "1.2.1"
5
+ # The plugin version number
6
+ # @return [String] The gem version number
7
+ VERSION = "1.5.0"
4
8
  end
5
9
  end
@@ -1,8 +1,9 @@
1
1
  require 'date'
2
2
 
3
- SSHKit.config.command_map[:composer] = 'php -dmemory_limit=-1 -f /usr/local/bin/composer'
4
- SSHKit.config.command_map[:n98magerun] = '/usr/local/bin/n98-magerun'
5
- SSHKit.config.command_map[:magento] = "/usr/bin/env php -d memory_limit=1G -f bin/magento --"
3
+ SSHKit.config.command_map[:php] = '/usr/bin/env php -dmemory_limit=-1'
4
+ SSHKit.config.command_map[:composer] = SSHKit.config.command_map[:php], '-f /usr/local/bin/composer'
5
+ SSHKit.config.command_map[:n98magerun] = SSHKit.config.command_map[:php], '-f /usr/local/bin/n98-magerun'
6
+ SSHKit.config.command_map[:magento] = SSHKit.config.command_map[:php], '-f bin/magento --'
6
7
 
7
8
  load File.expand_path('../tasks/sozo_magento2.rake', __FILE__)
8
9
  load File.expand_path('../tasks/deploy.rake', __FILE__)
@@ -16,14 +17,19 @@ load File.expand_path('../tasks/provision.rake', __FILE__)
16
17
  load File.expand_path('../tasks/server.rake', __FILE__)
17
18
  load File.expand_path('../tasks/wordpress.rake', __FILE__)
18
19
 
20
+ after 'deploy:check', 'sozo:git:check'
21
+ after 'deploy:check', 'sozo:info'
22
+
19
23
  after 'deploy:updating', 'composer:install'
24
+ # after 'deploy:updating', 'magento:patches:apply'
20
25
  after 'deploy:updating', 'magento:setup:permissions'
21
26
 
22
- before 'deploy:updated', 'slack:deploying'
23
27
  before 'deploy:updated', 'db:backup'
28
+ before 'deploy:updated', 'magento:cron:remove'
24
29
  before 'deploy:updated', 'sozo:config:setup'
25
- before 'deploy:updated', 'magento:maintenance:enable'
26
30
 
31
+ after 'deploy:updated', 'slack:deploying'
32
+ after 'deploy:updated', 'magento:maintenance:enable'
27
33
  after 'deploy:updated', 'provision:setup_dir'
28
34
  after 'deploy:updated', 'magento:setup:upgrade'
29
35
  after 'deploy:updated', 'magento:setup:di:compile'
@@ -37,16 +43,19 @@ after 'deploy:finishing', 'wordpress:cleanup'
37
43
  after 'deploy:finishing', 'sozo:optimise'
38
44
  after 'deploy:finishing', 'server:service:restart'
39
45
  after 'deploy:finishing', 'magento:maintenance:disable'
46
+ after 'deploy:finishing', 'magento:cron:install'
40
47
 
41
48
  after 'deploy:finished', "slack:deployed"
42
49
  after 'deploy:finished', "db:cleanup"
43
50
 
44
- after 'deploy:failed', "slack:failed"
45
51
  after 'deploy:failed', "sozo:fix_current"
52
+ after 'deploy:failed', "slack:failed"
53
+ after 'deploy:failed', 'magento:cron:remove'
54
+ after 'deploy:failed', 'magento:cron:install'
46
55
  after 'deploy:failed', 'magento:maintenance:disable'
47
56
 
48
57
  namespace :load do
49
58
  task :defaults do
50
59
  load 'capistrano/sozo_magento2/defaults.rb'
51
60
  end
52
- end
61
+ end
@@ -1,3 +1,4 @@
1
+ # Composer namespace
1
2
  namespace :composer do
2
3
  desc "Install the Composer dependencies"
3
4
  task :install do
@@ -28,7 +28,7 @@ namespace :db do
28
28
  task :wp_db_backup do
29
29
  # Backup the database with a timestamp
30
30
  on roles :all do
31
- if (fetch(:wp_backup) == "true")
31
+ if (fetch(:wp_backup).to_s == "true")
32
32
  info "Backing up WordPress database."
33
33
  execute :n98magerun, 'db:dump', "--root-dir='#{fetch(:mage_root)}'",
34
34
  '--compression="gzip"',
@@ -7,6 +7,14 @@ namespace :deploy do
7
7
  end
8
8
  end
9
9
 
10
+ after :updated, :confirm_setup do
11
+ if fetch(:magento_deploy_confirm_roles).include? fetch(:stage).to_s
12
+ print "\e[0;31m Put site in maintenance mode and deploy to #{fetch(:stage).to_s}? [y/n] \e[0m"
13
+ proceed = STDIN.gets[0..0] rescue nil
14
+ exit unless proceed == 'y' || proceed == 'Y'
15
+ end
16
+ end
17
+
10
18
 
11
19
  Rake::Task["cleanup"].clear_actions
12
20
 
@@ -40,10 +48,15 @@ namespace :deploy do
40
48
  desc "Failed deployment tasks"
41
49
  task :failed do
42
50
  on release_roles :all do |host|
43
- on roles :production, :staging, :testing do
44
- execute :rm, '-rf', release_path
51
+ if (fetch(:clear_failures) == "true")
52
+ # Hold for a few seconds to make sure all disk related actions have completed
53
+ info "Waiting for file / disk writing to complete"
54
+ sleep(3)
55
+ # Added sudo to make sure we can clear everything
56
+ info "Removing failed deployment"
57
+ execute :sudo, 'rm', '-rf', release_path
45
58
  info "Removed failed deployment"
46
59
  end
47
60
  end
48
61
  end
49
- end
62
+ end
@@ -1,11 +1,37 @@
1
1
  namespace :magento do
2
2
 
3
+ namespace :cron do
4
+ desc 'Remove cron'
5
+ task :remove do
6
+ on release_roles :all do
7
+ info "Disabling cron"
8
+ if (fetch(:handle_cron).to_s == "true")
9
+ execute :php, '-f', "#{fetch(:deploy_root)}/magento2/bin/magento", 'cron:remove'
10
+ else
11
+ info "Cron not controlled by capistrano"
12
+ end
13
+ end
14
+ end
15
+
16
+ desc 'Install cron'
17
+ task :install do
18
+ on release_roles :all do
19
+ info "Enabling cron"
20
+ if (fetch(:handle_cron).to_s == "true")
21
+ execute :php, '-f', "#{fetch(:deploy_root)}/magento2/bin/magento", 'cron:install', '-d'
22
+ else
23
+ info "Cron not controlled by capistrano"
24
+ end
25
+ end
26
+ end
27
+ end
28
+
3
29
  namespace :cache do
4
30
  desc 'Flush Magento cache storage'
5
31
  task :flush do
6
32
  on release_roles :all do
7
33
  within release_path do
8
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'cache:flush'
34
+ execute :php, '-f', 'magento/bin/magento', 'cache:flush'
9
35
  end
10
36
  end
11
37
  end
@@ -14,7 +40,7 @@ namespace :magento do
14
40
  task :clean do
15
41
  on release_roles :all do
16
42
  within release_path do
17
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'cache:clean'
43
+ execute :php, '-f', 'magento/bin/magento', 'cache:clean'
18
44
  end
19
45
  end
20
46
  end
@@ -24,7 +50,7 @@ namespace :magento do
24
50
  on release_roles :all do
25
51
  within release_path do
26
52
  if File.exist?("magento/bin/magento")
27
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'cache:enable', 'config layout block_html collections reflection db_ddl eav config_integration config_integration_api full_page translate config_webservice'
53
+ execute :php, '-f', 'magento/bin/magento', 'cache:enable', 'config layout block_html collections reflection db_ddl eav config_integration config_integration_api full_page translate config_webservice'
28
54
  end
29
55
  end
30
56
  end
@@ -34,7 +60,7 @@ namespace :magento do
34
60
  task :disable do
35
61
  on release_roles :all do
36
62
  within release_path do
37
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'cache:disable'
63
+ execute :php, '-f', 'magento/bin/magento', 'cache:disable'
38
64
  end
39
65
  end
40
66
  end
@@ -43,7 +69,7 @@ namespace :magento do
43
69
  task :status do
44
70
  on release_roles :all do
45
71
  within release_path do
46
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'cache:status'
72
+ execute :php, '-f', 'magento/bin/magento', 'cache:status'
47
73
  end
48
74
  end
49
75
  end
@@ -76,7 +102,7 @@ namespace :magento do
76
102
  if test("[ -f #{release_path}/magento/app/etc/config.php ]")
77
103
  # Exists, carry on
78
104
  else
79
- execute :php, '-dmemory_limit=-1', '-f', 'bin/magento', "module:enable", "--all"
105
+ execute :php, '-f', 'bin/magento', "module:enable", "--all"
80
106
  end
81
107
  end
82
108
  end
@@ -86,7 +112,7 @@ namespace :magento do
86
112
  task 'disable', :module_name do |t, args|
87
113
  on release_roles :staging do
88
114
  within release_path + 'magento/' do
89
- execute :php, '-dmemory_limit=-1', '-f', 'bin/magento', "module:disable", args[:module_name]
115
+ execute :php, '-f', 'bin/magento', "module:disable", args[:module_name]
90
116
  end
91
117
  end
92
118
  end
@@ -95,7 +121,7 @@ namespace :magento do
95
121
  task 'enable', :module_name do |t, args|
96
122
  on release_roles :staging do
97
123
  within release_path + 'magento/' do
98
- execute :php, '-dmemory_limit=-1', '-f', 'bin/magento', "module:enable", args[:module_name], '-f'
124
+ execute :php, '-f', 'bin/magento', "module:enable", args[:module_name], '-f'
99
125
  invoke 'magento:setup:upgrade'
100
126
  invoke 'magento:setup:static-content:deploy'
101
127
  end
@@ -112,7 +138,7 @@ namespace :magento do
112
138
  within release_path + 'magento/' do
113
139
  ask(:parameter, '')
114
140
  ask(:value, '')
115
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', "setup:config:set", "--#{fetch(:parameter)}=#{fetch(:value)}", "--no-interaction"
141
+ execute :php, '-f', 'magento/bin/magento', "setup:config:set", "--#{fetch(:parameter)}=#{fetch(:value)}", "--no-interaction"
116
142
  end
117
143
  end
118
144
  end
@@ -131,7 +157,7 @@ namespace :magento do
131
157
  task :upgrade do
132
158
  on release_roles :all do
133
159
  within release_path do
134
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'setup:upgrade', '-n'
160
+ execute :php, '-f', 'magento/bin/magento', 'setup:upgrade', '-n'
135
161
  end
136
162
  end
137
163
  end
@@ -172,7 +198,7 @@ namespace :magento do
172
198
  task :compile do
173
199
  on release_roles :all do
174
200
  within release_path do
175
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'setup:di:compile'
201
+ execute :php, '-f', 'magento/bin/magento', 'setup:di:compile'
176
202
  end
177
203
  end
178
204
  end
@@ -183,7 +209,7 @@ namespace :magento do
183
209
  task :deploy do
184
210
  on release_roles :all do
185
211
  within release_path do
186
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'setup:static-content:deploy -f en_US en_GB -j6'
212
+ execute :php, '-f', 'magento/bin/magento', 'setup:static-content:deploy -f en_US en_GB -j6'
187
213
  end
188
214
  end
189
215
  end
@@ -195,22 +221,14 @@ namespace :magento do
195
221
  desc 'Enable maintenance mode'
196
222
  task :enable do
197
223
  on release_roles :all do
198
- within current_path do
199
- if File.exist?("magento/bin/magento")
200
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'maintenance:enable'
201
- end
202
- end
224
+ execute :php, '-f', "#{fetch(:deploy_root)}/magento2/bin/magento", 'maintenance:enable'
203
225
  end
204
226
  end
205
227
 
206
228
  desc 'Disable maintenance mode'
207
229
  task :disable do
208
230
  on release_roles :all do
209
- within current_path do
210
- if File.exist?("magento/bin/magento")
211
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'maintenance:disable'
212
- end
213
- end
231
+ execute :php, '-f', "#{fetch(:deploy_root)}/magento2/bin/magento", 'maintenance:disable'
214
232
  end
215
233
  end
216
234
 
@@ -218,7 +236,7 @@ namespace :magento do
218
236
  task :status do
219
237
  on release_roles :all do
220
238
  within current_path do
221
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'maintenance:status'
239
+ execute :php, '-f', 'magento/bin/magento', 'maintenance:status'
222
240
  end
223
241
  end
224
242
  end
@@ -227,7 +245,7 @@ namespace :magento do
227
245
  task 'allow-ips', :ip do |t, args|
228
246
  on release_roles :all do
229
247
  within current_path do
230
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'maintenance:allow-ips', args[:ip]
248
+ execute :php, '-f', 'magento/bin/magento', 'maintenance:allow-ips', args[:ip]
231
249
  end
232
250
  end
233
251
  end
@@ -238,7 +256,37 @@ namespace :magento do
238
256
  task :reindex do
239
257
  on release_roles :all do
240
258
  within release_path do
241
- execute :php, '-dmemory_limit=-1', '-f', 'magento/bin/magento', 'indexer:reindex'
259
+ execute :php, '-f', 'magento/bin/magento', 'indexer:reindex'
260
+ end
261
+ end
262
+ end
263
+ end
264
+
265
+ namespace :patches do
266
+ desc 'Run the ece-patch tool if the .magento.env.yaml file exists'
267
+ task :apply do
268
+ on release_roles :all do
269
+ within release_path do
270
+ if test("[ -f #{release_path}/magento/.magento.env.yaml ]")
271
+ info 'Applying patches'
272
+ execute :php, '-f', 'magento/vendor/bin/ece-patches', 'apply --no-interaction'
273
+ else
274
+ info 'No patch file found, skipping.'
275
+ end
276
+ end
277
+ end
278
+ end
279
+
280
+ desc 'Revert patches if the .magento.env.yaml files exists'
281
+ task :revert do
282
+ on release_roles :all do
283
+ within release_path do
284
+ if test("[ -f #{release_path}/magento/.magento.env.yaml ]")
285
+ info 'Reverting patches'
286
+ execute :php, '-f', 'magento/vendor/bin/ece-patches', 'revert --no-interaction'
287
+ else
288
+ info 'No patch file found, skipping.'
289
+ end
242
290
  end
243
291
  end
244
292
  end
@@ -1,5 +1,32 @@
1
+ require 'capistrano/sozo_magento2/info'
2
+
3
+ include SozoMagento2::Info
4
+
1
5
  namespace :sozo do
2
6
 
7
+ desc "Info"
8
+ task :info do
9
+ on roles(:all) do
10
+ SozoMagento2::Info::Info.new.call
11
+ end
12
+ end
13
+
14
+ namespace :git do
15
+ desc "Git branch Check"
16
+ task :check do
17
+ on roles(:all) do
18
+ check = capture(:git, 'ls-remote', '--heads', fetch(:repo_url), fetch(:branch), '|', 'wc', '-l')
19
+
20
+ if check.to_i == 1
21
+ info "Branch is available for deployment."
22
+ else
23
+ error "Branch does not exist in git repository, have you pushed your changes?"
24
+ exit 1
25
+ end
26
+ end
27
+ end
28
+ end
29
+
3
30
  desc "Fix current directory if needed"
4
31
  task :fix_current do
5
32
  on roles(:all) do
@@ -64,7 +91,6 @@ namespace :sozo do
64
91
  end
65
92
  on roles :production do
66
93
  within release_path do
67
- invoke 'magento:cache:enable'
68
94
  invoke 'magento:cache:flush'
69
95
  invoke 'magento:indexer:reindex'
70
96
  end
@@ -12,10 +12,15 @@ namespace :wordpress do
12
12
  on roles :all do |host|
13
13
  within release_path + "magento/wp/" do
14
14
  info "Removing default unused WordPress Plugins and Themes"
15
- execute :wp, 'plugin', 'delete', 'hello'
16
- execute :wp, 'theme', 'delete', 'twentyseventeen'
17
- execute :wp, 'theme', 'delete', 'twentynineteen'
18
- execute :wp, 'theme', 'delete', 'twentytwenty'
15
+ if fetch(:wp_disable_plugins).length >= 1
16
+ execute :wp, 'plugin', 'deactivate', fetch(:wp_disable_plugins)
17
+ end
18
+ if fetch(:wp_delete_plugins).length >= 1
19
+ execute :wp, 'plugin', 'delete', fetch(:wp_delete_plugins)
20
+ end
21
+ if fetch(:wp_delete_themes).length >= 1
22
+ execute :wp, 'theme', 'delete', fetch(:wp_delete_themes)
23
+ end
19
24
  execute :rm, '-f', 'readme.html'
20
25
  end
21
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-sozo_magento2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clive Walkden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2022-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
+ - ".yardopts"
35
36
  - BUILD.md
36
37
  - CHANGELOG.md
37
38
  - Gemfile
@@ -40,6 +41,7 @@ files:
40
41
  - capistrano-sozo_magento.gemspec
41
42
  - lib/capistrano/sozo_magento2.rb
42
43
  - lib/capistrano/sozo_magento2/defaults.rb
44
+ - lib/capistrano/sozo_magento2/info.rb
43
45
  - lib/capistrano/sozo_magento2/slack.rb
44
46
  - lib/capistrano/sozo_magento2/version.rb
45
47
  - lib/capistrano/tasks/composer.rake