forked from revoltchat/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes zammad#5190 - Add support for new tech stack on package install…
…ation. Co-authored-by: Dominik Klein <[email protected]>
- Loading branch information
1 parent
92a3bef
commit 6e96263
Showing
12 changed files
with
147 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/package/bundle_install.rb' | ||
Tasks::Zammad::Package::BundleInstall.register_rake_task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/command.rb' | ||
|
||
module Tasks | ||
module Zammad | ||
module Package | ||
class BundleInstall < Tasks::Zammad::Command | ||
def self.description | ||
'Install package related gem files.' | ||
end | ||
|
||
def self.gem_install | ||
return if !::Package.gem_files? | ||
|
||
if ::Package.app_package_installation? | ||
exec_command('zammad config:set BUNDLE_DEPLOYMENT=0') | ||
exec_command("zammad run bundle config set --local deployment 'false'") | ||
exec_command('zammad run bundle install') | ||
else | ||
exec_command('bundle install') | ||
end | ||
end | ||
|
||
def self.task_handler | ||
gem_install | ||
|
||
puts 'done.' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/package/post_install.rb' | ||
Tasks::Zammad::Package::PostInstall.register_rake_task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/command.rb' | ||
|
||
module Tasks | ||
module Zammad | ||
module Package | ||
class PostInstall < Tasks::Zammad::Command | ||
def self.description | ||
'Runs all steps to finalize package installation.' | ||
end | ||
|
||
def self.task_handler | ||
if ::Package.app_package_installation? | ||
exec_command('zammad run rake zammad:package:bundle_install') | ||
exec_command('zammad run rake zammad:package:migrate') | ||
exec_command('zammad run rake zammad:package:precompile') | ||
else | ||
exec_command('rake zammad:package:bundle_install') | ||
exec_command('rake zammad:package:migrate') | ||
exec_command('rake zammad:package:precompile') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/package/precompile.rb' | ||
Tasks::Zammad::Package::Precompile.register_rake_task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require_dependency 'tasks/zammad/command.rb' | ||
|
||
module Tasks | ||
module Zammad | ||
module Package | ||
# Package migrations must not be executed in the same process that also executed | ||
# Package.install or Package.link, as the codebase is in an inconsistent state. | ||
# This is enforced by Tasks:Zammad::Command which prevents command chaining. | ||
class Precompile < Tasks::Zammad::Command | ||
|
||
def self.description | ||
'Execute all package related precompilations.' | ||
end | ||
|
||
def self.yarn_compile | ||
return if !::Package.app_frontend_files? | ||
|
||
if ::Package.app_package_installation? | ||
exec_command('zammad run yarn install') | ||
exec_command('zammad run yarn add npx') | ||
exec_command('zammad run yarn generate-setting-types') | ||
exec_command('zammad run yarn run generate-graphql-api') | ||
else | ||
exec_command('yarn install') | ||
exec_command('yarn add npx') | ||
exec_command('yarn generate-setting-types') | ||
exec_command('yarn run generate-graphql-api') | ||
end | ||
end | ||
|
||
def self.assets_precompile | ||
if ::Package.app_package_installation? | ||
exec_command('zammad run rake assets:precompile') | ||
else | ||
exec_command('rake assets:precompile') | ||
end | ||
end | ||
|
||
def self.task_handler | ||
yarn_compile | ||
assets_precompile | ||
|
||
puts 'done.' | ||
end | ||
end | ||
end | ||
end | ||
end |