mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-19 14:26:22 +00:00
Merge branch 'issue-12755' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
abb5f9db55
1 changed files with 25 additions and 2 deletions
|
@ -554,10 +554,33 @@ class Site < ApplicationRecord
|
|||
Dir.chdir path, &block
|
||||
end
|
||||
|
||||
# Instala las gemas cuando es necesario:
|
||||
#
|
||||
# * El sitio existe
|
||||
# * No están instaladas
|
||||
# * El archivo Gemfile se modificó
|
||||
# * El archivo Gemfile.lock se modificó
|
||||
def install_gems
|
||||
return unless persisted?
|
||||
return if Rails.root.join('_storage', 'gems', name).directory?
|
||||
|
||||
deploys.find_by_type('DeployLocal').send(:bundle)
|
||||
if !gem_dir? || gemfile_updated? || gemfile_lock_updated?
|
||||
deploys.find_by_type('DeployLocal').send(:bundle)
|
||||
touch
|
||||
end
|
||||
end
|
||||
|
||||
# Detecta si el repositorio de gemas existe
|
||||
def gem_dir?
|
||||
Rails.root.join('_storage', 'gems', name).directory?
|
||||
end
|
||||
|
||||
# Detecta si el Gemfile fue modificado
|
||||
def gemfile_updated?
|
||||
updated_at > File.mtime(File.join(path, 'Gemfile'))
|
||||
end
|
||||
|
||||
# Detecta si el Gemfile.lock fue modificado
|
||||
def gemfile_lock_updated?
|
||||
updated_at > File.mtime(File.join(path, 'Gemfile.lock'))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue