5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-28 14:16:22 +00:00

Merge branch 'issue-14169' of https://0xacab.org/sutty/sutty into 17.3.alpine.panel.sutty.nl

This commit is contained in:
Sutty 2023-08-30 19:47:28 +00:00
commit f6ba908eb2
3 changed files with 19 additions and 18 deletions

View file

@ -148,7 +148,7 @@ GEM
devise_invitable (2.0.8) devise_invitable (2.0.8)
actionmailer (>= 5.0) actionmailer (>= 5.0)
devise (>= 4.6) devise (>= 4.6)
distributed-press-api-client (0.2.4) distributed-press-api-client (0.3.0rc0)
addressable (~> 2.3, >= 2.3.0) addressable (~> 2.3, >= 2.3.0)
climate_control climate_control
dry-schema dry-schema
@ -582,7 +582,7 @@ DEPENDENCIES
devise devise
devise-i18n devise-i18n
devise_invitable devise_invitable
distributed-press-api-client (~> 0.2.3) distributed-press-api-client (~> 0.3.0rc0)
dotenv-rails dotenv-rails
down down
ed25519 ed25519

View file

@ -61,14 +61,8 @@ class Deploy < ApplicationRecord
extra_env.merge({ extra_env.merge({
'HOME' => home_dir, 'HOME' => home_dir,
'PATH' => paths.join(':'), 'PATH' => paths.join(':'),
'SPREE_API_KEY' => site.tienda_api_key,
'SPREE_URL' => site.tienda_url,
'AIRBRAKE_PROJECT_ID' => site.id.to_s,
'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key,
'JEKYLL_ENV' => Rails.env, 'JEKYLL_ENV' => Rails.env,
'LANG' => ENV['LANG'], 'LANG' => ENV['LANG'],
'YARN_CACHE_FOLDER' => yarn_cache_dir,
'GEMS_SOURCE' => ENV['GEMS_SOURCE']
}) })
end end
@ -154,21 +148,14 @@ class Deploy < ApplicationRecord
@deploy_local ||= site.deploys.find_by(type: 'DeployLocal') @deploy_local ||= site.deploys.find_by(type: 'DeployLocal')
end end
def non_local_deploys
@non_local_deploys ||= site.deploys.where.not(type: 'DeployLocal')
end
# Consigue todas las variables de entorno configuradas por otros # Consigue todas las variables de entorno configuradas por otros
# deploys. # deploys.
# #
# @deprecated Solo tenía sentido para Distributed Press v0
# @return [Hash] # @return [Hash]
def extra_env def extra_env
@extra_env ||= @extra_env ||=
non_local_deploys.reduce({}) do |extra_env, deploy| site.deployment_list.reduce({}) do |extra, deploy|
extra_env.tap do |e| extra.merge deploy.local_env
e.merge! deploy.local_env
end
end end
end end
end end

View file

@ -76,6 +76,20 @@ class DeployLocal < Deploy
FileUtils.rm_rf(File.join(site.path, '.jekyll-cache')) FileUtils.rm_rf(File.join(site.path, '.jekyll-cache'))
end end
# Opciones necesarias para la compilación del sitio
#
# @return [Hash]
def local_env
@local_env ||= {
'SPREE_API_KEY' => site.tienda_api_key,
'SPREE_URL' => site.tienda_url,
'AIRBRAKE_PROJECT_ID' => site.id.to_s,
'AIRBRAKE_PROJECT_KEY' => site.airbrake_api_key,
'YARN_CACHE_FOLDER' => yarn_cache_dir,
'GEMS_SOURCE' => ENV['GEMS_SOURCE']
}
end
private private
def mkdir def mkdir
@ -148,7 +162,7 @@ class DeployLocal < Deploy
# @param :args [Hash] # @param :args [Hash]
# @return [String] # @return [String]
def extra_flags(**args) def extra_flags(**args)
non_local_deploys.map do |deploy| site.deployment_list.map do |deploy|
deploy.flags_for_build(**args) deploy.flags_for_build(**args)
end.compact.join(' ') end.compact.join(' ')
end end