capistrano-sozo_magento2 1.5.1 → 1.7.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: 98c509eae724dea5c38746f591cb1038102bcce324373ef7ad1cb0f48c5ee604
4
- data.tar.gz: 3da4dafb3310757ea46730200df4e48f3c6a2ebdf25d0536ea57cce0e46f37bb
3
+ metadata.gz: 923ebdbd8e0af793979bc643b64dcf620b6a41339e7a0a37fd1493d4c0ebe394
4
+ data.tar.gz: 96129ba2ee73f1f05a3e920676b8b70ed3dc1b0a2e70e500c31c19c0f75cfca1
5
5
  SHA512:
6
- metadata.gz: 0fd96c30e041efc3a73b598cb9866cbfed78f0e7013c6d647100b2149ca6354f2a111e5a08c13bd1909328a7f9a7f0dd7af28772511d8aa4fb5b5cd53c701abc
7
- data.tar.gz: '08953c640d73eb088071f465a9ed8d8b61805c7d922cbde614cf050ab9c247a7cfdccd112f6a9baad214f477ffecfe8dd9ee688e6d240193893df95a425e0a12'
6
+ metadata.gz: 0a084753174d86a81c8af5fa6b4b6334121688f924cddabdb0107f34012d09db7a6106531e058de9fc833a256170f18f23597a1cb640cde3ab94f345e07991c5
7
+ data.tar.gz: 8b2e192b898f69a731df2f1e38a1fcd83bd01691eefe336cb88e848a00957043d8432919827c09e8248dca394a36ef7b736ff1f8aadae7541edca3075bfc4b49
data/CHANGELOG.md CHANGED
@@ -21,6 +21,31 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
21
21
 
22
22
  ## [Unreleased]
23
23
 
24
+
25
+ ## [v1.7.0] - 2022-09-22
26
+ ### Changed
27
+ - Fixed checks for branch existence to include tags.
28
+
29
+ ### Fixed
30
+ - When deployment fails due to cleanup task failing.
31
+
32
+
33
+ ## [v1.6.0] - 2022-06-18
34
+ ### Added
35
+ - Ability to copy over multiple themes and specify their name.
36
+
37
+ ### Changed
38
+ - Removed `--no-suggest` from composer commands
39
+
40
+ ### Removed
41
+ - Fishpig rake file
42
+ - WordPress twentytwentytwo theme now deleted by default.
43
+
44
+ ### Fixed
45
+ - Fixed the order of reindex and cache flush.
46
+ - Fixed patch.log permissions if it exists.
47
+
48
+
24
49
  ## [v1.5.1] - 2022-02-23
25
50
  ### Changed
26
51
  - Reverted change to magento:patches:apply
data/README.md CHANGED
@@ -7,13 +7,16 @@ 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.5"
10
+ gem "capistrano-sozo_magento2", "~> 1.6"
11
11
  ```
12
12
  2. Install
13
13
  ```
14
14
  bundle install
15
15
  ```
16
16
 
17
+ ## Updating
18
+ Update the gem to the latest version with `bundle update capistrano-sozo_magento2 --conservative`
19
+
17
20
  ## Usage
18
21
  Make sure the following lines are added to your project's `Capfile`:
19
22
  ```
@@ -18,9 +18,9 @@ set :linked_dirs, fetch(:linked_dirs, []).push(
18
18
  )
19
19
 
20
20
  # Composer defaults
21
- set :composer_flags, '--no-dev --optimize-autoloader --prefer-dist --no-interaction --no-suggest'
22
- set :composer_dev_flags, '--prefer-dist --no-interaction --no-suggest'
23
- set :composer_require_flags, '--update-no-dev --optimize-autoloader --prefer-dist --no-suggest'
21
+ set :composer_flags, '--no-dev --optimize-autoloader --prefer-dist --no-interaction'
22
+ set :composer_dev_flags, '--prefer-dist --no-interaction'
23
+ set :composer_require_flags, '--update-no-dev --optimize-autoloader --prefer-dist'
24
24
  set :composer_require_dev_flags, '--optimize-autoloader --prefer-dist'
25
25
 
26
26
  # DB defaults
@@ -31,9 +31,10 @@ set :keep_backups, fetch(:keep_backups, 10)
31
31
 
32
32
  # WordPress integration defaults
33
33
  set :wp_backup, fetch(:wp_backup, true)
34
- set :wp_delete_themes, fetch(:wp_delete_themes, 'twentyseventeen twentynineteen twentytwenty twentytwentyone')
34
+ set :wp_delete_themes, fetch(:wp_delete_themes, 'twentyseventeen twentynineteen twentytwenty twentytwentyone twentytwentytwo')
35
35
  set :wp_delete_plugins, fetch(:wp_delete_plugins, 'hello')
36
36
  set :wp_disable_plugins, fetch(:wp_disable_plugins, '')
37
+ set :wp_copy_themes, fetch(:wp_copy_themes, 'fishpig')
37
38
 
38
39
  # Slack defaults
39
40
  set :slack_channel, fetch(:slack_channel, '#deployments')
@@ -4,6 +4,6 @@ module Capistrano
4
4
  module SozoMagento2
5
5
  # The plugin version number
6
6
  # @return [String] The gem version number
7
- VERSION = "1.5.1"
7
+ VERSION = "1.7.0"
8
8
  end
9
9
  end
@@ -11,7 +11,6 @@ load File.expand_path('../tasks/composer.rake', __FILE__)
11
11
  load File.expand_path('../tasks/sozo.rake', __FILE__)
12
12
  load File.expand_path('../tasks/slack.rake', __FILE__)
13
13
  load File.expand_path('../tasks/db.rake', __FILE__)
14
- load File.expand_path('../tasks/fishpig.rake', __FILE__)
15
14
  load File.expand_path('../tasks/magento2.rake', __FILE__)
16
15
  load File.expand_path('../tasks/provision.rake', __FILE__)
17
16
  load File.expand_path('../tasks/server.rake', __FILE__)
@@ -37,7 +36,7 @@ after 'deploy:updated', 'magento:setup:static-content:deploy'
37
36
  after 'deploy:updated', 'provision:permissions'
38
37
 
39
38
  after 'deploy:finishing', 'sozo:symlink'
40
- after 'deploy:finishing', 'fishpig:setup:install_theme'
39
+ after 'deploy:finishing', 'wordpress:copy_themes'
41
40
  after 'deploy:finishing', 'wordpress:sozo_mu'
42
41
  after 'deploy:finishing', 'wordpress:cleanup'
43
42
  after 'deploy:finishing', 'sozo:optimise'
@@ -34,7 +34,7 @@ namespace :deploy do
34
34
  directories_str = directories.map do |release|
35
35
  releases_path.join(release)
36
36
  end.join(" ")
37
- execute :sudo, 'rm', "-rf", directories_str
37
+ execute :sudo, 'rm', "-rf", directories_str, "||", "true"
38
38
  # TODO re-symlink the old directory
39
39
  else
40
40
  info t(:no_old_releases, host: host.to_s, keep_releases: keep)
@@ -292,4 +292,15 @@ namespace :magento do
292
292
  end
293
293
  end
294
294
 
295
+ namespace :fishpig do
296
+ desc 'Create and install Fishpig WordPress theme'
297
+ task :create_theme do
298
+ on release_roles :all do
299
+ within release_path do
300
+ execute :php, '-f', 'magento/bin/magento', 'fishpig:wordpress:build-theme', '--install-path=magento/wp'
301
+ end
302
+ end
303
+ end
304
+ end
305
+
295
306
  end
@@ -15,9 +15,15 @@ namespace :provision do
15
15
  execute :sudo, "find", "#{release_path}/magento", '-type d -print0 | sudo xargs --no-run-if-empty --null --max-procs=0 chmod 770'
16
16
  execute :sudo, "find", "#{release_path}/magento", '-type f -print0 | sudo xargs --no-run-if-empty --null --max-procs=0 chmod 660'
17
17
 
18
+ # Magento bin permissions update
18
19
  if test("[ -f #{release_path}/magento/bin/magento ]")
19
20
  execute :sudo, "chmod", "+x", "#{release_path}/magento/bin/magento"
20
21
  end
22
+
23
+ # patch.log permission check
24
+ if test("[ -f #{deploy_to}/shared/magento/var/log/patch.log ]")
25
+ execute :sudo, "chmod", "0664", "#{deploy_to}/shared/magento/var/log/patch.log"
26
+ end
21
27
 
22
28
  execute :sudo, "find", "#{release_path}/magento", '-print0 | sudo xargs --no-run-if-empty --null --max-procs=0 chown', "#{fetch(:username)}:#{fetch(:group)}"
23
29
 
@@ -32,7 +38,7 @@ namespace :provision do
32
38
  on roles :app do
33
39
  info ("Checking for setup directory - #{release_path}/magento/setup")
34
40
 
35
- if test("[ -d #{release_path}/magento/setup/ ]")
41
+ if test("[ -d #{release_path}/magento/setup ]")
36
42
  else
37
43
  upload! "#{fetch(:magento_dir)}/setup", "#{release_path}/magento/", recursive: true
38
44
  invoke 'provision:permissions'
@@ -15,11 +15,23 @@ namespace :sozo do
15
15
  desc "Git branch Check"
16
16
  task :check do
17
17
  on roles(:all) do
18
+ found = false
19
+ # Check if branch exists on remote
18
20
  check = capture(:git, 'ls-remote', '--heads', fetch(:repo_url), fetch(:branch), '|', 'wc', '-l')
19
21
 
20
22
  if check.to_i == 1
21
23
  info "Branch is available for deployment."
22
- else
24
+ found = true
25
+ else
26
+ # Check if a tag exists on remote
27
+ check = capture(:git, 'ls-remote', '--tags', fetch(:repo_url), fetch(:branch), '|', 'wc', '-l')
28
+ if check.to_i == 1
29
+ info "Tag is available for deployment."
30
+ found = true
31
+ end
32
+ end
33
+
34
+ if found == false
23
35
  error "Branch does not exist in git repository, have you pushed your changes?"
24
36
  exit 1
25
37
  end
@@ -91,8 +103,8 @@ namespace :sozo do
91
103
  end
92
104
  on roles :production do
93
105
  within release_path do
94
- invoke 'magento:cache:flush'
95
106
  invoke 'magento:indexer:reindex'
107
+ invoke 'magento:cache:flush'
96
108
  end
97
109
  end
98
110
  end
@@ -26,4 +26,30 @@ namespace :wordpress do
26
26
  end
27
27
  end
28
28
 
29
+ desc "Copy Wordpress themes across"
30
+ task :copy_themes do
31
+ on roles :all do |host|
32
+ within release_path do
33
+ if fetch(:wp_copy_themes).length >= 1
34
+ # Retrieve the themes and split them into an array
35
+ themes = fetch(:wp_copy_themes).split(" ")
36
+ compiletheme = false
37
+
38
+ # Loop through and create the required theme directories
39
+ themes.each do |theme|
40
+ execute :mkdir, "-p", "#{release_path}/magento/wp/wp-content/themes/#{theme}"
41
+ execute :sudo, 'cp', '-a', "#{release_path}/environments/global/wp/wp-content/themes/#{theme}/.", "#{release_path}/magento/wp/wp-content/themes/#{theme}/"
42
+ if theme != "fishpig"
43
+ compiletheme = true
44
+ end
45
+ end
46
+
47
+ if compiletheme
48
+ invoke 'magento:fishpig:create_theme'
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+
29
55
  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.5.1
4
+ version: 1.7.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: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -47,7 +47,6 @@ files:
47
47
  - lib/capistrano/tasks/composer.rake
48
48
  - lib/capistrano/tasks/db.rake
49
49
  - lib/capistrano/tasks/deploy.rake
50
- - lib/capistrano/tasks/fishpig.rake
51
50
  - lib/capistrano/tasks/magento2.rake
52
51
  - lib/capistrano/tasks/provision.rake
53
52
  - lib/capistrano/tasks/server.rake
@@ -1,16 +0,0 @@
1
- namespace :fishpig do
2
- namespace :setup do
3
- desc "Install the Wordpress Fishpig theme"
4
- task :install_theme do
5
- on roles :all do |host|
6
- within release_path do
7
- execute :mkdir, "-p", "#{release_path}/magento/wp/wp-content/themes/fishpig"
8
- end
9
- end
10
-
11
- on roles(:all) do
12
- execute :sudo, 'cp', '-a', "#{release_path}/environments/global/wp/wp-content/themes/fishpig/.", "#{release_path}/magento/wp/wp-content/themes/fishpig/"
13
- end
14
- end
15
- end
16
- end